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_u8ZusizeZ {
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, usize)> for C2Tuple_CVec_u8ZusizeZ {
1563 fn from (tup: (crate::c_types::derived::CVec_u8Z, usize)) -> Self {
1570 impl C2Tuple_CVec_u8ZusizeZ {
1571 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, usize) {
1575 impl Clone for C2Tuple_CVec_u8ZusizeZ {
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_u8ZusizeZ_clone(orig: &C2Tuple_CVec_u8ZusizeZ) -> C2Tuple_CVec_u8ZusizeZ { Clone::clone(&orig) }
1587 /// Creates a new C2Tuple_CVec_u8ZusizeZ from the contained elements.
1589 pub extern "C" fn C2Tuple_CVec_u8ZusizeZ_new(a: crate::c_types::derived::CVec_u8Z, b: usize) -> C2Tuple_CVec_u8ZusizeZ {
1590 C2Tuple_CVec_u8ZusizeZ { a, b, }
1594 /// Frees any resources used by the C2Tuple_CVec_u8ZusizeZ.
1595 pub extern "C" fn C2Tuple_CVec_u8ZusizeZ_free(_res: C2Tuple_CVec_u8ZusizeZ) { }
1597 /// The contents of CResult_C2Tuple_CVec_u8ZusizeZNoneZ
1598 pub union CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr {
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_u8ZusizeZ,
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_u8ZusizeZNoneZ represents the result of a fallible operation,
1607 /// containing a crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ 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_u8ZusizeZNoneZ {
1610 /// The contents of this CResult_C2Tuple_CVec_u8ZusizeZNoneZ, accessible via either
1611 /// `err` or `result` depending on the state of `result_ok`.
1612 pub contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr,
1613 /// Whether this CResult_C2Tuple_CVec_u8ZusizeZNoneZ represents a success state.
1614 pub result_ok: bool,
1617 /// Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ in the success state.
1618 pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ) -> CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1619 CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1620 contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr {
1621 result: Box::into_raw(Box::new(o)),
1627 /// Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ in the error state.
1628 pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err() -> CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1629 CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1630 contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr {
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_u8ZusizeZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8ZusizeZNoneZ) -> bool {
1642 /// Frees any resources used by the CResult_C2Tuple_CVec_u8ZusizeZNoneZ.
1643 pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(_res: CResult_C2Tuple_CVec_u8ZusizeZNoneZ) { }
1644 impl Drop for CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
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_u8ZusizeZ, ()>> for CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1655 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ, ()>) -> 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_u8ZusizeZNoneZPtr { result }
1661 let _ = unsafe { Box::from_raw(o.contents.err) };
1662 o.contents.err = core::ptr::null_mut();
1663 CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { err: core::ptr::null_mut() }
1667 result_ok: o.result_ok,
1671 impl Clone for CResult_C2Tuple_CVec_u8ZusizeZNoneZ {
1672 fn clone(&self) -> Self {
1674 Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr {
1675 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ>::clone(unsafe { &*self.contents.result })))
1678 Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr {
1679 err: core::ptr::null_mut()
1685 /// Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ 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_u8ZusizeZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8ZusizeZNoneZ) -> CResult_C2Tuple_CVec_u8ZusizeZNoneZ { Clone::clone(&orig) }
1689 /// The contents of CResult_NoneNoneZ
1690 pub union CResult_NoneNoneZPtr {
1691 /// Note that this value is always NULL, as there are no contents in the OK variant
1692 pub result: *mut core::ffi::c_void,
1693 /// Note that this value is always NULL, as there are no contents in the Err variant
1694 pub err: *mut core::ffi::c_void,
1697 /// A CResult_NoneNoneZ represents the result of a fallible operation,
1698 /// containing a () on success and a () on failure.
1699 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1700 pub struct CResult_NoneNoneZ {
1701 /// The contents of this CResult_NoneNoneZ, accessible via either
1702 /// `err` or `result` depending on the state of `result_ok`.
1703 pub contents: CResult_NoneNoneZPtr,
1704 /// Whether this CResult_NoneNoneZ represents a success state.
1705 pub result_ok: bool,
1708 /// Creates a new CResult_NoneNoneZ in the success state.
1709 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
1711 contents: CResult_NoneNoneZPtr {
1712 result: core::ptr::null_mut(),
1718 /// Creates a new CResult_NoneNoneZ in the error state.
1719 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
1721 contents: CResult_NoneNoneZPtr {
1722 err: core::ptr::null_mut(),
1727 /// Checks if the given object is currently in the success state
1729 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
1733 /// Frees any resources used by the CResult_NoneNoneZ.
1734 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
1735 impl Drop for CResult_NoneNoneZ {
1736 fn drop(&mut self) {
1742 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
1743 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
1744 let contents = if o.result_ok {
1745 let _ = unsafe { Box::from_raw(o.contents.result) };
1746 o.contents.result = core::ptr::null_mut();
1747 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
1749 let _ = unsafe { Box::from_raw(o.contents.err) };
1750 o.contents.err = core::ptr::null_mut();
1751 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
1755 result_ok: o.result_ok,
1759 impl Clone for CResult_NoneNoneZ {
1760 fn clone(&self) -> Self {
1762 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
1763 result: core::ptr::null_mut()
1766 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
1767 err: core::ptr::null_mut()
1773 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
1774 /// but with all dynamically-allocated buffers duplicated in new buffers.
1775 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
1777 /// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size.
1778 /// This corresponds to std::vector in C++
1779 pub struct CVec_ECDSASignatureZ {
1780 /// The elements in the array.
1781 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1782 pub data: *mut crate::c_types::ECDSASignature,
1783 /// The number of elements pointed to by `data`.
1786 impl CVec_ECDSASignatureZ {
1787 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ECDSASignature> {
1788 if self.datalen == 0 { return Vec::new(); }
1789 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1790 self.data = core::ptr::null_mut();
1794 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] {
1795 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1798 impl From<Vec<crate::c_types::ECDSASignature>> for CVec_ECDSASignatureZ {
1799 fn from(v: Vec<crate::c_types::ECDSASignature>) -> Self {
1800 let datalen = v.len();
1801 let data = Box::into_raw(v.into_boxed_slice());
1802 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1806 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1807 pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { }
1808 impl Drop for CVec_ECDSASignatureZ {
1809 fn drop(&mut self) {
1810 if self.datalen == 0 { return; }
1811 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1814 impl Clone for CVec_ECDSASignatureZ {
1815 fn clone(&self) -> Self {
1816 let mut res = Vec::new();
1817 if self.datalen == 0 { return Self::from(res); }
1818 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1823 /// A tuple of 2 elements. See the individual fields for the types contained.
1824 pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
1825 /// The element at position 0
1826 pub a: crate::c_types::ECDSASignature,
1827 /// The element at position 1
1828 pub b: crate::c_types::derived::CVec_ECDSASignatureZ,
1830 impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
1831 fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self {
1838 impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
1839 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) {
1843 impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
1844 fn clone(&self) -> Self {
1846 a: Clone::clone(&self.a),
1847 b: Clone::clone(&self.b),
1852 /// Creates a new tuple which has the same data as `orig`
1853 /// but with all dynamically-allocated buffers duplicated in new buffers.
1854 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) }
1855 /// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements.
1857 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
1858 C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, }
1862 /// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ.
1863 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { }
1865 /// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ
1866 pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
1867 /// A pointer to the contents in the success state.
1868 /// Reading from this pointer when `result_ok` is not set is undefined.
1869 pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ,
1870 /// Note that this value is always NULL, as there are no contents in the Err variant
1871 pub err: *mut core::ffi::c_void,
1874 /// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation,
1875 /// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure.
1876 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1877 pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1878 /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either
1879 /// `err` or `result` depending on the state of `result_ok`.
1880 pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr,
1881 /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state.
1882 pub result_ok: bool,
1885 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state.
1886 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1887 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1888 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
1889 result: Box::into_raw(Box::new(o)),
1895 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state.
1896 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1897 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1898 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
1899 err: core::ptr::null_mut(),
1904 /// Checks if the given object is currently in the success state
1906 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool {
1910 /// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.
1911 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { }
1912 impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1913 fn drop(&mut self) {
1915 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1916 let _ = unsafe { Box::from_raw(self.contents.result) };
1922 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1923 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>) -> Self {
1924 let contents = if o.result_ok {
1925 let result = unsafe { o.contents.result };
1926 unsafe { o.contents.result = core::ptr::null_mut() };
1927 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result }
1929 let _ = unsafe { Box::from_raw(o.contents.err) };
1930 o.contents.err = core::ptr::null_mut();
1931 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() }
1935 result_ok: o.result_ok,
1939 impl Clone for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
1940 fn clone(&self) -> Self {
1942 Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
1943 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ>::clone(unsafe { &*self.contents.result })))
1946 Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
1947 err: core::ptr::null_mut()
1953 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig`
1954 /// but with all dynamically-allocated buffers duplicated in new buffers.
1955 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) }
1957 /// The contents of CResult_ECDSASignatureNoneZ
1958 pub union CResult_ECDSASignatureNoneZPtr {
1959 /// A pointer to the contents in the success state.
1960 /// Reading from this pointer when `result_ok` is not set is undefined.
1961 pub result: *mut crate::c_types::ECDSASignature,
1962 /// Note that this value is always NULL, as there are no contents in the Err variant
1963 pub err: *mut core::ffi::c_void,
1966 /// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation,
1967 /// containing a crate::c_types::ECDSASignature on success and a () on failure.
1968 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1969 pub struct CResult_ECDSASignatureNoneZ {
1970 /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either
1971 /// `err` or `result` depending on the state of `result_ok`.
1972 pub contents: CResult_ECDSASignatureNoneZPtr,
1973 /// Whether this CResult_ECDSASignatureNoneZ represents a success state.
1974 pub result_ok: bool,
1977 /// Creates a new CResult_ECDSASignatureNoneZ in the success state.
1978 pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ {
1979 CResult_ECDSASignatureNoneZ {
1980 contents: CResult_ECDSASignatureNoneZPtr {
1981 result: Box::into_raw(Box::new(o)),
1987 /// Creates a new CResult_ECDSASignatureNoneZ in the error state.
1988 pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ {
1989 CResult_ECDSASignatureNoneZ {
1990 contents: CResult_ECDSASignatureNoneZPtr {
1991 err: core::ptr::null_mut(),
1996 /// Checks if the given object is currently in the success state
1998 pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool {
2002 /// Frees any resources used by the CResult_ECDSASignatureNoneZ.
2003 pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { }
2004 impl Drop for CResult_ECDSASignatureNoneZ {
2005 fn drop(&mut self) {
2007 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2008 let _ = unsafe { Box::from_raw(self.contents.result) };
2014 impl From<crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>> for CResult_ECDSASignatureNoneZ {
2015 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>) -> Self {
2016 let contents = if o.result_ok {
2017 let result = unsafe { o.contents.result };
2018 unsafe { o.contents.result = core::ptr::null_mut() };
2019 CResult_ECDSASignatureNoneZPtr { result }
2021 let _ = unsafe { Box::from_raw(o.contents.err) };
2022 o.contents.err = core::ptr::null_mut();
2023 CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() }
2027 result_ok: o.result_ok,
2031 impl Clone for CResult_ECDSASignatureNoneZ {
2032 fn clone(&self) -> Self {
2034 Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr {
2035 result: Box::into_raw(Box::new(<crate::c_types::ECDSASignature>::clone(unsafe { &*self.contents.result })))
2038 Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr {
2039 err: core::ptr::null_mut()
2045 /// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig`
2046 /// but with all dynamically-allocated buffers duplicated in new buffers.
2047 pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) }
2049 /// The contents of CResult_PublicKeyNoneZ
2050 pub union CResult_PublicKeyNoneZPtr {
2051 /// A pointer to the contents in the success state.
2052 /// Reading from this pointer when `result_ok` is not set is undefined.
2053 pub result: *mut crate::c_types::PublicKey,
2054 /// Note that this value is always NULL, as there are no contents in the Err variant
2055 pub err: *mut core::ffi::c_void,
2058 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
2059 /// containing a crate::c_types::PublicKey on success and a () on failure.
2060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2061 pub struct CResult_PublicKeyNoneZ {
2062 /// The contents of this CResult_PublicKeyNoneZ, accessible via either
2063 /// `err` or `result` depending on the state of `result_ok`.
2064 pub contents: CResult_PublicKeyNoneZPtr,
2065 /// Whether this CResult_PublicKeyNoneZ represents a success state.
2066 pub result_ok: bool,
2069 /// Creates a new CResult_PublicKeyNoneZ in the success state.
2070 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
2071 CResult_PublicKeyNoneZ {
2072 contents: CResult_PublicKeyNoneZPtr {
2073 result: Box::into_raw(Box::new(o)),
2079 /// Creates a new CResult_PublicKeyNoneZ in the error state.
2080 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
2081 CResult_PublicKeyNoneZ {
2082 contents: CResult_PublicKeyNoneZPtr {
2083 err: core::ptr::null_mut(),
2088 /// Checks if the given object is currently in the success state
2090 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
2094 /// Frees any resources used by the CResult_PublicKeyNoneZ.
2095 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
2096 impl Drop for CResult_PublicKeyNoneZ {
2097 fn drop(&mut self) {
2099 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2100 let _ = unsafe { Box::from_raw(self.contents.result) };
2106 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
2107 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
2108 let contents = if o.result_ok {
2109 let result = unsafe { o.contents.result };
2110 unsafe { o.contents.result = core::ptr::null_mut() };
2111 CResult_PublicKeyNoneZPtr { result }
2113 let _ = unsafe { Box::from_raw(o.contents.err) };
2114 o.contents.err = core::ptr::null_mut();
2115 CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
2119 result_ok: o.result_ok,
2123 impl Clone for CResult_PublicKeyNoneZ {
2124 fn clone(&self) -> Self {
2126 Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
2127 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
2130 Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
2131 err: core::ptr::null_mut()
2137 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
2138 /// but with all dynamically-allocated buffers duplicated in new buffers.
2139 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
2142 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
2143 pub enum COption_BigEndianScalarZ {
2144 /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar
2145 Some(crate::c_types::BigEndianScalar),
2146 /// When we're in this state, this COption_BigEndianScalarZ contains nothing
2149 impl COption_BigEndianScalarZ {
2150 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2151 if let Self::None = self { false } else { true }
2153 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2156 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
2157 if let Self::Some(v) = self { v } else { unreachable!() }
2161 /// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar
2162 pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ {
2163 COption_BigEndianScalarZ::Some(o)
2166 /// Constructs a new COption_BigEndianScalarZ containing nothing
2167 pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ {
2168 COption_BigEndianScalarZ::None
2171 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
2172 pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { }
2174 /// Creates a new COption_BigEndianScalarZ which has the same data as `orig`
2175 /// but with all dynamically-allocated buffers duplicated in new buffers.
2176 pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) }
2178 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2179 /// This corresponds to std::vector in C++
2180 pub struct CVec_U5Z {
2181 /// The elements in the array.
2182 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2183 pub data: *mut crate::c_types::U5,
2184 /// The number of elements pointed to by `data`.
2188 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
2189 if self.datalen == 0 { return Vec::new(); }
2190 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2191 self.data = core::ptr::null_mut();
2195 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
2196 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2199 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
2200 fn from(v: Vec<crate::c_types::U5>) -> Self {
2201 let datalen = v.len();
2202 let data = Box::into_raw(v.into_boxed_slice());
2203 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2207 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2208 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
2209 impl Drop for CVec_U5Z {
2210 fn drop(&mut self) {
2211 if self.datalen == 0 { return; }
2212 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2215 impl Clone for CVec_U5Z {
2216 fn clone(&self) -> Self {
2217 let mut res = Vec::new();
2218 if self.datalen == 0 { return Self::from(res); }
2219 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2224 /// The contents of CResult_RecoverableSignatureNoneZ
2225 pub union CResult_RecoverableSignatureNoneZPtr {
2226 /// A pointer to the contents in the success state.
2227 /// Reading from this pointer when `result_ok` is not set is undefined.
2228 pub result: *mut crate::c_types::RecoverableSignature,
2229 /// Note that this value is always NULL, as there are no contents in the Err variant
2230 pub err: *mut core::ffi::c_void,
2233 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2234 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
2235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2236 pub struct CResult_RecoverableSignatureNoneZ {
2237 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2238 /// `err` or `result` depending on the state of `result_ok`.
2239 pub contents: CResult_RecoverableSignatureNoneZPtr,
2240 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
2241 pub result_ok: bool,
2244 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
2245 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
2246 CResult_RecoverableSignatureNoneZ {
2247 contents: CResult_RecoverableSignatureNoneZPtr {
2248 result: Box::into_raw(Box::new(o)),
2254 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
2255 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
2256 CResult_RecoverableSignatureNoneZ {
2257 contents: CResult_RecoverableSignatureNoneZPtr {
2258 err: core::ptr::null_mut(),
2263 /// Checks if the given object is currently in the success state
2265 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
2269 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
2270 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
2271 impl Drop for CResult_RecoverableSignatureNoneZ {
2272 fn drop(&mut self) {
2274 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2275 let _ = unsafe { Box::from_raw(self.contents.result) };
2281 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2282 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2283 let contents = if o.result_ok {
2284 let result = unsafe { o.contents.result };
2285 unsafe { o.contents.result = core::ptr::null_mut() };
2286 CResult_RecoverableSignatureNoneZPtr { result }
2288 let _ = unsafe { Box::from_raw(o.contents.err) };
2289 o.contents.err = core::ptr::null_mut();
2290 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2294 result_ok: o.result_ok,
2298 impl Clone for CResult_RecoverableSignatureNoneZ {
2299 fn clone(&self) -> Self {
2301 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2302 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2305 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2306 err: core::ptr::null_mut()
2312 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2313 /// but with all dynamically-allocated buffers duplicated in new buffers.
2314 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2316 /// The contents of CResult_SchnorrSignatureNoneZ
2317 pub union CResult_SchnorrSignatureNoneZPtr {
2318 /// A pointer to the contents in the success state.
2319 /// Reading from this pointer when `result_ok` is not set is undefined.
2320 pub result: *mut crate::c_types::SchnorrSignature,
2321 /// Note that this value is always NULL, as there are no contents in the Err variant
2322 pub err: *mut core::ffi::c_void,
2325 /// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation,
2326 /// containing a crate::c_types::SchnorrSignature on success and a () on failure.
2327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2328 pub struct CResult_SchnorrSignatureNoneZ {
2329 /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either
2330 /// `err` or `result` depending on the state of `result_ok`.
2331 pub contents: CResult_SchnorrSignatureNoneZPtr,
2332 /// Whether this CResult_SchnorrSignatureNoneZ represents a success state.
2333 pub result_ok: bool,
2336 /// Creates a new CResult_SchnorrSignatureNoneZ in the success state.
2337 pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ {
2338 CResult_SchnorrSignatureNoneZ {
2339 contents: CResult_SchnorrSignatureNoneZPtr {
2340 result: Box::into_raw(Box::new(o)),
2346 /// Creates a new CResult_SchnorrSignatureNoneZ in the error state.
2347 pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ {
2348 CResult_SchnorrSignatureNoneZ {
2349 contents: CResult_SchnorrSignatureNoneZPtr {
2350 err: core::ptr::null_mut(),
2355 /// Checks if the given object is currently in the success state
2357 pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool {
2361 /// Frees any resources used by the CResult_SchnorrSignatureNoneZ.
2362 pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { }
2363 impl Drop for CResult_SchnorrSignatureNoneZ {
2364 fn drop(&mut self) {
2366 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2367 let _ = unsafe { Box::from_raw(self.contents.result) };
2373 impl From<crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>> for CResult_SchnorrSignatureNoneZ {
2374 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>) -> Self {
2375 let contents = if o.result_ok {
2376 let result = unsafe { o.contents.result };
2377 unsafe { o.contents.result = core::ptr::null_mut() };
2378 CResult_SchnorrSignatureNoneZPtr { result }
2380 let _ = unsafe { Box::from_raw(o.contents.err) };
2381 o.contents.err = core::ptr::null_mut();
2382 CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() }
2386 result_ok: o.result_ok,
2390 impl Clone for CResult_SchnorrSignatureNoneZ {
2391 fn clone(&self) -> Self {
2393 Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr {
2394 result: Box::into_raw(Box::new(<crate::c_types::SchnorrSignature>::clone(unsafe { &*self.contents.result })))
2397 Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr {
2398 err: core::ptr::null_mut()
2404 /// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig`
2405 /// but with all dynamically-allocated buffers duplicated in new buffers.
2406 pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) }
2408 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2409 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2410 /// A pointer to the contents in the success state.
2411 /// Reading from this pointer when `result_ok` is not set is undefined.
2412 pub result: *mut crate::lightning::sign::WriteableEcdsaChannelSigner,
2413 /// A pointer to the contents in the error state.
2414 /// Reading from this pointer when `result_ok` is set is undefined.
2415 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2418 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2419 /// containing a crate::lightning::sign::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2420 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2421 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2422 /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2423 /// `err` or `result` depending on the state of `result_ok`.
2424 pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2425 /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2426 pub result_ok: bool,
2429 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2430 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2431 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2432 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2433 result: Box::into_raw(Box::new(o)),
2439 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
2440 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2441 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2442 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2443 err: Box::into_raw(Box::new(e)),
2448 /// Checks if the given object is currently in the success state
2450 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
2454 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
2455 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
2456 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2457 fn drop(&mut self) {
2459 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2460 let _ = unsafe { Box::from_raw(self.contents.result) };
2463 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2464 let _ = unsafe { Box::from_raw(self.contents.err) };
2469 impl From<crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2470 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2471 let contents = if o.result_ok {
2472 let result = unsafe { o.contents.result };
2473 unsafe { o.contents.result = core::ptr::null_mut() };
2474 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
2476 let err = unsafe { o.contents.err };
2477 unsafe { o.contents.err = core::ptr::null_mut(); }
2478 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
2482 result_ok: o.result_ok,
2486 impl Clone for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2487 fn clone(&self) -> Self {
2489 Self { result_ok: true, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2490 result: Box::into_raw(Box::new(<crate::lightning::sign::WriteableEcdsaChannelSigner>::clone(unsafe { &*self.contents.result })))
2493 Self { result_ok: false, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2494 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2500 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig`
2501 /// but with all dynamically-allocated buffers duplicated in new buffers.
2502 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) }
2504 /// The contents of CResult_CVec_u8ZNoneZ
2505 pub union CResult_CVec_u8ZNoneZPtr {
2506 /// A pointer to the contents in the success state.
2507 /// Reading from this pointer when `result_ok` is not set is undefined.
2508 pub result: *mut crate::c_types::derived::CVec_u8Z,
2509 /// Note that this value is always NULL, as there are no contents in the Err variant
2510 pub err: *mut core::ffi::c_void,
2513 /// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation,
2514 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2515 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2516 pub struct CResult_CVec_u8ZNoneZ {
2517 /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either
2518 /// `err` or `result` depending on the state of `result_ok`.
2519 pub contents: CResult_CVec_u8ZNoneZPtr,
2520 /// Whether this CResult_CVec_u8ZNoneZ represents a success state.
2521 pub result_ok: bool,
2524 /// Creates a new CResult_CVec_u8ZNoneZ in the success state.
2525 pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ {
2526 CResult_CVec_u8ZNoneZ {
2527 contents: CResult_CVec_u8ZNoneZPtr {
2528 result: Box::into_raw(Box::new(o)),
2534 /// Creates a new CResult_CVec_u8ZNoneZ in the error state.
2535 pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ {
2536 CResult_CVec_u8ZNoneZ {
2537 contents: CResult_CVec_u8ZNoneZPtr {
2538 err: core::ptr::null_mut(),
2543 /// Checks if the given object is currently in the success state
2545 pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool {
2549 /// Frees any resources used by the CResult_CVec_u8ZNoneZ.
2550 pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { }
2551 impl Drop for CResult_CVec_u8ZNoneZ {
2552 fn drop(&mut self) {
2554 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2555 let _ = unsafe { Box::from_raw(self.contents.result) };
2561 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_CVec_u8ZNoneZ {
2562 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
2563 let contents = if o.result_ok {
2564 let result = unsafe { o.contents.result };
2565 unsafe { o.contents.result = core::ptr::null_mut() };
2566 CResult_CVec_u8ZNoneZPtr { result }
2568 let _ = unsafe { Box::from_raw(o.contents.err) };
2569 o.contents.err = core::ptr::null_mut();
2570 CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() }
2574 result_ok: o.result_ok,
2578 impl Clone for CResult_CVec_u8ZNoneZ {
2579 fn clone(&self) -> Self {
2581 Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr {
2582 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
2585 Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr {
2586 err: core::ptr::null_mut()
2592 /// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig`
2593 /// but with all dynamically-allocated buffers duplicated in new buffers.
2594 pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) }
2596 /// The contents of CResult_ShutdownScriptNoneZ
2597 pub union CResult_ShutdownScriptNoneZPtr {
2598 /// A pointer to the contents in the success state.
2599 /// Reading from this pointer when `result_ok` is not set is undefined.
2600 pub result: *mut crate::lightning::ln::script::ShutdownScript,
2601 /// Note that this value is always NULL, as there are no contents in the Err variant
2602 pub err: *mut core::ffi::c_void,
2605 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
2606 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
2607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2608 pub struct CResult_ShutdownScriptNoneZ {
2609 /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
2610 /// `err` or `result` depending on the state of `result_ok`.
2611 pub contents: CResult_ShutdownScriptNoneZPtr,
2612 /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
2613 pub result_ok: bool,
2616 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
2617 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
2618 CResult_ShutdownScriptNoneZ {
2619 contents: CResult_ShutdownScriptNoneZPtr {
2620 result: Box::into_raw(Box::new(o)),
2626 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
2627 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
2628 CResult_ShutdownScriptNoneZ {
2629 contents: CResult_ShutdownScriptNoneZPtr {
2630 err: core::ptr::null_mut(),
2635 /// Checks if the given object is currently in the success state
2637 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
2641 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
2642 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
2643 impl Drop for CResult_ShutdownScriptNoneZ {
2644 fn drop(&mut self) {
2646 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2647 let _ = unsafe { Box::from_raw(self.contents.result) };
2653 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
2654 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
2655 let contents = if o.result_ok {
2656 let result = unsafe { o.contents.result };
2657 unsafe { o.contents.result = core::ptr::null_mut() };
2658 CResult_ShutdownScriptNoneZPtr { result }
2660 let _ = unsafe { Box::from_raw(o.contents.err) };
2661 o.contents.err = core::ptr::null_mut();
2662 CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
2666 result_ok: o.result_ok,
2670 impl Clone for CResult_ShutdownScriptNoneZ {
2671 fn clone(&self) -> Self {
2673 Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
2674 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2677 Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
2678 err: core::ptr::null_mut()
2684 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
2685 /// but with all dynamically-allocated buffers duplicated in new buffers.
2686 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
2689 /// An enum which can either contain a u16 or not
2690 pub enum COption_u16Z {
2691 /// When we're in this state, this COption_u16Z contains a u16
2693 /// When we're in this state, this COption_u16Z contains nothing
2697 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2698 if let Self::None = self { false } else { true }
2700 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2703 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
2704 if let Self::Some(v) = self { v } else { unreachable!() }
2708 /// Constructs a new COption_u16Z containing a u16
2709 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
2710 COption_u16Z::Some(o)
2713 /// Constructs a new COption_u16Z containing nothing
2714 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
2718 /// Frees any resources associated with the u16, if we are in the Some state
2719 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
2721 /// Creates a new COption_u16Z which has the same data as `orig`
2722 /// but with all dynamically-allocated buffers duplicated in new buffers.
2723 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
2726 /// An enum which can either contain a bool or not
2727 pub enum COption_boolZ {
2728 /// When we're in this state, this COption_boolZ contains a bool
2730 /// When we're in this state, this COption_boolZ contains nothing
2733 impl COption_boolZ {
2734 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2735 if let Self::None = self { false } else { true }
2737 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2740 #[allow(unused)] pub(crate) fn take(mut self) -> bool {
2741 if let Self::Some(v) = self { v } else { unreachable!() }
2745 /// Constructs a new COption_boolZ containing a bool
2746 pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ {
2747 COption_boolZ::Some(o)
2750 /// Constructs a new COption_boolZ containing nothing
2751 pub extern "C" fn COption_boolZ_none() -> COption_boolZ {
2755 /// Frees any resources associated with the bool, if we are in the Some state
2756 pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { }
2758 /// Creates a new COption_boolZ which has the same data as `orig`
2759 /// but with all dynamically-allocated buffers duplicated in new buffers.
2760 pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) }
2762 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
2763 /// This corresponds to std::vector in C++
2764 pub struct CVec_CVec_u8ZZ {
2765 /// The elements in the array.
2766 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2767 pub data: *mut crate::c_types::derived::CVec_u8Z,
2768 /// The number of elements pointed to by `data`.
2771 impl CVec_CVec_u8ZZ {
2772 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
2773 if self.datalen == 0 { return Vec::new(); }
2774 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2775 self.data = core::ptr::null_mut();
2779 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
2780 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2783 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
2784 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
2785 let datalen = v.len();
2786 let data = Box::into_raw(v.into_boxed_slice());
2787 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2791 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2792 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
2793 impl Drop for CVec_CVec_u8ZZ {
2794 fn drop(&mut self) {
2795 if self.datalen == 0 { return; }
2796 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2799 impl Clone for CVec_CVec_u8ZZ {
2800 fn clone(&self) -> Self {
2801 let mut res = Vec::new();
2802 if self.datalen == 0 { return Self::from(res); }
2803 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2808 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
2809 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
2810 /// A pointer to the contents in the success state.
2811 /// Reading from this pointer when `result_ok` is not set is undefined.
2812 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
2813 /// Note that this value is always NULL, as there are no contents in the Err variant
2814 pub err: *mut core::ffi::c_void,
2817 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
2818 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
2819 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2820 pub struct CResult_CVec_CVec_u8ZZNoneZ {
2821 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
2822 /// `err` or `result` depending on the state of `result_ok`.
2823 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
2824 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
2825 pub result_ok: bool,
2828 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
2829 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
2830 CResult_CVec_CVec_u8ZZNoneZ {
2831 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2832 result: Box::into_raw(Box::new(o)),
2838 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
2839 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
2840 CResult_CVec_CVec_u8ZZNoneZ {
2841 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2842 err: core::ptr::null_mut(),
2847 /// Checks if the given object is currently in the success state
2849 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
2853 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
2854 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
2855 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
2856 fn drop(&mut self) {
2858 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2859 let _ = unsafe { Box::from_raw(self.contents.result) };
2865 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
2866 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
2867 let contents = if o.result_ok {
2868 let result = unsafe { o.contents.result };
2869 unsafe { o.contents.result = core::ptr::null_mut() };
2870 CResult_CVec_CVec_u8ZZNoneZPtr { result }
2872 let _ = unsafe { Box::from_raw(o.contents.err) };
2873 o.contents.err = core::ptr::null_mut();
2874 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
2878 result_ok: o.result_ok,
2882 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
2883 fn clone(&self) -> Self {
2885 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2886 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
2889 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2890 err: core::ptr::null_mut()
2896 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
2897 /// but with all dynamically-allocated buffers duplicated in new buffers.
2898 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
2900 /// The contents of CResult_InMemorySignerDecodeErrorZ
2901 pub union CResult_InMemorySignerDecodeErrorZPtr {
2902 /// A pointer to the contents in the success state.
2903 /// Reading from this pointer when `result_ok` is not set is undefined.
2904 pub result: *mut crate::lightning::sign::InMemorySigner,
2905 /// A pointer to the contents in the error state.
2906 /// Reading from this pointer when `result_ok` is set is undefined.
2907 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2910 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
2911 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2913 pub struct CResult_InMemorySignerDecodeErrorZ {
2914 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
2915 /// `err` or `result` depending on the state of `result_ok`.
2916 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
2917 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
2918 pub result_ok: bool,
2921 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
2922 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
2923 CResult_InMemorySignerDecodeErrorZ {
2924 contents: CResult_InMemorySignerDecodeErrorZPtr {
2925 result: Box::into_raw(Box::new(o)),
2931 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
2932 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
2933 CResult_InMemorySignerDecodeErrorZ {
2934 contents: CResult_InMemorySignerDecodeErrorZPtr {
2935 err: Box::into_raw(Box::new(e)),
2940 /// Checks if the given object is currently in the success state
2942 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
2946 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
2947 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
2948 impl Drop for CResult_InMemorySignerDecodeErrorZ {
2949 fn drop(&mut self) {
2951 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2952 let _ = unsafe { Box::from_raw(self.contents.result) };
2955 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2956 let _ = unsafe { Box::from_raw(self.contents.err) };
2961 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
2962 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2963 let contents = if o.result_ok {
2964 let result = unsafe { o.contents.result };
2965 unsafe { o.contents.result = core::ptr::null_mut() };
2966 CResult_InMemorySignerDecodeErrorZPtr { result }
2968 let err = unsafe { o.contents.err };
2969 unsafe { o.contents.err = core::ptr::null_mut(); }
2970 CResult_InMemorySignerDecodeErrorZPtr { err }
2974 result_ok: o.result_ok,
2978 impl Clone for CResult_InMemorySignerDecodeErrorZ {
2979 fn clone(&self) -> Self {
2981 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
2982 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
2985 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
2986 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2992 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
2993 /// but with all dynamically-allocated buffers duplicated in new buffers.
2994 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
2996 /// The contents of CResult_TransactionNoneZ
2997 pub union CResult_TransactionNoneZPtr {
2998 /// A pointer to the contents in the success state.
2999 /// Reading from this pointer when `result_ok` is not set is undefined.
3000 pub result: *mut crate::c_types::Transaction,
3001 /// Note that this value is always NULL, as there are no contents in the Err variant
3002 pub err: *mut core::ffi::c_void,
3005 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3006 /// containing a crate::c_types::Transaction on success and a () on failure.
3007 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3008 pub struct CResult_TransactionNoneZ {
3009 /// The contents of this CResult_TransactionNoneZ, accessible via either
3010 /// `err` or `result` depending on the state of `result_ok`.
3011 pub contents: CResult_TransactionNoneZPtr,
3012 /// Whether this CResult_TransactionNoneZ represents a success state.
3013 pub result_ok: bool,
3016 /// Creates a new CResult_TransactionNoneZ in the success state.
3017 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3018 CResult_TransactionNoneZ {
3019 contents: CResult_TransactionNoneZPtr {
3020 result: Box::into_raw(Box::new(o)),
3026 /// Creates a new CResult_TransactionNoneZ in the error state.
3027 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3028 CResult_TransactionNoneZ {
3029 contents: CResult_TransactionNoneZPtr {
3030 err: core::ptr::null_mut(),
3035 /// Checks if the given object is currently in the success state
3037 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
3041 /// Frees any resources used by the CResult_TransactionNoneZ.
3042 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3043 impl Drop for CResult_TransactionNoneZ {
3044 fn drop(&mut self) {
3046 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3047 let _ = unsafe { Box::from_raw(self.contents.result) };
3053 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3054 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3055 let contents = if o.result_ok {
3056 let result = unsafe { o.contents.result };
3057 unsafe { o.contents.result = core::ptr::null_mut() };
3058 CResult_TransactionNoneZPtr { result }
3060 let _ = unsafe { Box::from_raw(o.contents.err) };
3061 o.contents.err = core::ptr::null_mut();
3062 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
3066 result_ok: o.result_ok,
3070 impl Clone for CResult_TransactionNoneZ {
3071 fn clone(&self) -> Self {
3073 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
3074 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
3077 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
3078 err: core::ptr::null_mut()
3084 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
3085 /// but with all dynamically-allocated buffers duplicated in new buffers.
3086 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
3088 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
3089 pub enum COption_WriteableScoreZ {
3090 /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
3091 Some(crate::lightning::routing::scoring::WriteableScore),
3092 /// When we're in this state, this COption_WriteableScoreZ contains nothing
3095 impl COption_WriteableScoreZ {
3096 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3097 if let Self::None = self { false } else { true }
3099 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3102 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
3103 if let Self::Some(v) = self { v } else { unreachable!() }
3107 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
3108 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
3109 COption_WriteableScoreZ::Some(o)
3112 /// Constructs a new COption_WriteableScoreZ containing nothing
3113 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
3114 COption_WriteableScoreZ::None
3117 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
3118 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
3120 /// The contents of CResult_NoneIOErrorZ
3121 pub union CResult_NoneIOErrorZPtr {
3122 /// Note that this value is always NULL, as there are no contents in the OK variant
3123 pub result: *mut core::ffi::c_void,
3124 /// A pointer to the contents in the error state.
3125 /// Reading from this pointer when `result_ok` is set is undefined.
3126 pub err: *mut crate::c_types::IOError,
3129 /// A CResult_NoneIOErrorZ represents the result of a fallible operation,
3130 /// containing a () on success and a crate::c_types::IOError on failure.
3131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3132 pub struct CResult_NoneIOErrorZ {
3133 /// The contents of this CResult_NoneIOErrorZ, accessible via either
3134 /// `err` or `result` depending on the state of `result_ok`.
3135 pub contents: CResult_NoneIOErrorZPtr,
3136 /// Whether this CResult_NoneIOErrorZ represents a success state.
3137 pub result_ok: bool,
3140 /// Creates a new CResult_NoneIOErrorZ in the success state.
3141 pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ {
3142 CResult_NoneIOErrorZ {
3143 contents: CResult_NoneIOErrorZPtr {
3144 result: core::ptr::null_mut(),
3150 /// Creates a new CResult_NoneIOErrorZ in the error state.
3151 pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ {
3152 CResult_NoneIOErrorZ {
3153 contents: CResult_NoneIOErrorZPtr {
3154 err: Box::into_raw(Box::new(e)),
3159 /// Checks if the given object is currently in the success state
3161 pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool {
3165 /// Frees any resources used by the CResult_NoneIOErrorZ.
3166 pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { }
3167 impl Drop for CResult_NoneIOErrorZ {
3168 fn drop(&mut self) {
3171 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3172 let _ = unsafe { Box::from_raw(self.contents.err) };
3177 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneIOErrorZ {
3178 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
3179 let contents = if o.result_ok {
3180 let _ = unsafe { Box::from_raw(o.contents.result) };
3181 o.contents.result = core::ptr::null_mut();
3182 CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() }
3184 let err = unsafe { o.contents.err };
3185 unsafe { o.contents.err = core::ptr::null_mut(); }
3186 CResult_NoneIOErrorZPtr { err }
3190 result_ok: o.result_ok,
3194 impl Clone for CResult_NoneIOErrorZ {
3195 fn clone(&self) -> Self {
3197 Self { result_ok: true, contents: CResult_NoneIOErrorZPtr {
3198 result: core::ptr::null_mut()
3201 Self { result_ok: false, contents: CResult_NoneIOErrorZPtr {
3202 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
3208 /// Creates a new CResult_NoneIOErrorZ which has the same data as `orig`
3209 /// but with all dynamically-allocated buffers duplicated in new buffers.
3210 pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) }
3212 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3213 /// This corresponds to std::vector in C++
3214 pub struct CVec_ChannelDetailsZ {
3215 /// The elements in the array.
3216 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3217 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3218 /// The number of elements pointed to by `data`.
3221 impl CVec_ChannelDetailsZ {
3222 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3223 if self.datalen == 0 { return Vec::new(); }
3224 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3225 self.data = core::ptr::null_mut();
3229 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3230 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3233 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3234 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3235 let datalen = v.len();
3236 let data = Box::into_raw(v.into_boxed_slice());
3237 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3241 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3242 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3243 impl Drop for CVec_ChannelDetailsZ {
3244 fn drop(&mut self) {
3245 if self.datalen == 0 { return; }
3246 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3249 impl Clone for CVec_ChannelDetailsZ {
3250 fn clone(&self) -> Self {
3251 let mut res = Vec::new();
3252 if self.datalen == 0 { return Self::from(res); }
3253 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3258 /// The contents of CResult_RouteLightningErrorZ
3259 pub union CResult_RouteLightningErrorZPtr {
3260 /// A pointer to the contents in the success state.
3261 /// Reading from this pointer when `result_ok` is not set is undefined.
3262 pub result: *mut crate::lightning::routing::router::Route,
3263 /// A pointer to the contents in the error state.
3264 /// Reading from this pointer when `result_ok` is set is undefined.
3265 pub err: *mut crate::lightning::ln::msgs::LightningError,
3268 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3269 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3271 pub struct CResult_RouteLightningErrorZ {
3272 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3273 /// `err` or `result` depending on the state of `result_ok`.
3274 pub contents: CResult_RouteLightningErrorZPtr,
3275 /// Whether this CResult_RouteLightningErrorZ represents a success state.
3276 pub result_ok: bool,
3279 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3280 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3281 CResult_RouteLightningErrorZ {
3282 contents: CResult_RouteLightningErrorZPtr {
3283 result: Box::into_raw(Box::new(o)),
3289 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3290 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3291 CResult_RouteLightningErrorZ {
3292 contents: CResult_RouteLightningErrorZPtr {
3293 err: Box::into_raw(Box::new(e)),
3298 /// Checks if the given object is currently in the success state
3300 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3304 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3305 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3306 impl Drop for CResult_RouteLightningErrorZ {
3307 fn drop(&mut self) {
3309 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3310 let _ = unsafe { Box::from_raw(self.contents.result) };
3313 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3314 let _ = unsafe { Box::from_raw(self.contents.err) };
3319 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3320 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3321 let contents = if o.result_ok {
3322 let result = unsafe { o.contents.result };
3323 unsafe { o.contents.result = core::ptr::null_mut() };
3324 CResult_RouteLightningErrorZPtr { result }
3326 let err = unsafe { o.contents.err };
3327 unsafe { o.contents.err = core::ptr::null_mut(); }
3328 CResult_RouteLightningErrorZPtr { err }
3332 result_ok: o.result_ok,
3336 impl Clone for CResult_RouteLightningErrorZ {
3337 fn clone(&self) -> Self {
3339 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3340 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3343 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3344 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3350 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3351 /// but with all dynamically-allocated buffers duplicated in new buffers.
3352 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3354 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
3355 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
3356 /// A pointer to the contents in the success state.
3357 /// Reading from this pointer when `result_ok` is not set is undefined.
3358 pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
3359 /// A pointer to the contents in the error state.
3360 /// Reading from this pointer when `result_ok` is set is undefined.
3361 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3364 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
3365 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
3366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3367 pub struct CResult_InFlightHtlcsDecodeErrorZ {
3368 /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
3369 /// `err` or `result` depending on the state of `result_ok`.
3370 pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
3371 /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
3372 pub result_ok: bool,
3375 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
3376 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
3377 CResult_InFlightHtlcsDecodeErrorZ {
3378 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3379 result: Box::into_raw(Box::new(o)),
3385 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
3386 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
3387 CResult_InFlightHtlcsDecodeErrorZ {
3388 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3389 err: Box::into_raw(Box::new(e)),
3394 /// Checks if the given object is currently in the success state
3396 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
3400 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
3401 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
3402 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
3403 fn drop(&mut self) {
3405 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3406 let _ = unsafe { Box::from_raw(self.contents.result) };
3409 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3410 let _ = unsafe { Box::from_raw(self.contents.err) };
3415 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
3416 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
3417 let contents = if o.result_ok {
3418 let result = unsafe { o.contents.result };
3419 unsafe { o.contents.result = core::ptr::null_mut() };
3420 CResult_InFlightHtlcsDecodeErrorZPtr { result }
3422 let err = unsafe { o.contents.err };
3423 unsafe { o.contents.err = core::ptr::null_mut(); }
3424 CResult_InFlightHtlcsDecodeErrorZPtr { err }
3428 result_ok: o.result_ok,
3432 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
3433 fn clone(&self) -> Self {
3435 Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3436 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
3439 Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3440 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3446 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
3447 /// but with all dynamically-allocated buffers duplicated in new buffers.
3448 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
3450 /// The contents of CResult_RouteHopDecodeErrorZ
3451 pub union CResult_RouteHopDecodeErrorZPtr {
3452 /// A pointer to the contents in the success state.
3453 /// Reading from this pointer when `result_ok` is not set is undefined.
3454 pub result: *mut crate::lightning::routing::router::RouteHop,
3455 /// A pointer to the contents in the error state.
3456 /// Reading from this pointer when `result_ok` is set is undefined.
3457 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3460 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
3461 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3463 pub struct CResult_RouteHopDecodeErrorZ {
3464 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
3465 /// `err` or `result` depending on the state of `result_ok`.
3466 pub contents: CResult_RouteHopDecodeErrorZPtr,
3467 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
3468 pub result_ok: bool,
3471 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
3472 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
3473 CResult_RouteHopDecodeErrorZ {
3474 contents: CResult_RouteHopDecodeErrorZPtr {
3475 result: Box::into_raw(Box::new(o)),
3481 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
3482 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
3483 CResult_RouteHopDecodeErrorZ {
3484 contents: CResult_RouteHopDecodeErrorZPtr {
3485 err: Box::into_raw(Box::new(e)),
3490 /// Checks if the given object is currently in the success state
3492 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
3496 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
3497 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
3498 impl Drop for CResult_RouteHopDecodeErrorZ {
3499 fn drop(&mut self) {
3501 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3502 let _ = unsafe { Box::from_raw(self.contents.result) };
3505 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3506 let _ = unsafe { Box::from_raw(self.contents.err) };
3511 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
3512 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3513 let contents = if o.result_ok {
3514 let result = unsafe { o.contents.result };
3515 unsafe { o.contents.result = core::ptr::null_mut() };
3516 CResult_RouteHopDecodeErrorZPtr { result }
3518 let err = unsafe { o.contents.err };
3519 unsafe { o.contents.err = core::ptr::null_mut(); }
3520 CResult_RouteHopDecodeErrorZPtr { err }
3524 result_ok: o.result_ok,
3528 impl Clone for CResult_RouteHopDecodeErrorZ {
3529 fn clone(&self) -> Self {
3531 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
3532 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
3535 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
3536 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3542 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
3543 /// but with all dynamically-allocated buffers duplicated in new buffers.
3544 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
3546 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
3547 /// This corresponds to std::vector in C++
3548 pub struct CVec_BlindedHopZ {
3549 /// The elements in the array.
3550 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3551 pub data: *mut crate::lightning::blinded_path::BlindedHop,
3552 /// The number of elements pointed to by `data`.
3555 impl CVec_BlindedHopZ {
3556 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
3557 if self.datalen == 0 { return Vec::new(); }
3558 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3559 self.data = core::ptr::null_mut();
3563 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
3564 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3567 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
3568 fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
3569 let datalen = v.len();
3570 let data = Box::into_raw(v.into_boxed_slice());
3571 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3575 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3576 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
3577 impl Drop for CVec_BlindedHopZ {
3578 fn drop(&mut self) {
3579 if self.datalen == 0 { return; }
3580 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3583 impl Clone for CVec_BlindedHopZ {
3584 fn clone(&self) -> Self {
3585 let mut res = Vec::new();
3586 if self.datalen == 0 { return Self::from(res); }
3587 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3592 /// The contents of CResult_BlindedTailDecodeErrorZ
3593 pub union CResult_BlindedTailDecodeErrorZPtr {
3594 /// A pointer to the contents in the success state.
3595 /// Reading from this pointer when `result_ok` is not set is undefined.
3596 pub result: *mut crate::lightning::routing::router::BlindedTail,
3597 /// A pointer to the contents in the error state.
3598 /// Reading from this pointer when `result_ok` is set is undefined.
3599 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3602 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
3603 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
3604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3605 pub struct CResult_BlindedTailDecodeErrorZ {
3606 /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
3607 /// `err` or `result` depending on the state of `result_ok`.
3608 pub contents: CResult_BlindedTailDecodeErrorZPtr,
3609 /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
3610 pub result_ok: bool,
3613 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
3614 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
3615 CResult_BlindedTailDecodeErrorZ {
3616 contents: CResult_BlindedTailDecodeErrorZPtr {
3617 result: Box::into_raw(Box::new(o)),
3623 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
3624 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
3625 CResult_BlindedTailDecodeErrorZ {
3626 contents: CResult_BlindedTailDecodeErrorZPtr {
3627 err: Box::into_raw(Box::new(e)),
3632 /// Checks if the given object is currently in the success state
3634 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
3638 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
3639 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
3640 impl Drop for CResult_BlindedTailDecodeErrorZ {
3641 fn drop(&mut self) {
3643 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3644 let _ = unsafe { Box::from_raw(self.contents.result) };
3647 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3648 let _ = unsafe { Box::from_raw(self.contents.err) };
3653 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
3654 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
3655 let contents = if o.result_ok {
3656 let result = unsafe { o.contents.result };
3657 unsafe { o.contents.result = core::ptr::null_mut() };
3658 CResult_BlindedTailDecodeErrorZPtr { result }
3660 let err = unsafe { o.contents.err };
3661 unsafe { o.contents.err = core::ptr::null_mut(); }
3662 CResult_BlindedTailDecodeErrorZPtr { err }
3666 result_ok: o.result_ok,
3670 impl Clone for CResult_BlindedTailDecodeErrorZ {
3671 fn clone(&self) -> Self {
3673 Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
3674 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
3677 Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
3678 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3684 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
3685 /// but with all dynamically-allocated buffers duplicated in new buffers.
3686 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
3688 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3689 /// This corresponds to std::vector in C++
3690 pub struct CVec_RouteHopZ {
3691 /// The elements in the array.
3692 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3693 pub data: *mut crate::lightning::routing::router::RouteHop,
3694 /// The number of elements pointed to by `data`.
3697 impl CVec_RouteHopZ {
3698 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
3699 if self.datalen == 0 { return Vec::new(); }
3700 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3701 self.data = core::ptr::null_mut();
3705 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
3706 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3709 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
3710 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
3711 let datalen = v.len();
3712 let data = Box::into_raw(v.into_boxed_slice());
3713 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3717 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3718 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3719 impl Drop for CVec_RouteHopZ {
3720 fn drop(&mut self) {
3721 if self.datalen == 0 { return; }
3722 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3725 impl Clone for CVec_RouteHopZ {
3726 fn clone(&self) -> Self {
3727 let mut res = Vec::new();
3728 if self.datalen == 0 { return Self::from(res); }
3729 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3734 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
3735 /// This corresponds to std::vector in C++
3736 pub struct CVec_PathZ {
3737 /// The elements in the array.
3738 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3739 pub data: *mut crate::lightning::routing::router::Path,
3740 /// The number of elements pointed to by `data`.
3744 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
3745 if self.datalen == 0 { return Vec::new(); }
3746 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3747 self.data = core::ptr::null_mut();
3751 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
3752 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3755 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
3756 fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
3757 let datalen = v.len();
3758 let data = Box::into_raw(v.into_boxed_slice());
3759 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3763 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3764 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
3765 impl Drop for CVec_PathZ {
3766 fn drop(&mut self) {
3767 if self.datalen == 0 { return; }
3768 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3771 impl Clone for CVec_PathZ {
3772 fn clone(&self) -> Self {
3773 let mut res = Vec::new();
3774 if self.datalen == 0 { return Self::from(res); }
3775 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3780 /// The contents of CResult_RouteDecodeErrorZ
3781 pub union CResult_RouteDecodeErrorZPtr {
3782 /// A pointer to the contents in the success state.
3783 /// Reading from this pointer when `result_ok` is not set is undefined.
3784 pub result: *mut crate::lightning::routing::router::Route,
3785 /// A pointer to the contents in the error state.
3786 /// Reading from this pointer when `result_ok` is set is undefined.
3787 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3790 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3791 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3792 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3793 pub struct CResult_RouteDecodeErrorZ {
3794 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
3795 /// `err` or `result` depending on the state of `result_ok`.
3796 pub contents: CResult_RouteDecodeErrorZPtr,
3797 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
3798 pub result_ok: bool,
3801 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
3802 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3803 CResult_RouteDecodeErrorZ {
3804 contents: CResult_RouteDecodeErrorZPtr {
3805 result: Box::into_raw(Box::new(o)),
3811 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
3812 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3813 CResult_RouteDecodeErrorZ {
3814 contents: CResult_RouteDecodeErrorZPtr {
3815 err: Box::into_raw(Box::new(e)),
3820 /// Checks if the given object is currently in the success state
3822 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
3826 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
3827 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3828 impl Drop for CResult_RouteDecodeErrorZ {
3829 fn drop(&mut self) {
3831 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3832 let _ = unsafe { Box::from_raw(self.contents.result) };
3835 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3836 let _ = unsafe { Box::from_raw(self.contents.err) };
3841 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3842 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
3843 let contents = if o.result_ok {
3844 let result = unsafe { o.contents.result };
3845 unsafe { o.contents.result = core::ptr::null_mut() };
3846 CResult_RouteDecodeErrorZPtr { result }
3848 let err = unsafe { o.contents.err };
3849 unsafe { o.contents.err = core::ptr::null_mut(); }
3850 CResult_RouteDecodeErrorZPtr { err }
3854 result_ok: o.result_ok,
3858 impl Clone for CResult_RouteDecodeErrorZ {
3859 fn clone(&self) -> Self {
3861 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3862 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3865 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3866 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3872 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
3873 /// but with all dynamically-allocated buffers duplicated in new buffers.
3874 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
3876 /// The contents of CResult_RouteParametersDecodeErrorZ
3877 pub union CResult_RouteParametersDecodeErrorZPtr {
3878 /// A pointer to the contents in the success state.
3879 /// Reading from this pointer when `result_ok` is not set is undefined.
3880 pub result: *mut crate::lightning::routing::router::RouteParameters,
3881 /// A pointer to the contents in the error state.
3882 /// Reading from this pointer when `result_ok` is set is undefined.
3883 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3886 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
3887 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3889 pub struct CResult_RouteParametersDecodeErrorZ {
3890 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
3891 /// `err` or `result` depending on the state of `result_ok`.
3892 pub contents: CResult_RouteParametersDecodeErrorZPtr,
3893 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
3894 pub result_ok: bool,
3897 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
3898 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
3899 CResult_RouteParametersDecodeErrorZ {
3900 contents: CResult_RouteParametersDecodeErrorZPtr {
3901 result: Box::into_raw(Box::new(o)),
3907 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
3908 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
3909 CResult_RouteParametersDecodeErrorZ {
3910 contents: CResult_RouteParametersDecodeErrorZPtr {
3911 err: Box::into_raw(Box::new(e)),
3916 /// Checks if the given object is currently in the success state
3918 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
3922 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
3923 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
3924 impl Drop for CResult_RouteParametersDecodeErrorZ {
3925 fn drop(&mut self) {
3927 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3928 let _ = unsafe { Box::from_raw(self.contents.result) };
3931 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3932 let _ = unsafe { Box::from_raw(self.contents.err) };
3937 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
3938 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3939 let contents = if o.result_ok {
3940 let result = unsafe { o.contents.result };
3941 unsafe { o.contents.result = core::ptr::null_mut() };
3942 CResult_RouteParametersDecodeErrorZPtr { result }
3944 let err = unsafe { o.contents.err };
3945 unsafe { o.contents.err = core::ptr::null_mut(); }
3946 CResult_RouteParametersDecodeErrorZPtr { err }
3950 result_ok: o.result_ok,
3954 impl Clone for CResult_RouteParametersDecodeErrorZ {
3955 fn clone(&self) -> Self {
3957 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
3958 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
3961 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
3962 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3968 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
3969 /// but with all dynamically-allocated buffers duplicated in new buffers.
3970 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
3972 /// A dynamically-allocated array of u64s of arbitrary size.
3973 /// This corresponds to std::vector in C++
3974 pub struct CVec_u64Z {
3975 /// The elements in the array.
3976 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3978 /// The number of elements pointed to by `data`.
3982 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
3983 if self.datalen == 0 { return Vec::new(); }
3984 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3985 self.data = core::ptr::null_mut();
3989 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
3990 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3993 impl From<Vec<u64>> for CVec_u64Z {
3994 fn from(v: Vec<u64>) -> Self {
3995 let datalen = v.len();
3996 let data = Box::into_raw(v.into_boxed_slice());
3997 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4001 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4002 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
4003 impl Drop for CVec_u64Z {
4004 fn drop(&mut self) {
4005 if self.datalen == 0 { return; }
4006 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4009 impl Clone for CVec_u64Z {
4010 fn clone(&self) -> Self {
4011 let mut res = Vec::new();
4012 if self.datalen == 0 { return Self::from(res); }
4013 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4018 /// The contents of CResult_PaymentParametersDecodeErrorZ
4019 pub union CResult_PaymentParametersDecodeErrorZPtr {
4020 /// A pointer to the contents in the success state.
4021 /// Reading from this pointer when `result_ok` is not set is undefined.
4022 pub result: *mut crate::lightning::routing::router::PaymentParameters,
4023 /// A pointer to the contents in the error state.
4024 /// Reading from this pointer when `result_ok` is set is undefined.
4025 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4028 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
4029 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4031 pub struct CResult_PaymentParametersDecodeErrorZ {
4032 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
4033 /// `err` or `result` depending on the state of `result_ok`.
4034 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
4035 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
4036 pub result_ok: bool,
4039 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
4040 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
4041 CResult_PaymentParametersDecodeErrorZ {
4042 contents: CResult_PaymentParametersDecodeErrorZPtr {
4043 result: Box::into_raw(Box::new(o)),
4049 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
4050 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
4051 CResult_PaymentParametersDecodeErrorZ {
4052 contents: CResult_PaymentParametersDecodeErrorZPtr {
4053 err: Box::into_raw(Box::new(e)),
4058 /// Checks if the given object is currently in the success state
4060 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
4064 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
4065 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
4066 impl Drop for CResult_PaymentParametersDecodeErrorZ {
4067 fn drop(&mut self) {
4069 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4070 let _ = unsafe { Box::from_raw(self.contents.result) };
4073 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4074 let _ = unsafe { Box::from_raw(self.contents.err) };
4079 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
4080 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4081 let contents = if o.result_ok {
4082 let result = unsafe { o.contents.result };
4083 unsafe { o.contents.result = core::ptr::null_mut() };
4084 CResult_PaymentParametersDecodeErrorZPtr { result }
4086 let err = unsafe { o.contents.err };
4087 unsafe { o.contents.err = core::ptr::null_mut(); }
4088 CResult_PaymentParametersDecodeErrorZPtr { err }
4092 result_ok: o.result_ok,
4096 impl Clone for CResult_PaymentParametersDecodeErrorZ {
4097 fn clone(&self) -> Self {
4099 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
4100 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
4103 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
4104 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4110 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
4111 /// but with all dynamically-allocated buffers duplicated in new buffers.
4112 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
4114 /// A tuple of 2 elements. See the individual fields for the types contained.
4115 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
4116 /// The element at position 0
4117 pub a: crate::lightning::offers::invoice::BlindedPayInfo,
4118 /// The element at position 1
4119 pub b: crate::lightning::blinded_path::BlindedPath,
4121 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
4122 fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
4129 impl C2Tuple_BlindedPayInfoBlindedPathZ {
4130 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
4134 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
4135 fn clone(&self) -> Self {
4137 a: Clone::clone(&self.a),
4138 b: Clone::clone(&self.b),
4143 /// Creates a new tuple which has the same data as `orig`
4144 /// but with all dynamically-allocated buffers duplicated in new buffers.
4145 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
4146 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
4148 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
4149 C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
4153 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
4154 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
4156 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
4157 /// This corresponds to std::vector in C++
4158 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4159 /// The elements in the array.
4160 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4161 pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
4162 /// The number of elements pointed to by `data`.
4165 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4166 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
4167 if self.datalen == 0 { return Vec::new(); }
4168 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4169 self.data = core::ptr::null_mut();
4173 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
4174 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4177 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4178 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
4179 let datalen = v.len();
4180 let data = Box::into_raw(v.into_boxed_slice());
4181 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4185 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4186 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
4187 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4188 fn drop(&mut self) {
4189 if self.datalen == 0 { return; }
4190 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4193 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4194 fn clone(&self) -> Self {
4195 let mut res = Vec::new();
4196 if self.datalen == 0 { return Self::from(res); }
4197 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4202 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
4203 /// This corresponds to std::vector in C++
4204 pub struct CVec_RouteHintZ {
4205 /// The elements in the array.
4206 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4207 pub data: *mut crate::lightning::routing::router::RouteHint,
4208 /// The number of elements pointed to by `data`.
4211 impl CVec_RouteHintZ {
4212 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
4213 if self.datalen == 0 { return Vec::new(); }
4214 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4215 self.data = core::ptr::null_mut();
4219 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
4220 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4223 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
4224 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
4225 let datalen = v.len();
4226 let data = Box::into_raw(v.into_boxed_slice());
4227 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4231 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4232 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
4233 impl Drop for CVec_RouteHintZ {
4234 fn drop(&mut self) {
4235 if self.datalen == 0 { return; }
4236 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4239 impl Clone for CVec_RouteHintZ {
4240 fn clone(&self) -> Self {
4241 let mut res = Vec::new();
4242 if self.datalen == 0 { return Self::from(res); }
4243 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4248 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
4249 /// This corresponds to std::vector in C++
4250 pub struct CVec_RouteHintHopZ {
4251 /// The elements in the array.
4252 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4253 pub data: *mut crate::lightning::routing::router::RouteHintHop,
4254 /// The number of elements pointed to by `data`.
4257 impl CVec_RouteHintHopZ {
4258 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
4259 if self.datalen == 0 { return Vec::new(); }
4260 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4261 self.data = core::ptr::null_mut();
4265 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
4266 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4269 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
4270 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
4271 let datalen = v.len();
4272 let data = Box::into_raw(v.into_boxed_slice());
4273 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4277 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4278 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
4279 impl Drop for CVec_RouteHintHopZ {
4280 fn drop(&mut self) {
4281 if self.datalen == 0 { return; }
4282 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4285 impl Clone for CVec_RouteHintHopZ {
4286 fn clone(&self) -> Self {
4287 let mut res = Vec::new();
4288 if self.datalen == 0 { return Self::from(res); }
4289 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4294 /// The contents of CResult_RouteHintDecodeErrorZ
4295 pub union CResult_RouteHintDecodeErrorZPtr {
4296 /// A pointer to the contents in the success state.
4297 /// Reading from this pointer when `result_ok` is not set is undefined.
4298 pub result: *mut crate::lightning::routing::router::RouteHint,
4299 /// A pointer to the contents in the error state.
4300 /// Reading from this pointer when `result_ok` is set is undefined.
4301 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4304 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
4305 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4306 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4307 pub struct CResult_RouteHintDecodeErrorZ {
4308 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
4309 /// `err` or `result` depending on the state of `result_ok`.
4310 pub contents: CResult_RouteHintDecodeErrorZPtr,
4311 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
4312 pub result_ok: bool,
4315 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
4316 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
4317 CResult_RouteHintDecodeErrorZ {
4318 contents: CResult_RouteHintDecodeErrorZPtr {
4319 result: Box::into_raw(Box::new(o)),
4325 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
4326 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
4327 CResult_RouteHintDecodeErrorZ {
4328 contents: CResult_RouteHintDecodeErrorZPtr {
4329 err: Box::into_raw(Box::new(e)),
4334 /// Checks if the given object is currently in the success state
4336 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
4340 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
4341 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
4342 impl Drop for CResult_RouteHintDecodeErrorZ {
4343 fn drop(&mut self) {
4345 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4346 let _ = unsafe { Box::from_raw(self.contents.result) };
4349 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4350 let _ = unsafe { Box::from_raw(self.contents.err) };
4355 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
4356 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4357 let contents = if o.result_ok {
4358 let result = unsafe { o.contents.result };
4359 unsafe { o.contents.result = core::ptr::null_mut() };
4360 CResult_RouteHintDecodeErrorZPtr { result }
4362 let err = unsafe { o.contents.err };
4363 unsafe { o.contents.err = core::ptr::null_mut(); }
4364 CResult_RouteHintDecodeErrorZPtr { err }
4368 result_ok: o.result_ok,
4372 impl Clone for CResult_RouteHintDecodeErrorZ {
4373 fn clone(&self) -> Self {
4375 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
4376 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
4379 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
4380 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4386 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
4387 /// but with all dynamically-allocated buffers duplicated in new buffers.
4388 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
4390 /// The contents of CResult_RouteHintHopDecodeErrorZ
4391 pub union CResult_RouteHintHopDecodeErrorZPtr {
4392 /// A pointer to the contents in the success state.
4393 /// Reading from this pointer when `result_ok` is not set is undefined.
4394 pub result: *mut crate::lightning::routing::router::RouteHintHop,
4395 /// A pointer to the contents in the error state.
4396 /// Reading from this pointer when `result_ok` is set is undefined.
4397 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4400 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
4401 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4402 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4403 pub struct CResult_RouteHintHopDecodeErrorZ {
4404 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
4405 /// `err` or `result` depending on the state of `result_ok`.
4406 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
4407 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
4408 pub result_ok: bool,
4411 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
4412 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
4413 CResult_RouteHintHopDecodeErrorZ {
4414 contents: CResult_RouteHintHopDecodeErrorZPtr {
4415 result: Box::into_raw(Box::new(o)),
4421 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
4422 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
4423 CResult_RouteHintHopDecodeErrorZ {
4424 contents: CResult_RouteHintHopDecodeErrorZPtr {
4425 err: Box::into_raw(Box::new(e)),
4430 /// Checks if the given object is currently in the success state
4432 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
4436 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
4437 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
4438 impl Drop for CResult_RouteHintHopDecodeErrorZ {
4439 fn drop(&mut self) {
4441 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4442 let _ = unsafe { Box::from_raw(self.contents.result) };
4445 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4446 let _ = unsafe { Box::from_raw(self.contents.err) };
4451 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
4452 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4453 let contents = if o.result_ok {
4454 let result = unsafe { o.contents.result };
4455 unsafe { o.contents.result = core::ptr::null_mut() };
4456 CResult_RouteHintHopDecodeErrorZPtr { result }
4458 let err = unsafe { o.contents.err };
4459 unsafe { o.contents.err = core::ptr::null_mut(); }
4460 CResult_RouteHintHopDecodeErrorZPtr { err }
4464 result_ok: o.result_ok,
4468 impl Clone for CResult_RouteHintHopDecodeErrorZ {
4469 fn clone(&self) -> Self {
4471 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
4472 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
4475 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
4476 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4482 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
4483 /// but with all dynamically-allocated buffers duplicated in new buffers.
4484 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
4486 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4487 /// This corresponds to std::vector in C++
4488 pub struct CVec_PublicKeyZ {
4489 /// The elements in the array.
4490 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4491 pub data: *mut crate::c_types::PublicKey,
4492 /// The number of elements pointed to by `data`.
4495 impl CVec_PublicKeyZ {
4496 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4497 if self.datalen == 0 { return Vec::new(); }
4498 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4499 self.data = core::ptr::null_mut();
4503 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4504 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4507 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4508 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4509 let datalen = v.len();
4510 let data = Box::into_raw(v.into_boxed_slice());
4511 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4515 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4516 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4517 impl Drop for CVec_PublicKeyZ {
4518 fn drop(&mut self) {
4519 if self.datalen == 0 { return; }
4520 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4523 impl Clone for CVec_PublicKeyZ {
4524 fn clone(&self) -> Self {
4525 let mut res = Vec::new();
4526 if self.datalen == 0 { return Self::from(res); }
4527 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4532 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4533 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4534 /// A pointer to the contents in the success state.
4535 /// Reading from this pointer when `result_ok` is not set is undefined.
4536 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4537 /// A pointer to the contents in the error state.
4538 /// Reading from this pointer when `result_ok` is set is undefined.
4539 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4542 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4543 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4544 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4545 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4546 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4547 /// `err` or `result` depending on the state of `result_ok`.
4548 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4549 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4550 pub result_ok: bool,
4553 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4554 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4555 CResult_FixedPenaltyScorerDecodeErrorZ {
4556 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4557 result: Box::into_raw(Box::new(o)),
4563 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4564 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4565 CResult_FixedPenaltyScorerDecodeErrorZ {
4566 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4567 err: Box::into_raw(Box::new(e)),
4572 /// Checks if the given object is currently in the success state
4574 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4578 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4579 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4580 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4581 fn drop(&mut self) {
4583 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4584 let _ = unsafe { Box::from_raw(self.contents.result) };
4587 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4588 let _ = unsafe { Box::from_raw(self.contents.err) };
4593 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4594 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4595 let contents = if o.result_ok {
4596 let result = unsafe { o.contents.result };
4597 unsafe { o.contents.result = core::ptr::null_mut() };
4598 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4600 let err = unsafe { o.contents.err };
4601 unsafe { o.contents.err = core::ptr::null_mut(); }
4602 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4606 result_ok: o.result_ok,
4610 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4611 fn clone(&self) -> Self {
4613 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4614 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4617 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4618 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4624 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4625 /// but with all dynamically-allocated buffers duplicated in new buffers.
4626 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4628 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4629 /// This corresponds to std::vector in C++
4630 pub struct CVec_NodeIdZ {
4631 /// The elements in the array.
4632 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4633 pub data: *mut crate::lightning::routing::gossip::NodeId,
4634 /// The number of elements pointed to by `data`.
4638 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4639 if self.datalen == 0 { return Vec::new(); }
4640 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4641 self.data = core::ptr::null_mut();
4645 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4646 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4649 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4650 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4651 let datalen = v.len();
4652 let data = Box::into_raw(v.into_boxed_slice());
4653 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4657 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4658 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4659 impl Drop for CVec_NodeIdZ {
4660 fn drop(&mut self) {
4661 if self.datalen == 0 { return; }
4662 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4665 impl Clone for CVec_NodeIdZ {
4666 fn clone(&self) -> Self {
4667 let mut res = Vec::new();
4668 if self.datalen == 0 { return Self::from(res); }
4669 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4674 /// A tuple of 2 elements. See the individual fields for the types contained.
4675 pub struct C2Tuple_u64u64Z {
4676 /// The element at position 0
4678 /// The element at position 1
4681 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4682 fn from (tup: (u64, u64)) -> Self {
4689 impl C2Tuple_u64u64Z {
4690 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4694 impl Clone for C2Tuple_u64u64Z {
4695 fn clone(&self) -> Self {
4697 a: Clone::clone(&self.a),
4698 b: Clone::clone(&self.b),
4703 /// Creates a new tuple which has the same data as `orig`
4704 /// but with all dynamically-allocated buffers duplicated in new buffers.
4705 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4706 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4708 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4709 C2Tuple_u64u64Z { a, b, }
4713 /// Frees any resources used by the C2Tuple_u64u64Z.
4714 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4717 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4718 pub enum COption_C2Tuple_u64u64ZZ {
4719 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4720 Some(crate::c_types::derived::C2Tuple_u64u64Z),
4721 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4724 impl COption_C2Tuple_u64u64ZZ {
4725 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4726 if let Self::None = self { false } else { true }
4728 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4731 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4732 if let Self::Some(v) = self { v } else { unreachable!() }
4736 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4737 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4738 COption_C2Tuple_u64u64ZZ::Some(o)
4741 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4742 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4743 COption_C2Tuple_u64u64ZZ::None
4746 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4747 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4749 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4750 /// but with all dynamically-allocated buffers duplicated in new buffers.
4751 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4753 /// A tuple of 2 elements. See the individual fields for the types contained.
4754 pub struct C2Tuple_Z {
4755 /// The element at position 0
4756 pub a: crate::c_types::ThirtyTwoU16s,
4757 /// The element at position 1
4758 pub b: crate::c_types::ThirtyTwoU16s,
4760 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z {
4761 fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
4769 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
4773 /// Creates a new C2Tuple_Z from the contained elements.
4775 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z {
4780 /// Frees any resources used by the C2Tuple_Z.
4781 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
4783 /// A tuple of 2 elements. See the individual fields for the types contained.
4784 pub struct C2Tuple__u1632_u1632Z {
4785 /// The element at position 0
4786 pub a: crate::c_types::ThirtyTwoU16s,
4787 /// The element at position 1
4788 pub b: crate::c_types::ThirtyTwoU16s,
4790 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z {
4791 fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
4798 impl C2Tuple__u1632_u1632Z {
4799 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
4803 /// Creates a new C2Tuple__u1632_u1632Z from the contained elements.
4805 pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z {
4806 C2Tuple__u1632_u1632Z { a, b, }
4810 /// Frees any resources used by the C2Tuple__u1632_u1632Z.
4811 pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { }
4813 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not
4814 pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
4815 /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z
4816 Some(crate::c_types::derived::C2Tuple__u1632_u1632Z),
4817 /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing
4820 impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
4821 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4822 if let Self::None = self { false } else { true }
4824 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4827 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z {
4828 if let Self::Some(v) = self { v } else { unreachable!() }
4832 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z
4833 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
4834 COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o)
4837 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing
4838 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
4839 COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None
4842 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state
4843 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { }
4846 /// An enum which can either contain a f64 or not
4847 pub enum COption_f64Z {
4848 /// When we're in this state, this COption_f64Z contains a f64
4850 /// When we're in this state, this COption_f64Z contains nothing
4854 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4855 if let Self::None = self { false } else { true }
4857 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4860 #[allow(unused)] pub(crate) fn take(mut self) -> f64 {
4861 if let Self::Some(v) = self { v } else { unreachable!() }
4865 /// Constructs a new COption_f64Z containing a f64
4866 pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z {
4867 COption_f64Z::Some(o)
4870 /// Constructs a new COption_f64Z containing nothing
4871 pub extern "C" fn COption_f64Z_none() -> COption_f64Z {
4875 /// Frees any resources associated with the f64, if we are in the Some state
4876 pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { }
4878 /// Creates a new COption_f64Z which has the same data as `orig`
4879 /// but with all dynamically-allocated buffers duplicated in new buffers.
4880 pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) }
4882 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4883 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4884 /// A pointer to the contents in the success state.
4885 /// Reading from this pointer when `result_ok` is not set is undefined.
4886 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4887 /// A pointer to the contents in the error state.
4888 /// Reading from this pointer when `result_ok` is set is undefined.
4889 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4892 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4893 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4895 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4896 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4897 /// `err` or `result` depending on the state of `result_ok`.
4898 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4899 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4900 pub result_ok: bool,
4903 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4904 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4905 CResult_ProbabilisticScorerDecodeErrorZ {
4906 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4907 result: Box::into_raw(Box::new(o)),
4913 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4914 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4915 CResult_ProbabilisticScorerDecodeErrorZ {
4916 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4917 err: Box::into_raw(Box::new(e)),
4922 /// Checks if the given object is currently in the success state
4924 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4928 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4929 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4930 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4931 fn drop(&mut self) {
4933 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4934 let _ = unsafe { Box::from_raw(self.contents.result) };
4937 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4938 let _ = unsafe { Box::from_raw(self.contents.err) };
4943 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4944 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4945 let contents = if o.result_ok {
4946 let result = unsafe { o.contents.result };
4947 unsafe { o.contents.result = core::ptr::null_mut() };
4948 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4950 let err = unsafe { o.contents.err };
4951 unsafe { o.contents.err = core::ptr::null_mut(); }
4952 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4956 result_ok: o.result_ok,
4961 /// A tuple of 2 elements. See the individual fields for the types contained.
4962 pub struct C2Tuple_usizeTransactionZ {
4963 /// The element at position 0
4965 /// The element at position 1
4966 pub b: crate::c_types::Transaction,
4968 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
4969 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
4976 impl C2Tuple_usizeTransactionZ {
4977 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
4981 impl Clone for C2Tuple_usizeTransactionZ {
4982 fn clone(&self) -> Self {
4984 a: Clone::clone(&self.a),
4985 b: Clone::clone(&self.b),
4990 /// Creates a new tuple which has the same data as `orig`
4991 /// but with all dynamically-allocated buffers duplicated in new buffers.
4992 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
4993 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
4995 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
4996 C2Tuple_usizeTransactionZ { a, b, }
5000 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
5001 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
5003 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5004 /// This corresponds to std::vector in C++
5005 pub struct CVec_C2Tuple_usizeTransactionZZ {
5006 /// The elements in the array.
5007 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5008 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
5009 /// The number of elements pointed to by `data`.
5012 impl CVec_C2Tuple_usizeTransactionZZ {
5013 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
5014 if self.datalen == 0 { return Vec::new(); }
5015 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5016 self.data = core::ptr::null_mut();
5020 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
5021 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5024 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
5025 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
5026 let datalen = v.len();
5027 let data = Box::into_raw(v.into_boxed_slice());
5028 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5032 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5033 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
5034 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
5035 fn drop(&mut self) {
5036 if self.datalen == 0 { return; }
5037 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5040 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
5041 fn clone(&self) -> Self {
5042 let mut res = Vec::new();
5043 if self.datalen == 0 { return Self::from(res); }
5044 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5049 /// A tuple of 2 elements. See the individual fields for the types contained.
5050 pub struct C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5051 /// The element at position 0
5052 pub a: crate::c_types::ThirtyTwoBytes,
5053 /// The element at position 1
5054 pub b: crate::c_types::derived::COption_ThirtyTwoBytesZ,
5056 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5057 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self {
5064 impl C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5065 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ) {
5069 impl Clone for C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5070 fn clone(&self) -> Self {
5072 a: Clone::clone(&self.a),
5073 b: Clone::clone(&self.b),
5078 /// Creates a new tuple which has the same data as `orig`
5079 /// but with all dynamically-allocated buffers duplicated in new buffers.
5080 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) -> C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { Clone::clone(&orig) }
5081 /// Creates a new C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ from the contained elements.
5083 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5084 C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { a, b, }
5088 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ.
5089 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res: C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) { }
5091 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZs of arbitrary size.
5092 /// This corresponds to std::vector in C++
5093 pub struct CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5094 /// The elements in the array.
5095 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5096 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ,
5097 /// The number of elements pointed to by `data`.
5100 impl CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5101 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ> {
5102 if self.datalen == 0 { return Vec::new(); }
5103 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5104 self.data = core::ptr::null_mut();
5108 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ] {
5109 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5112 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ>> for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5113 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ>) -> Self {
5114 let datalen = v.len();
5115 let data = Box::into_raw(v.into_boxed_slice());
5116 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5120 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5121 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ) { }
5122 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5123 fn drop(&mut self) {
5124 if self.datalen == 0 { return; }
5125 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5128 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5129 fn clone(&self) -> Self {
5130 let mut res = Vec::new();
5131 if self.datalen == 0 { return Self::from(res); }
5132 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5137 /// The contents of CResult_ChannelMonitorUpdateStatusNoneZ
5138 pub union CResult_ChannelMonitorUpdateStatusNoneZPtr {
5139 /// A pointer to the contents in the success state.
5140 /// Reading from this pointer when `result_ok` is not set is undefined.
5141 pub result: *mut crate::lightning::chain::ChannelMonitorUpdateStatus,
5142 /// Note that this value is always NULL, as there are no contents in the Err variant
5143 pub err: *mut core::ffi::c_void,
5146 /// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation,
5147 /// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure.
5148 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5149 pub struct CResult_ChannelMonitorUpdateStatusNoneZ {
5150 /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either
5151 /// `err` or `result` depending on the state of `result_ok`.
5152 pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr,
5153 /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state.
5154 pub result_ok: bool,
5157 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state.
5158 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ {
5159 CResult_ChannelMonitorUpdateStatusNoneZ {
5160 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5161 result: Box::into_raw(Box::new(o)),
5167 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state.
5168 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ {
5169 CResult_ChannelMonitorUpdateStatusNoneZ {
5170 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5171 err: core::ptr::null_mut(),
5176 /// Checks if the given object is currently in the success state
5178 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool {
5182 /// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ.
5183 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { }
5184 impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ {
5185 fn drop(&mut self) {
5187 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5188 let _ = unsafe { Box::from_raw(self.contents.result) };
5194 impl From<crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>> for CResult_ChannelMonitorUpdateStatusNoneZ {
5195 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>) -> Self {
5196 let contents = if o.result_ok {
5197 let result = unsafe { o.contents.result };
5198 unsafe { o.contents.result = core::ptr::null_mut() };
5199 CResult_ChannelMonitorUpdateStatusNoneZPtr { result }
5201 let _ = unsafe { Box::from_raw(o.contents.err) };
5202 o.contents.err = core::ptr::null_mut();
5203 CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() }
5207 result_ok: o.result_ok,
5211 impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ {
5212 fn clone(&self) -> Self {
5214 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5215 result: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateStatus>::clone(unsafe { &*self.contents.result })))
5218 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5219 err: core::ptr::null_mut()
5225 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig`
5226 /// but with all dynamically-allocated buffers duplicated in new buffers.
5227 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) }
5229 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
5230 /// This corresponds to std::vector in C++
5231 pub struct CVec_MonitorEventZ {
5232 /// The elements in the array.
5233 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5234 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
5235 /// The number of elements pointed to by `data`.
5238 impl CVec_MonitorEventZ {
5239 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
5240 if self.datalen == 0 { return Vec::new(); }
5241 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5242 self.data = core::ptr::null_mut();
5246 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
5247 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5250 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
5251 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
5252 let datalen = v.len();
5253 let data = Box::into_raw(v.into_boxed_slice());
5254 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5258 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5259 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
5260 impl Drop for CVec_MonitorEventZ {
5261 fn drop(&mut self) {
5262 if self.datalen == 0 { return; }
5263 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5266 impl Clone for CVec_MonitorEventZ {
5267 fn clone(&self) -> Self {
5268 let mut res = Vec::new();
5269 if self.datalen == 0 { return Self::from(res); }
5270 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5275 /// A tuple of 3 elements. See the individual fields for the types contained.
5276 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5277 /// The element at position 0
5278 pub a: crate::lightning::chain::transaction::OutPoint,
5279 /// The element at position 1
5280 pub b: crate::c_types::derived::CVec_MonitorEventZ,
5281 /// The element at position 2
5282 pub c: crate::c_types::PublicKey,
5284 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5285 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
5293 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5294 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
5295 (self.a, self.b, self.c)
5298 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5299 fn clone(&self) -> Self {
5301 a: Clone::clone(&self.a),
5302 b: Clone::clone(&self.b),
5303 c: Clone::clone(&self.c),
5308 /// Creates a new tuple which has the same data as `orig`
5309 /// but with all dynamically-allocated buffers duplicated in new buffers.
5310 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
5311 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
5313 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 {
5314 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
5318 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
5319 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
5321 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
5322 /// This corresponds to std::vector in C++
5323 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5324 /// The elements in the array.
5325 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5326 pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
5327 /// The number of elements pointed to by `data`.
5330 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5331 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
5332 if self.datalen == 0 { return Vec::new(); }
5333 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5334 self.data = core::ptr::null_mut();
5338 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
5339 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5342 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5343 fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
5344 let datalen = v.len();
5345 let data = Box::into_raw(v.into_boxed_slice());
5346 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5350 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5351 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
5352 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5353 fn drop(&mut self) {
5354 if self.datalen == 0 { return; }
5355 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5358 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5359 fn clone(&self) -> Self {
5360 let mut res = Vec::new();
5361 if self.datalen == 0 { return Self::from(res); }
5362 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5367 /// The contents of CResult_InitFeaturesDecodeErrorZ
5368 pub union CResult_InitFeaturesDecodeErrorZPtr {
5369 /// A pointer to the contents in the success state.
5370 /// Reading from this pointer when `result_ok` is not set is undefined.
5371 pub result: *mut crate::lightning::ln::features::InitFeatures,
5372 /// A pointer to the contents in the error state.
5373 /// Reading from this pointer when `result_ok` is set is undefined.
5374 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5377 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5378 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5380 pub struct CResult_InitFeaturesDecodeErrorZ {
5381 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5382 /// `err` or `result` depending on the state of `result_ok`.
5383 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
5384 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5385 pub result_ok: bool,
5388 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
5389 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
5390 CResult_InitFeaturesDecodeErrorZ {
5391 contents: CResult_InitFeaturesDecodeErrorZPtr {
5392 result: Box::into_raw(Box::new(o)),
5398 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5399 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5400 CResult_InitFeaturesDecodeErrorZ {
5401 contents: CResult_InitFeaturesDecodeErrorZPtr {
5402 err: Box::into_raw(Box::new(e)),
5407 /// Checks if the given object is currently in the success state
5409 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
5413 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5414 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5415 impl Drop for CResult_InitFeaturesDecodeErrorZ {
5416 fn drop(&mut self) {
5418 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5419 let _ = unsafe { Box::from_raw(self.contents.result) };
5422 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5423 let _ = unsafe { Box::from_raw(self.contents.err) };
5428 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5429 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5430 let contents = if o.result_ok {
5431 let result = unsafe { o.contents.result };
5432 unsafe { o.contents.result = core::ptr::null_mut() };
5433 CResult_InitFeaturesDecodeErrorZPtr { result }
5435 let err = unsafe { o.contents.err };
5436 unsafe { o.contents.err = core::ptr::null_mut(); }
5437 CResult_InitFeaturesDecodeErrorZPtr { err }
5441 result_ok: o.result_ok,
5445 impl Clone for CResult_InitFeaturesDecodeErrorZ {
5446 fn clone(&self) -> Self {
5448 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
5449 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
5452 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
5453 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5459 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
5460 /// but with all dynamically-allocated buffers duplicated in new buffers.
5461 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
5463 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5464 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
5465 /// A pointer to the contents in the success state.
5466 /// Reading from this pointer when `result_ok` is not set is undefined.
5467 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
5468 /// A pointer to the contents in the error state.
5469 /// Reading from this pointer when `result_ok` is set is undefined.
5470 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5473 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5474 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5475 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5476 pub struct CResult_ChannelFeaturesDecodeErrorZ {
5477 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5478 /// `err` or `result` depending on the state of `result_ok`.
5479 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5480 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5481 pub result_ok: bool,
5484 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5485 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5486 CResult_ChannelFeaturesDecodeErrorZ {
5487 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5488 result: Box::into_raw(Box::new(o)),
5494 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5495 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5496 CResult_ChannelFeaturesDecodeErrorZ {
5497 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5498 err: Box::into_raw(Box::new(e)),
5503 /// Checks if the given object is currently in the success state
5505 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
5509 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5510 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5511 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
5512 fn drop(&mut self) {
5514 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5515 let _ = unsafe { Box::from_raw(self.contents.result) };
5518 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5519 let _ = unsafe { Box::from_raw(self.contents.err) };
5524 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5525 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5526 let contents = if o.result_ok {
5527 let result = unsafe { o.contents.result };
5528 unsafe { o.contents.result = core::ptr::null_mut() };
5529 CResult_ChannelFeaturesDecodeErrorZPtr { result }
5531 let err = unsafe { o.contents.err };
5532 unsafe { o.contents.err = core::ptr::null_mut(); }
5533 CResult_ChannelFeaturesDecodeErrorZPtr { err }
5537 result_ok: o.result_ok,
5541 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
5542 fn clone(&self) -> Self {
5544 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5545 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
5548 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5549 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5555 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
5556 /// but with all dynamically-allocated buffers duplicated in new buffers.
5557 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
5559 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5560 pub union CResult_NodeFeaturesDecodeErrorZPtr {
5561 /// A pointer to the contents in the success state.
5562 /// Reading from this pointer when `result_ok` is not set is undefined.
5563 pub result: *mut crate::lightning::ln::features::NodeFeatures,
5564 /// A pointer to the contents in the error state.
5565 /// Reading from this pointer when `result_ok` is set is undefined.
5566 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5569 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5570 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5571 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5572 pub struct CResult_NodeFeaturesDecodeErrorZ {
5573 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5574 /// `err` or `result` depending on the state of `result_ok`.
5575 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
5576 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5577 pub result_ok: bool,
5580 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5581 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5582 CResult_NodeFeaturesDecodeErrorZ {
5583 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5584 result: Box::into_raw(Box::new(o)),
5590 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5591 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5592 CResult_NodeFeaturesDecodeErrorZ {
5593 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5594 err: Box::into_raw(Box::new(e)),
5599 /// Checks if the given object is currently in the success state
5601 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
5605 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5606 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5607 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
5608 fn drop(&mut self) {
5610 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5611 let _ = unsafe { Box::from_raw(self.contents.result) };
5614 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5615 let _ = unsafe { Box::from_raw(self.contents.err) };
5620 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5621 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> 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_NodeFeaturesDecodeErrorZPtr { result }
5627 let err = unsafe { o.contents.err };
5628 unsafe { o.contents.err = core::ptr::null_mut(); }
5629 CResult_NodeFeaturesDecodeErrorZPtr { err }
5633 result_ok: o.result_ok,
5637 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
5638 fn clone(&self) -> Self {
5640 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5641 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
5644 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5645 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5651 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
5652 /// but with all dynamically-allocated buffers duplicated in new buffers.
5653 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5655 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
5656 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5657 /// A pointer to the contents in the success state.
5658 /// Reading from this pointer when `result_ok` is not set is undefined.
5659 pub result: *mut crate::lightning::ln::features::Bolt11InvoiceFeatures,
5660 /// A pointer to the contents in the error state.
5661 /// Reading from this pointer when `result_ok` is set is undefined.
5662 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5665 /// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5666 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5667 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5668 pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5669 /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
5670 /// `err` or `result` depending on the state of `result_ok`.
5671 pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
5672 /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
5673 pub result_ok: bool,
5676 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
5677 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5678 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5679 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5680 result: Box::into_raw(Box::new(o)),
5686 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
5687 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5688 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5689 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5690 err: Box::into_raw(Box::new(e)),
5695 /// Checks if the given object is currently in the success state
5697 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
5701 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
5702 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
5703 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5704 fn drop(&mut self) {
5706 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5707 let _ = unsafe { Box::from_raw(self.contents.result) };
5710 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5711 let _ = unsafe { Box::from_raw(self.contents.err) };
5716 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5717 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5718 let contents = if o.result_ok {
5719 let result = unsafe { o.contents.result };
5720 unsafe { o.contents.result = core::ptr::null_mut() };
5721 CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
5723 let err = unsafe { o.contents.err };
5724 unsafe { o.contents.err = core::ptr::null_mut(); }
5725 CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
5729 result_ok: o.result_ok,
5733 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5734 fn clone(&self) -> Self {
5736 Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5737 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5740 Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5741 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5747 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5748 /// but with all dynamically-allocated buffers duplicated in new buffers.
5749 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5751 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
5752 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5753 /// A pointer to the contents in the success state.
5754 /// Reading from this pointer when `result_ok` is not set is undefined.
5755 pub result: *mut crate::lightning::ln::features::Bolt12InvoiceFeatures,
5756 /// A pointer to the contents in the error state.
5757 /// Reading from this pointer when `result_ok` is set is undefined.
5758 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5761 /// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5762 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5764 pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5765 /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
5766 /// `err` or `result` depending on the state of `result_ok`.
5767 pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
5768 /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
5769 pub result_ok: bool,
5772 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
5773 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5774 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5775 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5776 result: Box::into_raw(Box::new(o)),
5782 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
5783 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5784 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5785 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5786 err: Box::into_raw(Box::new(e)),
5791 /// Checks if the given object is currently in the success state
5793 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
5797 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
5798 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
5799 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5800 fn drop(&mut self) {
5802 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5803 let _ = unsafe { Box::from_raw(self.contents.result) };
5806 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5807 let _ = unsafe { Box::from_raw(self.contents.err) };
5812 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5813 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5814 let contents = if o.result_ok {
5815 let result = unsafe { o.contents.result };
5816 unsafe { o.contents.result = core::ptr::null_mut() };
5817 CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
5819 let err = unsafe { o.contents.err };
5820 unsafe { o.contents.err = core::ptr::null_mut(); }
5821 CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
5825 result_ok: o.result_ok,
5829 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5830 fn clone(&self) -> Self {
5832 Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5833 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5836 Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5837 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5843 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5844 /// but with all dynamically-allocated buffers duplicated in new buffers.
5845 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5847 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
5848 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
5849 /// A pointer to the contents in the success state.
5850 /// Reading from this pointer when `result_ok` is not set is undefined.
5851 pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
5852 /// A pointer to the contents in the error state.
5853 /// Reading from this pointer when `result_ok` is set is undefined.
5854 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5857 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
5858 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5860 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
5861 /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
5862 /// `err` or `result` depending on the state of `result_ok`.
5863 pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
5864 /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
5865 pub result_ok: bool,
5868 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
5869 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5870 CResult_BlindedHopFeaturesDecodeErrorZ {
5871 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5872 result: Box::into_raw(Box::new(o)),
5878 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
5879 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5880 CResult_BlindedHopFeaturesDecodeErrorZ {
5881 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5882 err: Box::into_raw(Box::new(e)),
5887 /// Checks if the given object is currently in the success state
5889 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
5893 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
5894 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
5895 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
5896 fn drop(&mut self) {
5898 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5899 let _ = unsafe { Box::from_raw(self.contents.result) };
5902 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5903 let _ = unsafe { Box::from_raw(self.contents.err) };
5908 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
5909 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5910 let contents = if o.result_ok {
5911 let result = unsafe { o.contents.result };
5912 unsafe { o.contents.result = core::ptr::null_mut() };
5913 CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
5915 let err = unsafe { o.contents.err };
5916 unsafe { o.contents.err = core::ptr::null_mut(); }
5917 CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
5921 result_ok: o.result_ok,
5925 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
5926 fn clone(&self) -> Self {
5928 Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5929 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
5932 Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5933 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5939 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
5940 /// but with all dynamically-allocated buffers duplicated in new buffers.
5941 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
5943 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
5944 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5945 /// A pointer to the contents in the success state.
5946 /// Reading from this pointer when `result_ok` is not set is undefined.
5947 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
5948 /// A pointer to the contents in the error state.
5949 /// Reading from this pointer when `result_ok` is set is undefined.
5950 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5953 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
5954 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5956 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
5957 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
5958 /// `err` or `result` depending on the state of `result_ok`.
5959 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
5960 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
5961 pub result_ok: bool,
5964 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
5965 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5966 CResult_ChannelTypeFeaturesDecodeErrorZ {
5967 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5968 result: Box::into_raw(Box::new(o)),
5974 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
5975 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5976 CResult_ChannelTypeFeaturesDecodeErrorZ {
5977 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5978 err: Box::into_raw(Box::new(e)),
5983 /// Checks if the given object is currently in the success state
5985 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
5989 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
5990 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
5991 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
5992 fn drop(&mut self) {
5994 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5995 let _ = unsafe { Box::from_raw(self.contents.result) };
5998 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5999 let _ = unsafe { Box::from_raw(self.contents.err) };
6004 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
6005 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6006 let contents = if o.result_ok {
6007 let result = unsafe { o.contents.result };
6008 unsafe { o.contents.result = core::ptr::null_mut() };
6009 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
6011 let err = unsafe { o.contents.err };
6012 unsafe { o.contents.err = core::ptr::null_mut(); }
6013 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
6017 result_ok: o.result_ok,
6021 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
6022 fn clone(&self) -> Self {
6024 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6025 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
6028 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6029 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6035 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
6036 /// but with all dynamically-allocated buffers duplicated in new buffers.
6037 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6039 /// The contents of CResult_OfferBolt12ParseErrorZ
6040 pub union CResult_OfferBolt12ParseErrorZPtr {
6041 /// A pointer to the contents in the success state.
6042 /// Reading from this pointer when `result_ok` is not set is undefined.
6043 pub result: *mut crate::lightning::offers::offer::Offer,
6044 /// A pointer to the contents in the error state.
6045 /// Reading from this pointer when `result_ok` is set is undefined.
6046 pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
6049 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
6050 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
6051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6052 pub struct CResult_OfferBolt12ParseErrorZ {
6053 /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
6054 /// `err` or `result` depending on the state of `result_ok`.
6055 pub contents: CResult_OfferBolt12ParseErrorZPtr,
6056 /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
6057 pub result_ok: bool,
6060 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
6061 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
6062 CResult_OfferBolt12ParseErrorZ {
6063 contents: CResult_OfferBolt12ParseErrorZPtr {
6064 result: Box::into_raw(Box::new(o)),
6070 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
6071 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
6072 CResult_OfferBolt12ParseErrorZ {
6073 contents: CResult_OfferBolt12ParseErrorZPtr {
6074 err: Box::into_raw(Box::new(e)),
6079 /// Checks if the given object is currently in the success state
6081 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
6085 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
6086 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
6087 impl Drop for CResult_OfferBolt12ParseErrorZ {
6088 fn drop(&mut self) {
6090 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6091 let _ = unsafe { Box::from_raw(self.contents.result) };
6094 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6095 let _ = unsafe { Box::from_raw(self.contents.err) };
6100 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
6101 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
6102 let contents = if o.result_ok {
6103 let result = unsafe { o.contents.result };
6104 unsafe { o.contents.result = core::ptr::null_mut() };
6105 CResult_OfferBolt12ParseErrorZPtr { result }
6107 let err = unsafe { o.contents.err };
6108 unsafe { o.contents.err = core::ptr::null_mut(); }
6109 CResult_OfferBolt12ParseErrorZPtr { err }
6113 result_ok: o.result_ok,
6117 impl Clone for CResult_OfferBolt12ParseErrorZ {
6118 fn clone(&self) -> Self {
6120 Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
6121 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
6124 Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
6125 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
6131 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
6132 /// but with all dynamically-allocated buffers duplicated in new buffers.
6133 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
6135 /// The contents of CResult_PublicKeySecp256k1ErrorZ
6136 pub union CResult_PublicKeySecp256k1ErrorZPtr {
6137 /// A pointer to the contents in the success state.
6138 /// Reading from this pointer when `result_ok` is not set is undefined.
6139 pub result: *mut crate::c_types::PublicKey,
6140 /// A pointer to the contents in the error state.
6141 /// Reading from this pointer when `result_ok` is set is undefined.
6142 pub err: *mut crate::c_types::Secp256k1Error,
6145 /// A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation,
6146 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
6147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6148 pub struct CResult_PublicKeySecp256k1ErrorZ {
6149 /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either
6150 /// `err` or `result` depending on the state of `result_ok`.
6151 pub contents: CResult_PublicKeySecp256k1ErrorZPtr,
6152 /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state.
6153 pub result_ok: bool,
6156 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state.
6157 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ {
6158 CResult_PublicKeySecp256k1ErrorZ {
6159 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6160 result: Box::into_raw(Box::new(o)),
6166 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state.
6167 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ {
6168 CResult_PublicKeySecp256k1ErrorZ {
6169 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6170 err: Box::into_raw(Box::new(e)),
6175 /// Checks if the given object is currently in the success state
6177 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool {
6181 /// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ.
6182 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { }
6183 impl Drop for CResult_PublicKeySecp256k1ErrorZ {
6184 fn drop(&mut self) {
6186 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6187 let _ = unsafe { Box::from_raw(self.contents.result) };
6190 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6191 let _ = unsafe { Box::from_raw(self.contents.err) };
6196 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecp256k1ErrorZ {
6197 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
6198 let contents = if o.result_ok {
6199 let result = unsafe { o.contents.result };
6200 unsafe { o.contents.result = core::ptr::null_mut() };
6201 CResult_PublicKeySecp256k1ErrorZPtr { result }
6203 let err = unsafe { o.contents.err };
6204 unsafe { o.contents.err = core::ptr::null_mut(); }
6205 CResult_PublicKeySecp256k1ErrorZPtr { err }
6209 result_ok: o.result_ok,
6213 impl Clone for CResult_PublicKeySecp256k1ErrorZ {
6214 fn clone(&self) -> Self {
6216 Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6217 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
6220 Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6221 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6227 /// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig`
6228 /// but with all dynamically-allocated buffers duplicated in new buffers.
6229 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) }
6231 /// The contents of CResult_NodeIdDecodeErrorZ
6232 pub union CResult_NodeIdDecodeErrorZPtr {
6233 /// A pointer to the contents in the success state.
6234 /// Reading from this pointer when `result_ok` is not set is undefined.
6235 pub result: *mut crate::lightning::routing::gossip::NodeId,
6236 /// A pointer to the contents in the error state.
6237 /// Reading from this pointer when `result_ok` is set is undefined.
6238 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6241 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
6242 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
6243 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6244 pub struct CResult_NodeIdDecodeErrorZ {
6245 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
6246 /// `err` or `result` depending on the state of `result_ok`.
6247 pub contents: CResult_NodeIdDecodeErrorZPtr,
6248 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
6249 pub result_ok: bool,
6252 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
6253 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
6254 CResult_NodeIdDecodeErrorZ {
6255 contents: CResult_NodeIdDecodeErrorZPtr {
6256 result: Box::into_raw(Box::new(o)),
6262 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
6263 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
6264 CResult_NodeIdDecodeErrorZ {
6265 contents: CResult_NodeIdDecodeErrorZPtr {
6266 err: Box::into_raw(Box::new(e)),
6271 /// Checks if the given object is currently in the success state
6273 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
6277 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
6278 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
6279 impl Drop for CResult_NodeIdDecodeErrorZ {
6280 fn drop(&mut self) {
6282 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6283 let _ = unsafe { Box::from_raw(self.contents.result) };
6286 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6287 let _ = unsafe { Box::from_raw(self.contents.err) };
6292 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
6293 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
6294 let contents = if o.result_ok {
6295 let result = unsafe { o.contents.result };
6296 unsafe { o.contents.result = core::ptr::null_mut() };
6297 CResult_NodeIdDecodeErrorZPtr { result }
6299 let err = unsafe { o.contents.err };
6300 unsafe { o.contents.err = core::ptr::null_mut(); }
6301 CResult_NodeIdDecodeErrorZPtr { err }
6305 result_ok: o.result_ok,
6309 impl Clone for CResult_NodeIdDecodeErrorZ {
6310 fn clone(&self) -> Self {
6312 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
6313 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
6316 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
6317 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6323 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
6324 /// but with all dynamically-allocated buffers duplicated in new buffers.
6325 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
6328 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
6329 pub enum COption_NetworkUpdateZ {
6330 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
6331 Some(crate::lightning::routing::gossip::NetworkUpdate),
6332 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
6335 impl COption_NetworkUpdateZ {
6336 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6337 if let Self::None = self { false } else { true }
6339 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6342 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
6343 if let Self::Some(v) = self { v } else { unreachable!() }
6347 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
6348 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
6349 COption_NetworkUpdateZ::Some(o)
6352 /// Constructs a new COption_NetworkUpdateZ containing nothing
6353 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
6354 COption_NetworkUpdateZ::None
6357 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
6358 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
6360 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
6361 /// but with all dynamically-allocated buffers duplicated in new buffers.
6362 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
6364 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6365 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6366 /// A pointer to the contents in the success state.
6367 /// Reading from this pointer when `result_ok` is not set is undefined.
6368 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
6369 /// A pointer to the contents in the error state.
6370 /// Reading from this pointer when `result_ok` is set is undefined.
6371 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6374 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6375 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6376 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6377 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
6378 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6379 /// `err` or `result` depending on the state of `result_ok`.
6380 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
6381 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6382 pub result_ok: bool,
6385 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
6386 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6387 CResult_COption_NetworkUpdateZDecodeErrorZ {
6388 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6389 result: Box::into_raw(Box::new(o)),
6395 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
6396 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6397 CResult_COption_NetworkUpdateZDecodeErrorZ {
6398 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6399 err: Box::into_raw(Box::new(e)),
6404 /// Checks if the given object is currently in the success state
6406 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
6410 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
6411 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
6412 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
6413 fn drop(&mut self) {
6415 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6416 let _ = unsafe { Box::from_raw(self.contents.result) };
6419 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6420 let _ = unsafe { Box::from_raw(self.contents.err) };
6425 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
6426 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6427 let contents = if o.result_ok {
6428 let result = unsafe { o.contents.result };
6429 unsafe { o.contents.result = core::ptr::null_mut() };
6430 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
6432 let err = unsafe { o.contents.err };
6433 unsafe { o.contents.err = core::ptr::null_mut(); }
6434 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
6438 result_ok: o.result_ok,
6442 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
6443 fn clone(&self) -> Self {
6445 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6446 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
6449 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6450 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6456 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
6457 /// but with all dynamically-allocated buffers duplicated in new buffers.
6458 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
6460 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6461 pub enum COption_UtxoLookupZ {
6462 /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6463 Some(crate::lightning::routing::utxo::UtxoLookup),
6464 /// When we're in this state, this COption_UtxoLookupZ contains nothing
6467 impl COption_UtxoLookupZ {
6468 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6469 if let Self::None = self { false } else { true }
6471 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6474 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
6475 if let Self::Some(v) = self { v } else { unreachable!() }
6479 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
6480 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
6481 COption_UtxoLookupZ::Some(o)
6484 /// Constructs a new COption_UtxoLookupZ containing nothing
6485 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
6486 COption_UtxoLookupZ::None
6489 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
6490 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
6492 /// The contents of CResult_NoneLightningErrorZ
6493 pub union CResult_NoneLightningErrorZPtr {
6494 /// Note that this value is always NULL, as there are no contents in the OK variant
6495 pub result: *mut core::ffi::c_void,
6496 /// A pointer to the contents in the error state.
6497 /// Reading from this pointer when `result_ok` is set is undefined.
6498 pub err: *mut crate::lightning::ln::msgs::LightningError,
6501 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6502 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6504 pub struct CResult_NoneLightningErrorZ {
6505 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6506 /// `err` or `result` depending on the state of `result_ok`.
6507 pub contents: CResult_NoneLightningErrorZPtr,
6508 /// Whether this CResult_NoneLightningErrorZ represents a success state.
6509 pub result_ok: bool,
6512 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6513 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6514 CResult_NoneLightningErrorZ {
6515 contents: CResult_NoneLightningErrorZPtr {
6516 result: core::ptr::null_mut(),
6522 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6523 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6524 CResult_NoneLightningErrorZ {
6525 contents: CResult_NoneLightningErrorZPtr {
6526 err: Box::into_raw(Box::new(e)),
6531 /// Checks if the given object is currently in the success state
6533 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
6537 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6538 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6539 impl Drop for CResult_NoneLightningErrorZ {
6540 fn drop(&mut self) {
6543 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6544 let _ = unsafe { Box::from_raw(self.contents.err) };
6549 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6550 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6551 let contents = if o.result_ok {
6552 let _ = unsafe { Box::from_raw(o.contents.result) };
6553 o.contents.result = core::ptr::null_mut();
6554 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
6556 let err = unsafe { o.contents.err };
6557 unsafe { o.contents.err = core::ptr::null_mut(); }
6558 CResult_NoneLightningErrorZPtr { err }
6562 result_ok: o.result_ok,
6566 impl Clone for CResult_NoneLightningErrorZ {
6567 fn clone(&self) -> Self {
6569 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6570 result: core::ptr::null_mut()
6573 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6574 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6580 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6581 /// but with all dynamically-allocated buffers duplicated in new buffers.
6582 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
6584 /// The contents of CResult_boolLightningErrorZ
6585 pub union CResult_boolLightningErrorZPtr {
6586 /// A pointer to the contents in the success state.
6587 /// Reading from this pointer when `result_ok` is not set is undefined.
6588 pub result: *mut bool,
6589 /// A pointer to the contents in the error state.
6590 /// Reading from this pointer when `result_ok` is set is undefined.
6591 pub err: *mut crate::lightning::ln::msgs::LightningError,
6594 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6595 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6596 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6597 pub struct CResult_boolLightningErrorZ {
6598 /// The contents of this CResult_boolLightningErrorZ, accessible via either
6599 /// `err` or `result` depending on the state of `result_ok`.
6600 pub contents: CResult_boolLightningErrorZPtr,
6601 /// Whether this CResult_boolLightningErrorZ represents a success state.
6602 pub result_ok: bool,
6605 /// Creates a new CResult_boolLightningErrorZ in the success state.
6606 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6607 CResult_boolLightningErrorZ {
6608 contents: CResult_boolLightningErrorZPtr {
6609 result: Box::into_raw(Box::new(o)),
6615 /// Creates a new CResult_boolLightningErrorZ in the error state.
6616 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6617 CResult_boolLightningErrorZ {
6618 contents: CResult_boolLightningErrorZPtr {
6619 err: Box::into_raw(Box::new(e)),
6624 /// Checks if the given object is currently in the success state
6626 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
6630 /// Frees any resources used by the CResult_boolLightningErrorZ.
6631 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6632 impl Drop for CResult_boolLightningErrorZ {
6633 fn drop(&mut self) {
6635 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6636 let _ = unsafe { Box::from_raw(self.contents.result) };
6639 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6640 let _ = unsafe { Box::from_raw(self.contents.err) };
6645 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6646 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6647 let contents = if o.result_ok {
6648 let result = unsafe { o.contents.result };
6649 unsafe { o.contents.result = core::ptr::null_mut() };
6650 CResult_boolLightningErrorZPtr { result }
6652 let err = unsafe { o.contents.err };
6653 unsafe { o.contents.err = core::ptr::null_mut(); }
6654 CResult_boolLightningErrorZPtr { err }
6658 result_ok: o.result_ok,
6662 impl Clone for CResult_boolLightningErrorZ {
6663 fn clone(&self) -> Self {
6665 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6666 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6669 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6670 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6676 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6677 /// but with all dynamically-allocated buffers duplicated in new buffers.
6678 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
6680 /// A tuple of 3 elements. See the individual fields for the types contained.
6681 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6682 /// The element at position 0
6683 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6684 /// The element at position 1
6685 pub b: crate::lightning::ln::msgs::ChannelUpdate,
6686 /// The element at position 2
6687 pub c: crate::lightning::ln::msgs::ChannelUpdate,
6689 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6690 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6698 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6699 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6700 (self.a, self.b, self.c)
6703 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6704 fn clone(&self) -> Self {
6706 a: Clone::clone(&self.a),
6707 b: Clone::clone(&self.b),
6708 c: Clone::clone(&self.c),
6713 /// Creates a new tuple which has the same data as `orig`
6714 /// but with all dynamically-allocated buffers duplicated in new buffers.
6715 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
6716 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6718 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 {
6719 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6723 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6724 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6727 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
6728 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6729 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6730 Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
6731 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
6734 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6735 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6736 if let Self::None = self { false } else { true }
6738 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6741 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6742 if let Self::Some(v) = self { v } else { unreachable!() }
6746 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6747 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6748 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
6751 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
6752 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6753 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
6756 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
6757 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6759 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
6760 /// but with all dynamically-allocated buffers duplicated in new buffers.
6761 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
6763 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
6764 /// This corresponds to std::vector in C++
6765 pub struct CVec_MessageSendEventZ {
6766 /// The elements in the array.
6767 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6768 pub data: *mut crate::lightning::events::MessageSendEvent,
6769 /// The number of elements pointed to by `data`.
6772 impl CVec_MessageSendEventZ {
6773 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
6774 if self.datalen == 0 { return Vec::new(); }
6775 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6776 self.data = core::ptr::null_mut();
6780 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
6781 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6784 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
6785 fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
6786 let datalen = v.len();
6787 let data = Box::into_raw(v.into_boxed_slice());
6788 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6792 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6793 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
6794 impl Drop for CVec_MessageSendEventZ {
6795 fn drop(&mut self) {
6796 if self.datalen == 0 { return; }
6797 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6800 impl Clone for CVec_MessageSendEventZ {
6801 fn clone(&self) -> Self {
6802 let mut res = Vec::new();
6803 if self.datalen == 0 { return Self::from(res); }
6804 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6809 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
6810 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
6811 /// A pointer to the contents in the success state.
6812 /// Reading from this pointer when `result_ok` is not set is undefined.
6813 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
6814 /// A pointer to the contents in the error state.
6815 /// Reading from this pointer when `result_ok` is set is undefined.
6816 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6819 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
6820 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6821 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6822 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
6823 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
6824 /// `err` or `result` depending on the state of `result_ok`.
6825 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
6826 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
6827 pub result_ok: bool,
6830 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
6831 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6832 CResult_ChannelUpdateInfoDecodeErrorZ {
6833 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6834 result: Box::into_raw(Box::new(o)),
6840 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
6841 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6842 CResult_ChannelUpdateInfoDecodeErrorZ {
6843 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6844 err: Box::into_raw(Box::new(e)),
6849 /// Checks if the given object is currently in the success state
6851 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
6855 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
6856 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
6857 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
6858 fn drop(&mut self) {
6860 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6861 let _ = unsafe { Box::from_raw(self.contents.result) };
6864 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6865 let _ = unsafe { Box::from_raw(self.contents.err) };
6870 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
6871 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6872 let contents = if o.result_ok {
6873 let result = unsafe { o.contents.result };
6874 unsafe { o.contents.result = core::ptr::null_mut() };
6875 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
6877 let err = unsafe { o.contents.err };
6878 unsafe { o.contents.err = core::ptr::null_mut(); }
6879 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
6883 result_ok: o.result_ok,
6887 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
6888 fn clone(&self) -> Self {
6890 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6891 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
6894 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6895 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6901 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
6902 /// but with all dynamically-allocated buffers duplicated in new buffers.
6903 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
6905 /// The contents of CResult_ChannelInfoDecodeErrorZ
6906 pub union CResult_ChannelInfoDecodeErrorZPtr {
6907 /// A pointer to the contents in the success state.
6908 /// Reading from this pointer when `result_ok` is not set is undefined.
6909 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
6910 /// A pointer to the contents in the error state.
6911 /// Reading from this pointer when `result_ok` is set is undefined.
6912 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6915 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6916 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6917 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6918 pub struct CResult_ChannelInfoDecodeErrorZ {
6919 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6920 /// `err` or `result` depending on the state of `result_ok`.
6921 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
6922 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6923 pub result_ok: bool,
6926 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
6927 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
6928 CResult_ChannelInfoDecodeErrorZ {
6929 contents: CResult_ChannelInfoDecodeErrorZPtr {
6930 result: Box::into_raw(Box::new(o)),
6936 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
6937 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
6938 CResult_ChannelInfoDecodeErrorZ {
6939 contents: CResult_ChannelInfoDecodeErrorZPtr {
6940 err: Box::into_raw(Box::new(e)),
6945 /// Checks if the given object is currently in the success state
6947 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
6951 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
6952 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
6953 impl Drop for CResult_ChannelInfoDecodeErrorZ {
6954 fn drop(&mut self) {
6956 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6957 let _ = unsafe { Box::from_raw(self.contents.result) };
6960 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6961 let _ = unsafe { Box::from_raw(self.contents.err) };
6966 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
6967 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6968 let contents = if o.result_ok {
6969 let result = unsafe { o.contents.result };
6970 unsafe { o.contents.result = core::ptr::null_mut() };
6971 CResult_ChannelInfoDecodeErrorZPtr { result }
6973 let err = unsafe { o.contents.err };
6974 unsafe { o.contents.err = core::ptr::null_mut(); }
6975 CResult_ChannelInfoDecodeErrorZPtr { err }
6979 result_ok: o.result_ok,
6983 impl Clone for CResult_ChannelInfoDecodeErrorZ {
6984 fn clone(&self) -> Self {
6986 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
6987 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
6990 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
6991 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6997 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
6998 /// but with all dynamically-allocated buffers duplicated in new buffers.
6999 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
7001 /// The contents of CResult_RoutingFeesDecodeErrorZ
7002 pub union CResult_RoutingFeesDecodeErrorZPtr {
7003 /// A pointer to the contents in the success state.
7004 /// Reading from this pointer when `result_ok` is not set is undefined.
7005 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
7006 /// A pointer to the contents in the error state.
7007 /// Reading from this pointer when `result_ok` is set is undefined.
7008 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7011 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7012 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7013 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7014 pub struct CResult_RoutingFeesDecodeErrorZ {
7015 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7016 /// `err` or `result` depending on the state of `result_ok`.
7017 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7018 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7019 pub result_ok: bool,
7022 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7023 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7024 CResult_RoutingFeesDecodeErrorZ {
7025 contents: CResult_RoutingFeesDecodeErrorZPtr {
7026 result: Box::into_raw(Box::new(o)),
7032 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7033 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7034 CResult_RoutingFeesDecodeErrorZ {
7035 contents: CResult_RoutingFeesDecodeErrorZPtr {
7036 err: Box::into_raw(Box::new(e)),
7041 /// Checks if the given object is currently in the success state
7043 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
7047 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7048 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7049 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7050 fn drop(&mut self) {
7052 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7053 let _ = unsafe { Box::from_raw(self.contents.result) };
7056 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7057 let _ = unsafe { Box::from_raw(self.contents.err) };
7062 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7063 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7064 let contents = if o.result_ok {
7065 let result = unsafe { o.contents.result };
7066 unsafe { o.contents.result = core::ptr::null_mut() };
7067 CResult_RoutingFeesDecodeErrorZPtr { result }
7069 let err = unsafe { o.contents.err };
7070 unsafe { o.contents.err = core::ptr::null_mut(); }
7071 CResult_RoutingFeesDecodeErrorZPtr { err }
7075 result_ok: o.result_ok,
7079 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7080 fn clone(&self) -> Self {
7082 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7083 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
7086 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7087 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7093 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7094 /// but with all dynamically-allocated buffers duplicated in new buffers.
7095 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
7097 /// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size.
7098 /// This corresponds to std::vector in C++
7099 pub struct CVec_SocketAddressZ {
7100 /// The elements in the array.
7101 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7102 pub data: *mut crate::lightning::ln::msgs::SocketAddress,
7103 /// The number of elements pointed to by `data`.
7106 impl CVec_SocketAddressZ {
7107 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::SocketAddress> {
7108 if self.datalen == 0 { return Vec::new(); }
7109 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7110 self.data = core::ptr::null_mut();
7114 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] {
7115 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7118 impl From<Vec<crate::lightning::ln::msgs::SocketAddress>> for CVec_SocketAddressZ {
7119 fn from(v: Vec<crate::lightning::ln::msgs::SocketAddress>) -> Self {
7120 let datalen = v.len();
7121 let data = Box::into_raw(v.into_boxed_slice());
7122 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7126 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7127 pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { }
7128 impl Drop for CVec_SocketAddressZ {
7129 fn drop(&mut self) {
7130 if self.datalen == 0 { return; }
7131 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7134 impl Clone for CVec_SocketAddressZ {
7135 fn clone(&self) -> Self {
7136 let mut res = Vec::new();
7137 if self.datalen == 0 { return Self::from(res); }
7138 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7143 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7144 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7145 /// A pointer to the contents in the success state.
7146 /// Reading from this pointer when `result_ok` is not set is undefined.
7147 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
7148 /// A pointer to the contents in the error state.
7149 /// Reading from this pointer when `result_ok` is set is undefined.
7150 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7153 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7154 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7156 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
7157 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7158 /// `err` or `result` depending on the state of `result_ok`.
7159 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7160 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7161 pub result_ok: bool,
7164 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7165 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7166 CResult_NodeAnnouncementInfoDecodeErrorZ {
7167 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7168 result: Box::into_raw(Box::new(o)),
7174 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7175 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7176 CResult_NodeAnnouncementInfoDecodeErrorZ {
7177 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7178 err: Box::into_raw(Box::new(e)),
7183 /// Checks if the given object is currently in the success state
7185 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
7189 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7190 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7191 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
7192 fn drop(&mut self) {
7194 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7195 let _ = unsafe { Box::from_raw(self.contents.result) };
7198 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7199 let _ = unsafe { Box::from_raw(self.contents.err) };
7204 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7205 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7206 let contents = if o.result_ok {
7207 let result = unsafe { o.contents.result };
7208 unsafe { o.contents.result = core::ptr::null_mut() };
7209 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
7211 let err = unsafe { o.contents.err };
7212 unsafe { o.contents.err = core::ptr::null_mut(); }
7213 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7217 result_ok: o.result_ok,
7221 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7222 fn clone(&self) -> Self {
7224 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7225 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7228 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7229 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7235 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7236 /// but with all dynamically-allocated buffers duplicated in new buffers.
7237 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
7239 /// The contents of CResult_NodeAliasDecodeErrorZ
7240 pub union CResult_NodeAliasDecodeErrorZPtr {
7241 /// A pointer to the contents in the success state.
7242 /// Reading from this pointer when `result_ok` is not set is undefined.
7243 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
7244 /// A pointer to the contents in the error state.
7245 /// Reading from this pointer when `result_ok` is set is undefined.
7246 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7249 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
7250 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
7251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7252 pub struct CResult_NodeAliasDecodeErrorZ {
7253 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
7254 /// `err` or `result` depending on the state of `result_ok`.
7255 pub contents: CResult_NodeAliasDecodeErrorZPtr,
7256 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
7257 pub result_ok: bool,
7260 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
7261 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
7262 CResult_NodeAliasDecodeErrorZ {
7263 contents: CResult_NodeAliasDecodeErrorZPtr {
7264 result: Box::into_raw(Box::new(o)),
7270 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
7271 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
7272 CResult_NodeAliasDecodeErrorZ {
7273 contents: CResult_NodeAliasDecodeErrorZPtr {
7274 err: Box::into_raw(Box::new(e)),
7279 /// Checks if the given object is currently in the success state
7281 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
7285 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
7286 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
7287 impl Drop for CResult_NodeAliasDecodeErrorZ {
7288 fn drop(&mut self) {
7290 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7291 let _ = unsafe { Box::from_raw(self.contents.result) };
7294 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7295 let _ = unsafe { Box::from_raw(self.contents.err) };
7300 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
7301 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
7302 let contents = if o.result_ok {
7303 let result = unsafe { o.contents.result };
7304 unsafe { o.contents.result = core::ptr::null_mut() };
7305 CResult_NodeAliasDecodeErrorZPtr { result }
7307 let err = unsafe { o.contents.err };
7308 unsafe { o.contents.err = core::ptr::null_mut(); }
7309 CResult_NodeAliasDecodeErrorZPtr { err }
7313 result_ok: o.result_ok,
7317 impl Clone for CResult_NodeAliasDecodeErrorZ {
7318 fn clone(&self) -> Self {
7320 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
7321 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
7324 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
7325 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7331 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
7332 /// but with all dynamically-allocated buffers duplicated in new buffers.
7333 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
7335 /// The contents of CResult_NodeInfoDecodeErrorZ
7336 pub union CResult_NodeInfoDecodeErrorZPtr {
7337 /// A pointer to the contents in the success state.
7338 /// Reading from this pointer when `result_ok` is not set is undefined.
7339 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
7340 /// A pointer to the contents in the error state.
7341 /// Reading from this pointer when `result_ok` is set is undefined.
7342 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7345 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7346 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7348 pub struct CResult_NodeInfoDecodeErrorZ {
7349 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7350 /// `err` or `result` depending on the state of `result_ok`.
7351 pub contents: CResult_NodeInfoDecodeErrorZPtr,
7352 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7353 pub result_ok: bool,
7356 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7357 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7358 CResult_NodeInfoDecodeErrorZ {
7359 contents: CResult_NodeInfoDecodeErrorZPtr {
7360 result: Box::into_raw(Box::new(o)),
7366 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7367 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7368 CResult_NodeInfoDecodeErrorZ {
7369 contents: CResult_NodeInfoDecodeErrorZPtr {
7370 err: Box::into_raw(Box::new(e)),
7375 /// Checks if the given object is currently in the success state
7377 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
7381 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7382 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7383 impl Drop for CResult_NodeInfoDecodeErrorZ {
7384 fn drop(&mut self) {
7386 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7387 let _ = unsafe { Box::from_raw(self.contents.result) };
7390 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7391 let _ = unsafe { Box::from_raw(self.contents.err) };
7396 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7397 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7398 let contents = if o.result_ok {
7399 let result = unsafe { o.contents.result };
7400 unsafe { o.contents.result = core::ptr::null_mut() };
7401 CResult_NodeInfoDecodeErrorZPtr { result }
7403 let err = unsafe { o.contents.err };
7404 unsafe { o.contents.err = core::ptr::null_mut(); }
7405 CResult_NodeInfoDecodeErrorZPtr { err }
7409 result_ok: o.result_ok,
7413 impl Clone for CResult_NodeInfoDecodeErrorZ {
7414 fn clone(&self) -> Self {
7416 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7417 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
7420 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7421 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7427 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7428 /// but with all dynamically-allocated buffers duplicated in new buffers.
7429 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
7431 /// The contents of CResult_NetworkGraphDecodeErrorZ
7432 pub union CResult_NetworkGraphDecodeErrorZPtr {
7433 /// A pointer to the contents in the success state.
7434 /// Reading from this pointer when `result_ok` is not set is undefined.
7435 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
7436 /// A pointer to the contents in the error state.
7437 /// Reading from this pointer when `result_ok` is set is undefined.
7438 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7441 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7442 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7443 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7444 pub struct CResult_NetworkGraphDecodeErrorZ {
7445 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7446 /// `err` or `result` depending on the state of `result_ok`.
7447 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7448 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7449 pub result_ok: bool,
7452 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7453 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7454 CResult_NetworkGraphDecodeErrorZ {
7455 contents: CResult_NetworkGraphDecodeErrorZPtr {
7456 result: Box::into_raw(Box::new(o)),
7462 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7463 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7464 CResult_NetworkGraphDecodeErrorZ {
7465 contents: CResult_NetworkGraphDecodeErrorZPtr {
7466 err: Box::into_raw(Box::new(e)),
7471 /// Checks if the given object is currently in the success state
7473 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
7477 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7478 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7479 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7480 fn drop(&mut self) {
7482 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7483 let _ = unsafe { Box::from_raw(self.contents.result) };
7486 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7487 let _ = unsafe { Box::from_raw(self.contents.err) };
7492 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7493 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7494 let contents = if o.result_ok {
7495 let result = unsafe { o.contents.result };
7496 unsafe { o.contents.result = core::ptr::null_mut() };
7497 CResult_NetworkGraphDecodeErrorZPtr { result }
7499 let err = unsafe { o.contents.err };
7500 unsafe { o.contents.err = core::ptr::null_mut(); }
7501 CResult_NetworkGraphDecodeErrorZPtr { err }
7505 result_ok: o.result_ok,
7511 /// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
7512 pub enum COption_CVec_SocketAddressZZ {
7513 /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ
7514 Some(crate::c_types::derived::CVec_SocketAddressZ),
7515 /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing
7518 impl COption_CVec_SocketAddressZZ {
7519 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7520 if let Self::None = self { false } else { true }
7522 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7525 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_SocketAddressZ {
7526 if let Self::Some(v) = self { v } else { unreachable!() }
7530 /// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
7531 pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ {
7532 COption_CVec_SocketAddressZZ::Some(o)
7535 /// Constructs a new COption_CVec_SocketAddressZZ containing nothing
7536 pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ {
7537 COption_CVec_SocketAddressZZ::None
7540 /// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state
7541 pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { }
7543 /// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig`
7544 /// but with all dynamically-allocated buffers duplicated in new buffers.
7545 pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) }
7547 /// The contents of CResult_ChannelDerivationParametersDecodeErrorZ
7548 pub union CResult_ChannelDerivationParametersDecodeErrorZPtr {
7549 /// A pointer to the contents in the success state.
7550 /// Reading from this pointer when `result_ok` is not set is undefined.
7551 pub result: *mut crate::lightning::events::bump_transaction::ChannelDerivationParameters,
7552 /// A pointer to the contents in the error state.
7553 /// Reading from this pointer when `result_ok` is set is undefined.
7554 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7557 /// A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
7558 /// containing a crate::lightning::events::bump_transaction::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
7559 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7560 pub struct CResult_ChannelDerivationParametersDecodeErrorZ {
7561 /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
7562 /// `err` or `result` depending on the state of `result_ok`.
7563 pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr,
7564 /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
7565 pub result_ok: bool,
7568 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
7569 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::events::bump_transaction::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ {
7570 CResult_ChannelDerivationParametersDecodeErrorZ {
7571 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
7572 result: Box::into_raw(Box::new(o)),
7578 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
7579 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ {
7580 CResult_ChannelDerivationParametersDecodeErrorZ {
7581 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
7582 err: Box::into_raw(Box::new(e)),
7587 /// Checks if the given object is currently in the success state
7589 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool {
7593 /// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
7594 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { }
7595 impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ {
7596 fn drop(&mut self) {
7598 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7599 let _ = unsafe { Box::from_raw(self.contents.result) };
7602 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7603 let _ = unsafe { Box::from_raw(self.contents.err) };
7608 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDerivationParametersDecodeErrorZ {
7609 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
7610 let contents = if o.result_ok {
7611 let result = unsafe { o.contents.result };
7612 unsafe { o.contents.result = core::ptr::null_mut() };
7613 CResult_ChannelDerivationParametersDecodeErrorZPtr { result }
7615 let err = unsafe { o.contents.err };
7616 unsafe { o.contents.err = core::ptr::null_mut(); }
7617 CResult_ChannelDerivationParametersDecodeErrorZPtr { err }
7621 result_ok: o.result_ok,
7625 impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ {
7626 fn clone(&self) -> Self {
7628 Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
7629 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::ChannelDerivationParameters>::clone(unsafe { &*self.contents.result })))
7632 Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
7633 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7639 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
7640 /// but with all dynamically-allocated buffers duplicated in new buffers.
7641 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) }
7643 /// The contents of CResult_HTLCDescriptorDecodeErrorZ
7644 pub union CResult_HTLCDescriptorDecodeErrorZPtr {
7645 /// A pointer to the contents in the success state.
7646 /// Reading from this pointer when `result_ok` is not set is undefined.
7647 pub result: *mut crate::lightning::events::bump_transaction::HTLCDescriptor,
7648 /// A pointer to the contents in the error state.
7649 /// Reading from this pointer when `result_ok` is set is undefined.
7650 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7653 /// A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
7654 /// containing a crate::lightning::events::bump_transaction::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7655 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7656 pub struct CResult_HTLCDescriptorDecodeErrorZ {
7657 /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
7658 /// `err` or `result` depending on the state of `result_ok`.
7659 pub contents: CResult_HTLCDescriptorDecodeErrorZPtr,
7660 /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
7661 pub result_ok: bool,
7664 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
7665 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::events::bump_transaction::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ {
7666 CResult_HTLCDescriptorDecodeErrorZ {
7667 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
7668 result: Box::into_raw(Box::new(o)),
7674 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
7675 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ {
7676 CResult_HTLCDescriptorDecodeErrorZ {
7677 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
7678 err: Box::into_raw(Box::new(e)),
7683 /// Checks if the given object is currently in the success state
7685 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool {
7689 /// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
7690 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { }
7691 impl Drop for CResult_HTLCDescriptorDecodeErrorZ {
7692 fn drop(&mut self) {
7694 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7695 let _ = unsafe { Box::from_raw(self.contents.result) };
7698 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7699 let _ = unsafe { Box::from_raw(self.contents.err) };
7704 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCDescriptorDecodeErrorZ {
7705 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7706 let contents = if o.result_ok {
7707 let result = unsafe { o.contents.result };
7708 unsafe { o.contents.result = core::ptr::null_mut() };
7709 CResult_HTLCDescriptorDecodeErrorZPtr { result }
7711 let err = unsafe { o.contents.err };
7712 unsafe { o.contents.err = core::ptr::null_mut(); }
7713 CResult_HTLCDescriptorDecodeErrorZPtr { err }
7717 result_ok: o.result_ok,
7721 impl Clone for CResult_HTLCDescriptorDecodeErrorZ {
7722 fn clone(&self) -> Self {
7724 Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
7725 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::HTLCDescriptor>::clone(unsafe { &*self.contents.result })))
7728 Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
7729 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7735 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
7736 /// but with all dynamically-allocated buffers duplicated in new buffers.
7737 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) }
7739 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
7740 /// This corresponds to std::vector in C++
7741 pub struct CVec_HTLCOutputInCommitmentZ {
7742 /// The elements in the array.
7743 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7744 pub data: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
7745 /// The number of elements pointed to by `data`.
7748 impl CVec_HTLCOutputInCommitmentZ {
7749 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment> {
7750 if self.datalen == 0 { return Vec::new(); }
7751 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7752 self.data = core::ptr::null_mut();
7756 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::HTLCOutputInCommitment] {
7757 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7760 impl From<Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>> for CVec_HTLCOutputInCommitmentZ {
7761 fn from(v: Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>) -> Self {
7762 let datalen = v.len();
7763 let data = Box::into_raw(v.into_boxed_slice());
7764 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7768 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7769 pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { }
7770 impl Drop for CVec_HTLCOutputInCommitmentZ {
7771 fn drop(&mut self) {
7772 if self.datalen == 0 { return; }
7773 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7776 impl Clone for CVec_HTLCOutputInCommitmentZ {
7777 fn clone(&self) -> Self {
7778 let mut res = Vec::new();
7779 if self.datalen == 0 { return Self::from(res); }
7780 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7785 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::HTLCDescriptors of arbitrary size.
7786 /// This corresponds to std::vector in C++
7787 pub struct CVec_HTLCDescriptorZ {
7788 /// The elements in the array.
7789 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7790 pub data: *mut crate::lightning::events::bump_transaction::HTLCDescriptor,
7791 /// The number of elements pointed to by `data`.
7794 impl CVec_HTLCDescriptorZ {
7795 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::HTLCDescriptor> {
7796 if self.datalen == 0 { return Vec::new(); }
7797 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7798 self.data = core::ptr::null_mut();
7802 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::HTLCDescriptor] {
7803 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7806 impl From<Vec<crate::lightning::events::bump_transaction::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
7807 fn from(v: Vec<crate::lightning::events::bump_transaction::HTLCDescriptor>) -> Self {
7808 let datalen = v.len();
7809 let data = Box::into_raw(v.into_boxed_slice());
7810 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7814 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7815 pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { }
7816 impl Drop for CVec_HTLCDescriptorZ {
7817 fn drop(&mut self) {
7818 if self.datalen == 0 { return; }
7819 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7822 impl Clone for CVec_HTLCDescriptorZ {
7823 fn clone(&self) -> Self {
7824 let mut res = Vec::new();
7825 if self.datalen == 0 { return Self::from(res); }
7826 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7831 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
7832 /// This corresponds to std::vector in C++
7833 pub struct CVec_UtxoZ {
7834 /// The elements in the array.
7835 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7836 pub data: *mut crate::lightning::events::bump_transaction::Utxo,
7837 /// The number of elements pointed to by `data`.
7841 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Utxo> {
7842 if self.datalen == 0 { return Vec::new(); }
7843 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7844 self.data = core::ptr::null_mut();
7848 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Utxo] {
7849 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7852 impl From<Vec<crate::lightning::events::bump_transaction::Utxo>> for CVec_UtxoZ {
7853 fn from(v: Vec<crate::lightning::events::bump_transaction::Utxo>) -> Self {
7854 let datalen = v.len();
7855 let data = Box::into_raw(v.into_boxed_slice());
7856 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7860 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7861 pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { }
7862 impl Drop for CVec_UtxoZ {
7863 fn drop(&mut self) {
7864 if self.datalen == 0 { return; }
7865 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7868 impl Clone for CVec_UtxoZ {
7869 fn clone(&self) -> Self {
7870 let mut res = Vec::new();
7871 if self.datalen == 0 { return Self::from(res); }
7872 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7878 /// An enum which can either contain a crate::c_types::TxOut or not
7879 pub enum COption_TxOutZ {
7880 /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
7881 Some(crate::c_types::TxOut),
7882 /// When we're in this state, this COption_TxOutZ contains nothing
7885 impl COption_TxOutZ {
7886 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7887 if let Self::None = self { false } else { true }
7889 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7892 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut {
7893 if let Self::Some(v) = self { v } else { unreachable!() }
7897 /// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
7898 pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ {
7899 COption_TxOutZ::Some(o)
7902 /// Constructs a new COption_TxOutZ containing nothing
7903 pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ {
7904 COption_TxOutZ::None
7907 /// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
7908 pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { }
7910 /// Creates a new COption_TxOutZ which has the same data as `orig`
7911 /// but with all dynamically-allocated buffers duplicated in new buffers.
7912 pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) }
7914 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
7915 /// This corresponds to std::vector in C++
7916 pub struct CVec_InputZ {
7917 /// The elements in the array.
7918 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7919 pub data: *mut crate::lightning::events::bump_transaction::Input,
7920 /// The number of elements pointed to by `data`.
7924 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Input> {
7925 if self.datalen == 0 { return Vec::new(); }
7926 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7927 self.data = core::ptr::null_mut();
7931 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Input] {
7932 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7935 impl From<Vec<crate::lightning::events::bump_transaction::Input>> for CVec_InputZ {
7936 fn from(v: Vec<crate::lightning::events::bump_transaction::Input>) -> Self {
7937 let datalen = v.len();
7938 let data = Box::into_raw(v.into_boxed_slice());
7939 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7943 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7944 pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { }
7945 impl Drop for CVec_InputZ {
7946 fn drop(&mut self) {
7947 if self.datalen == 0 { return; }
7948 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7951 impl Clone for CVec_InputZ {
7952 fn clone(&self) -> Self {
7953 let mut res = Vec::new();
7954 if self.datalen == 0 { return Self::from(res); }
7955 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7960 /// The contents of CResult_CoinSelectionNoneZ
7961 pub union CResult_CoinSelectionNoneZPtr {
7962 /// A pointer to the contents in the success state.
7963 /// Reading from this pointer when `result_ok` is not set is undefined.
7964 pub result: *mut crate::lightning::events::bump_transaction::CoinSelection,
7965 /// Note that this value is always NULL, as there are no contents in the Err variant
7966 pub err: *mut core::ffi::c_void,
7969 /// A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
7970 /// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
7971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7972 pub struct CResult_CoinSelectionNoneZ {
7973 /// The contents of this CResult_CoinSelectionNoneZ, accessible via either
7974 /// `err` or `result` depending on the state of `result_ok`.
7975 pub contents: CResult_CoinSelectionNoneZPtr,
7976 /// Whether this CResult_CoinSelectionNoneZ represents a success state.
7977 pub result_ok: bool,
7980 /// Creates a new CResult_CoinSelectionNoneZ in the success state.
7981 pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ {
7982 CResult_CoinSelectionNoneZ {
7983 contents: CResult_CoinSelectionNoneZPtr {
7984 result: Box::into_raw(Box::new(o)),
7990 /// Creates a new CResult_CoinSelectionNoneZ in the error state.
7991 pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ {
7992 CResult_CoinSelectionNoneZ {
7993 contents: CResult_CoinSelectionNoneZPtr {
7994 err: core::ptr::null_mut(),
7999 /// Checks if the given object is currently in the success state
8001 pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool {
8005 /// Frees any resources used by the CResult_CoinSelectionNoneZ.
8006 pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { }
8007 impl Drop for CResult_CoinSelectionNoneZ {
8008 fn drop(&mut self) {
8010 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8011 let _ = unsafe { Box::from_raw(self.contents.result) };
8017 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>> for CResult_CoinSelectionNoneZ {
8018 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>) -> Self {
8019 let contents = if o.result_ok {
8020 let result = unsafe { o.contents.result };
8021 unsafe { o.contents.result = core::ptr::null_mut() };
8022 CResult_CoinSelectionNoneZPtr { result }
8024 let _ = unsafe { Box::from_raw(o.contents.err) };
8025 o.contents.err = core::ptr::null_mut();
8026 CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() }
8030 result_ok: o.result_ok,
8034 impl Clone for CResult_CoinSelectionNoneZ {
8035 fn clone(&self) -> Self {
8037 Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr {
8038 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::CoinSelection>::clone(unsafe { &*self.contents.result })))
8041 Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr {
8042 err: core::ptr::null_mut()
8048 /// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
8049 /// but with all dynamically-allocated buffers duplicated in new buffers.
8050 pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) }
8052 /// The contents of CResult_CVec_UtxoZNoneZ
8053 pub union CResult_CVec_UtxoZNoneZPtr {
8054 /// A pointer to the contents in the success state.
8055 /// Reading from this pointer when `result_ok` is not set is undefined.
8056 pub result: *mut crate::c_types::derived::CVec_UtxoZ,
8057 /// Note that this value is always NULL, as there are no contents in the Err variant
8058 pub err: *mut core::ffi::c_void,
8061 /// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
8062 /// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
8063 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8064 pub struct CResult_CVec_UtxoZNoneZ {
8065 /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
8066 /// `err` or `result` depending on the state of `result_ok`.
8067 pub contents: CResult_CVec_UtxoZNoneZPtr,
8068 /// Whether this CResult_CVec_UtxoZNoneZ represents a success state.
8069 pub result_ok: bool,
8072 /// Creates a new CResult_CVec_UtxoZNoneZ in the success state.
8073 pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ {
8074 CResult_CVec_UtxoZNoneZ {
8075 contents: CResult_CVec_UtxoZNoneZPtr {
8076 result: Box::into_raw(Box::new(o)),
8082 /// Creates a new CResult_CVec_UtxoZNoneZ in the error state.
8083 pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ {
8084 CResult_CVec_UtxoZNoneZ {
8085 contents: CResult_CVec_UtxoZNoneZPtr {
8086 err: core::ptr::null_mut(),
8091 /// Checks if the given object is currently in the success state
8093 pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool {
8097 /// Frees any resources used by the CResult_CVec_UtxoZNoneZ.
8098 pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { }
8099 impl Drop for CResult_CVec_UtxoZNoneZ {
8100 fn drop(&mut self) {
8102 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8103 let _ = unsafe { Box::from_raw(self.contents.result) };
8109 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>> for CResult_CVec_UtxoZNoneZ {
8110 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>) -> Self {
8111 let contents = if o.result_ok {
8112 let result = unsafe { o.contents.result };
8113 unsafe { o.contents.result = core::ptr::null_mut() };
8114 CResult_CVec_UtxoZNoneZPtr { result }
8116 let _ = unsafe { Box::from_raw(o.contents.err) };
8117 o.contents.err = core::ptr::null_mut();
8118 CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() }
8122 result_ok: o.result_ok,
8126 impl Clone for CResult_CVec_UtxoZNoneZ {
8127 fn clone(&self) -> Self {
8129 Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr {
8130 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_UtxoZ>::clone(unsafe { &*self.contents.result })))
8133 Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr {
8134 err: core::ptr::null_mut()
8140 /// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
8141 /// but with all dynamically-allocated buffers duplicated in new buffers.
8142 pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) }
8144 /// A tuple of 2 elements. See the individual fields for the types contained.
8145 pub struct C2Tuple_u64u16Z {
8146 /// The element at position 0
8148 /// The element at position 1
8151 impl From<(u64, u16)> for C2Tuple_u64u16Z {
8152 fn from (tup: (u64, u16)) -> Self {
8159 impl C2Tuple_u64u16Z {
8160 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u16) {
8164 impl Clone for C2Tuple_u64u16Z {
8165 fn clone(&self) -> Self {
8167 a: Clone::clone(&self.a),
8168 b: Clone::clone(&self.b),
8173 /// Creates a new tuple which has the same data as `orig`
8174 /// but with all dynamically-allocated buffers duplicated in new buffers.
8175 pub extern "C" fn C2Tuple_u64u16Z_clone(orig: &C2Tuple_u64u16Z) -> C2Tuple_u64u16Z { Clone::clone(&orig) }
8176 /// Creates a new C2Tuple_u64u16Z from the contained elements.
8178 pub extern "C" fn C2Tuple_u64u16Z_new(a: u64, b: u16) -> C2Tuple_u64u16Z {
8179 C2Tuple_u64u16Z { a, b, }
8183 /// Frees any resources used by the C2Tuple_u64u16Z.
8184 pub extern "C" fn C2Tuple_u64u16Z_free(_res: C2Tuple_u64u16Z) { }
8187 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not
8188 pub enum COption_C2Tuple_u64u16ZZ {
8189 /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z
8190 Some(crate::c_types::derived::C2Tuple_u64u16Z),
8191 /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing
8194 impl COption_C2Tuple_u64u16ZZ {
8195 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8196 if let Self::None = self { false } else { true }
8198 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8201 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u16Z {
8202 if let Self::Some(v) = self { v } else { unreachable!() }
8206 /// Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z
8207 pub extern "C" fn COption_C2Tuple_u64u16ZZ_some(o: crate::c_types::derived::C2Tuple_u64u16Z) -> COption_C2Tuple_u64u16ZZ {
8208 COption_C2Tuple_u64u16ZZ::Some(o)
8211 /// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing
8212 pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ {
8213 COption_C2Tuple_u64u16ZZ::None
8216 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state
8217 pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) { }
8219 /// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig`
8220 /// but with all dynamically-allocated buffers duplicated in new buffers.
8221 pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) }
8224 /// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
8225 pub enum COption_ChannelShutdownStateZ {
8226 /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
8227 Some(crate::lightning::ln::channelmanager::ChannelShutdownState),
8228 /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
8231 impl COption_ChannelShutdownStateZ {
8232 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8233 if let Self::None = self { false } else { true }
8235 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8238 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channelmanager::ChannelShutdownState {
8239 if let Self::Some(v) = self { v } else { unreachable!() }
8243 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
8244 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
8245 COption_ChannelShutdownStateZ::Some(o)
8248 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
8249 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
8250 COption_ChannelShutdownStateZ::None
8253 /// Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
8254 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
8256 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
8257 /// but with all dynamically-allocated buffers duplicated in new buffers.
8258 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
8260 /// The contents of CResult_ThirtyTwoBytesAPIErrorZ
8261 pub union CResult_ThirtyTwoBytesAPIErrorZPtr {
8262 /// A pointer to the contents in the success state.
8263 /// Reading from this pointer when `result_ok` is not set is undefined.
8264 pub result: *mut crate::c_types::ThirtyTwoBytes,
8265 /// A pointer to the contents in the error state.
8266 /// Reading from this pointer when `result_ok` is set is undefined.
8267 pub err: *mut crate::lightning::util::errors::APIError,
8270 /// A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation,
8271 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8272 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8273 pub struct CResult_ThirtyTwoBytesAPIErrorZ {
8274 /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either
8275 /// `err` or `result` depending on the state of `result_ok`.
8276 pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr,
8277 /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state.
8278 pub result_ok: bool,
8281 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state.
8282 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesAPIErrorZ {
8283 CResult_ThirtyTwoBytesAPIErrorZ {
8284 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8285 result: Box::into_raw(Box::new(o)),
8291 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state.
8292 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ThirtyTwoBytesAPIErrorZ {
8293 CResult_ThirtyTwoBytesAPIErrorZ {
8294 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8295 err: Box::into_raw(Box::new(e)),
8300 /// Checks if the given object is currently in the success state
8302 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool {
8306 /// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ.
8307 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { }
8308 impl Drop for CResult_ThirtyTwoBytesAPIErrorZ {
8309 fn drop(&mut self) {
8311 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8312 let _ = unsafe { Box::from_raw(self.contents.result) };
8315 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8316 let _ = unsafe { Box::from_raw(self.contents.err) };
8321 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_ThirtyTwoBytesAPIErrorZ {
8322 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8323 let contents = if o.result_ok {
8324 let result = unsafe { o.contents.result };
8325 unsafe { o.contents.result = core::ptr::null_mut() };
8326 CResult_ThirtyTwoBytesAPIErrorZPtr { result }
8328 let err = unsafe { o.contents.err };
8329 unsafe { o.contents.err = core::ptr::null_mut(); }
8330 CResult_ThirtyTwoBytesAPIErrorZPtr { err }
8334 result_ok: o.result_ok,
8338 impl Clone for CResult_ThirtyTwoBytesAPIErrorZ {
8339 fn clone(&self) -> Self {
8341 Self { result_ok: true, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8342 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8345 Self { result_ok: false, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
8346 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8352 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig`
8353 /// but with all dynamically-allocated buffers duplicated in new buffers.
8354 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) }
8356 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8357 /// This corresponds to std::vector in C++
8358 pub struct CVec_RecentPaymentDetailsZ {
8359 /// The elements in the array.
8360 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8361 pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
8362 /// The number of elements pointed to by `data`.
8365 impl CVec_RecentPaymentDetailsZ {
8366 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
8367 if self.datalen == 0 { return Vec::new(); }
8368 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8369 self.data = core::ptr::null_mut();
8373 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
8374 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8377 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
8378 fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
8379 let datalen = v.len();
8380 let data = Box::into_raw(v.into_boxed_slice());
8381 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8385 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8386 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
8387 impl Drop for CVec_RecentPaymentDetailsZ {
8388 fn drop(&mut self) {
8389 if self.datalen == 0 { return; }
8390 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8394 /// The contents of CResult_NonePaymentSendFailureZ
8395 pub union CResult_NonePaymentSendFailureZPtr {
8396 /// Note that this value is always NULL, as there are no contents in the OK variant
8397 pub result: *mut core::ffi::c_void,
8398 /// A pointer to the contents in the error state.
8399 /// Reading from this pointer when `result_ok` is set is undefined.
8400 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8403 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8404 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8405 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8406 pub struct CResult_NonePaymentSendFailureZ {
8407 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8408 /// `err` or `result` depending on the state of `result_ok`.
8409 pub contents: CResult_NonePaymentSendFailureZPtr,
8410 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8411 pub result_ok: bool,
8414 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8415 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8416 CResult_NonePaymentSendFailureZ {
8417 contents: CResult_NonePaymentSendFailureZPtr {
8418 result: core::ptr::null_mut(),
8424 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8425 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8426 CResult_NonePaymentSendFailureZ {
8427 contents: CResult_NonePaymentSendFailureZPtr {
8428 err: Box::into_raw(Box::new(e)),
8433 /// Checks if the given object is currently in the success state
8435 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8439 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8440 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8441 impl Drop for CResult_NonePaymentSendFailureZ {
8442 fn drop(&mut self) {
8445 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8446 let _ = unsafe { Box::from_raw(self.contents.err) };
8451 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8452 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8453 let contents = if o.result_ok {
8454 let _ = unsafe { Box::from_raw(o.contents.result) };
8455 o.contents.result = core::ptr::null_mut();
8456 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8458 let err = unsafe { o.contents.err };
8459 unsafe { o.contents.err = core::ptr::null_mut(); }
8460 CResult_NonePaymentSendFailureZPtr { err }
8464 result_ok: o.result_ok,
8468 impl Clone for CResult_NonePaymentSendFailureZ {
8469 fn clone(&self) -> Self {
8471 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8472 result: core::ptr::null_mut()
8475 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8476 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8482 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8483 /// but with all dynamically-allocated buffers duplicated in new buffers.
8484 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8486 /// The contents of CResult_NoneRetryableSendFailureZ
8487 pub union CResult_NoneRetryableSendFailureZPtr {
8488 /// Note that this value is always NULL, as there are no contents in the OK variant
8489 pub result: *mut core::ffi::c_void,
8490 /// A pointer to the contents in the error state.
8491 /// Reading from this pointer when `result_ok` is set is undefined.
8492 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8495 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8496 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8497 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8498 pub struct CResult_NoneRetryableSendFailureZ {
8499 /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8500 /// `err` or `result` depending on the state of `result_ok`.
8501 pub contents: CResult_NoneRetryableSendFailureZPtr,
8502 /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8503 pub result_ok: bool,
8506 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
8507 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8508 CResult_NoneRetryableSendFailureZ {
8509 contents: CResult_NoneRetryableSendFailureZPtr {
8510 result: core::ptr::null_mut(),
8516 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8517 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8518 CResult_NoneRetryableSendFailureZ {
8519 contents: CResult_NoneRetryableSendFailureZPtr {
8520 err: Box::into_raw(Box::new(e)),
8525 /// Checks if the given object is currently in the success state
8527 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
8531 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
8532 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
8533 impl Drop for CResult_NoneRetryableSendFailureZ {
8534 fn drop(&mut self) {
8537 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8538 let _ = unsafe { Box::from_raw(self.contents.err) };
8543 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
8544 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8545 let contents = if o.result_ok {
8546 let _ = unsafe { Box::from_raw(o.contents.result) };
8547 o.contents.result = core::ptr::null_mut();
8548 CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
8550 let err = unsafe { o.contents.err };
8551 unsafe { o.contents.err = core::ptr::null_mut(); }
8552 CResult_NoneRetryableSendFailureZPtr { err }
8556 result_ok: o.result_ok,
8560 impl Clone for CResult_NoneRetryableSendFailureZ {
8561 fn clone(&self) -> Self {
8563 Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
8564 result: core::ptr::null_mut()
8567 Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
8568 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8574 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
8575 /// but with all dynamically-allocated buffers duplicated in new buffers.
8576 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
8578 /// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ
8579 pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8580 /// A pointer to the contents in the success state.
8581 /// Reading from this pointer when `result_ok` is not set is undefined.
8582 pub result: *mut crate::c_types::ThirtyTwoBytes,
8583 /// A pointer to the contents in the error state.
8584 /// Reading from this pointer when `result_ok` is set is undefined.
8585 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8588 /// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation,
8589 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8591 pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ {
8592 /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either
8593 /// `err` or `result` depending on the state of `result_ok`.
8594 pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr,
8595 /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state.
8596 pub result_ok: bool,
8599 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state.
8600 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
8601 CResult_ThirtyTwoBytesPaymentSendFailureZ {
8602 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8603 result: Box::into_raw(Box::new(o)),
8609 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state.
8610 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
8611 CResult_ThirtyTwoBytesPaymentSendFailureZ {
8612 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8613 err: Box::into_raw(Box::new(e)),
8618 /// Checks if the given object is currently in the success state
8620 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool {
8624 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ.
8625 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { }
8626 impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8627 fn drop(&mut self) {
8629 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8630 let _ = unsafe { Box::from_raw(self.contents.result) };
8633 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8634 let _ = unsafe { Box::from_raw(self.contents.err) };
8639 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8640 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8641 let contents = if o.result_ok {
8642 let result = unsafe { o.contents.result };
8643 unsafe { o.contents.result = core::ptr::null_mut() };
8644 CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result }
8646 let err = unsafe { o.contents.err };
8647 unsafe { o.contents.err = core::ptr::null_mut(); }
8648 CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err }
8652 result_ok: o.result_ok,
8656 impl Clone for CResult_ThirtyTwoBytesPaymentSendFailureZ {
8657 fn clone(&self) -> Self {
8659 Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8660 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8663 Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
8664 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8670 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig`
8671 /// but with all dynamically-allocated buffers duplicated in new buffers.
8672 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) }
8674 /// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ
8675 pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8676 /// A pointer to the contents in the success state.
8677 /// Reading from this pointer when `result_ok` is not set is undefined.
8678 pub result: *mut crate::c_types::ThirtyTwoBytes,
8679 /// A pointer to the contents in the error state.
8680 /// Reading from this pointer when `result_ok` is set is undefined.
8681 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8684 /// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation,
8685 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8687 pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ {
8688 /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either
8689 /// `err` or `result` depending on the state of `result_ok`.
8690 pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr,
8691 /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state.
8692 pub result_ok: bool,
8695 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
8696 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
8697 CResult_ThirtyTwoBytesRetryableSendFailureZ {
8698 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8699 result: Box::into_raw(Box::new(o)),
8705 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
8706 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
8707 CResult_ThirtyTwoBytesRetryableSendFailureZ {
8708 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8709 err: Box::into_raw(Box::new(e)),
8714 /// Checks if the given object is currently in the success state
8716 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool {
8720 /// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ.
8721 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { }
8722 impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ {
8723 fn drop(&mut self) {
8725 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8726 let _ = unsafe { Box::from_raw(self.contents.result) };
8729 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8730 let _ = unsafe { Box::from_raw(self.contents.err) };
8735 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_ThirtyTwoBytesRetryableSendFailureZ {
8736 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8737 let contents = if o.result_ok {
8738 let result = unsafe { o.contents.result };
8739 unsafe { o.contents.result = core::ptr::null_mut() };
8740 CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result }
8742 let err = unsafe { o.contents.err };
8743 unsafe { o.contents.err = core::ptr::null_mut(); }
8744 CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err }
8748 result_ok: o.result_ok,
8752 impl Clone for CResult_ThirtyTwoBytesRetryableSendFailureZ {
8753 fn clone(&self) -> Self {
8755 Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8756 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8759 Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
8760 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8766 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
8767 /// but with all dynamically-allocated buffers duplicated in new buffers.
8768 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) }
8770 /// A tuple of 2 elements. See the individual fields for the types contained.
8771 pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
8772 /// The element at position 0
8773 pub a: crate::c_types::ThirtyTwoBytes,
8774 /// The element at position 1
8775 pub b: crate::c_types::ThirtyTwoBytes,
8777 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
8778 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8785 impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
8786 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8790 impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
8791 fn clone(&self) -> Self {
8793 a: Clone::clone(&self.a),
8794 b: Clone::clone(&self.b),
8799 /// Creates a new tuple which has the same data as `orig`
8800 /// but with all dynamically-allocated buffers duplicated in new buffers.
8801 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) }
8802 /// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements.
8804 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
8805 C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, }
8809 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ.
8810 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { }
8812 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ
8813 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
8814 /// A pointer to the contents in the success state.
8815 /// Reading from this pointer when `result_ok` is not set is undefined.
8816 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
8817 /// A pointer to the contents in the error state.
8818 /// Reading from this pointer when `result_ok` is set is undefined.
8819 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8822 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation,
8823 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8824 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8825 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8826 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either
8827 /// `err` or `result` depending on the state of `result_ok`.
8828 pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr,
8829 /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state.
8830 pub result_ok: bool,
8833 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state.
8834 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8835 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8836 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
8837 result: Box::into_raw(Box::new(o)),
8843 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state.
8844 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8845 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8846 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
8847 err: Box::into_raw(Box::new(e)),
8852 /// Checks if the given object is currently in the success state
8854 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool {
8858 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.
8859 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { }
8860 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8861 fn drop(&mut self) {
8863 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8864 let _ = unsafe { Box::from_raw(self.contents.result) };
8867 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8868 let _ = unsafe { Box::from_raw(self.contents.err) };
8873 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8874 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8875 let contents = if o.result_ok {
8876 let result = unsafe { o.contents.result };
8877 unsafe { o.contents.result = core::ptr::null_mut() };
8878 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result }
8880 let err = unsafe { o.contents.err };
8881 unsafe { o.contents.err = core::ptr::null_mut(); }
8882 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err }
8886 result_ok: o.result_ok,
8890 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
8891 fn clone(&self) -> Self {
8893 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
8894 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
8897 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
8898 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8904 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig`
8905 /// but with all dynamically-allocated buffers duplicated in new buffers.
8906 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) }
8908 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size.
8909 /// This corresponds to std::vector in C++
8910 pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
8911 /// The elements in the array.
8912 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8913 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
8914 /// The number of elements pointed to by `data`.
8917 impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
8918 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ> {
8919 if self.datalen == 0 { return Vec::new(); }
8920 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8921 self.data = core::ptr::null_mut();
8925 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] {
8926 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8929 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
8930 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>) -> Self {
8931 let datalen = v.len();
8932 let data = Box::into_raw(v.into_boxed_slice());
8933 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8937 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8938 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { }
8939 impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
8940 fn drop(&mut self) {
8941 if self.datalen == 0 { return; }
8942 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8945 impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
8946 fn clone(&self) -> Self {
8947 let mut res = Vec::new();
8948 if self.datalen == 0 { return Self::from(res); }
8949 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8954 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ
8955 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
8956 /// A pointer to the contents in the success state.
8957 /// Reading from this pointer when `result_ok` is not set is undefined.
8958 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
8959 /// A pointer to the contents in the error state.
8960 /// Reading from this pointer when `result_ok` is set is undefined.
8961 pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure,
8964 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation,
8965 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure.
8966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8967 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
8968 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either
8969 /// `err` or `result` depending on the state of `result_ok`.
8970 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr,
8971 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state.
8972 pub result_ok: bool,
8975 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state.
8976 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
8977 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
8978 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
8979 result: Box::into_raw(Box::new(o)),
8985 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state.
8986 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
8987 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
8988 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
8989 err: Box::into_raw(Box::new(e)),
8994 /// Checks if the given object is currently in the success state
8996 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool {
9000 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.
9001 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { }
9002 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9003 fn drop(&mut self) {
9005 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9006 let _ = unsafe { Box::from_raw(self.contents.result) };
9009 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9010 let _ = unsafe { Box::from_raw(self.contents.err) };
9015 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9016 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>) -> Self {
9017 let contents = if o.result_ok {
9018 let result = unsafe { o.contents.result };
9019 unsafe { o.contents.result = core::ptr::null_mut() };
9020 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result }
9022 let err = unsafe { o.contents.err };
9023 unsafe { o.contents.err = core::ptr::null_mut(); }
9024 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err }
9028 result_ok: o.result_ok,
9032 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
9033 fn clone(&self) -> Self {
9035 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9036 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
9039 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
9040 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::ProbeSendFailure>::clone(unsafe { &*self.contents.err })))
9046 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig`
9047 /// but with all dynamically-allocated buffers duplicated in new buffers.
9048 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) }
9050 /// A tuple of 2 elements. See the individual fields for the types contained.
9051 pub struct C2Tuple_ThirtyTwoBytesPublicKeyZ {
9052 /// The element at position 0
9053 pub a: crate::c_types::ThirtyTwoBytes,
9054 /// The element at position 1
9055 pub b: crate::c_types::PublicKey,
9057 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey)> for C2Tuple_ThirtyTwoBytesPublicKeyZ {
9058 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey)) -> Self {
9065 impl C2Tuple_ThirtyTwoBytesPublicKeyZ {
9066 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey) {
9070 impl Clone for C2Tuple_ThirtyTwoBytesPublicKeyZ {
9071 fn clone(&self) -> Self {
9073 a: Clone::clone(&self.a),
9074 b: Clone::clone(&self.b),
9079 /// Creates a new tuple which has the same data as `orig`
9080 /// but with all dynamically-allocated buffers duplicated in new buffers.
9081 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig: &C2Tuple_ThirtyTwoBytesPublicKeyZ) -> C2Tuple_ThirtyTwoBytesPublicKeyZ { Clone::clone(&orig) }
9082 /// Creates a new C2Tuple_ThirtyTwoBytesPublicKeyZ from the contained elements.
9084 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::PublicKey) -> C2Tuple_ThirtyTwoBytesPublicKeyZ {
9085 C2Tuple_ThirtyTwoBytesPublicKeyZ { a, b, }
9089 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesPublicKeyZ.
9090 pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res: C2Tuple_ThirtyTwoBytesPublicKeyZ) { }
9092 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZs of arbitrary size.
9093 /// This corresponds to std::vector in C++
9094 pub struct CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9095 /// The elements in the array.
9096 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9097 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ,
9098 /// The number of elements pointed to by `data`.
9101 impl CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9102 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ> {
9103 if self.datalen == 0 { return Vec::new(); }
9104 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9105 self.data = core::ptr::null_mut();
9109 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ] {
9110 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9113 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ>> for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9114 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ>) -> Self {
9115 let datalen = v.len();
9116 let data = Box::into_raw(v.into_boxed_slice());
9117 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9121 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9122 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ) { }
9123 impl Drop for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9124 fn drop(&mut self) {
9125 if self.datalen == 0 { return; }
9126 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9129 impl Clone for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ {
9130 fn clone(&self) -> Self {
9131 let mut res = Vec::new();
9132 if self.datalen == 0 { return Self::from(res); }
9133 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9138 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
9139 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9140 /// A pointer to the contents in the success state.
9141 /// Reading from this pointer when `result_ok` is not set is undefined.
9142 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
9143 /// Note that this value is always NULL, as there are no contents in the Err variant
9144 pub err: *mut core::ffi::c_void,
9147 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
9148 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
9149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9150 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9151 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
9152 /// `err` or `result` depending on the state of `result_ok`.
9153 pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
9154 /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
9155 pub result_ok: bool,
9158 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
9159 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9160 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9161 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9162 result: Box::into_raw(Box::new(o)),
9168 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
9169 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9170 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9171 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9172 err: core::ptr::null_mut(),
9177 /// Checks if the given object is currently in the success state
9179 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
9183 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
9184 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
9185 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9186 fn drop(&mut self) {
9188 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9189 let _ = unsafe { Box::from_raw(self.contents.result) };
9195 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9196 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
9197 let contents = if o.result_ok {
9198 let result = unsafe { o.contents.result };
9199 unsafe { o.contents.result = core::ptr::null_mut() };
9200 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
9202 let _ = unsafe { Box::from_raw(o.contents.err) };
9203 o.contents.err = core::ptr::null_mut();
9204 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
9208 result_ok: o.result_ok,
9212 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9213 fn clone(&self) -> Self {
9215 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9216 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
9219 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9220 err: core::ptr::null_mut()
9226 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
9227 /// but with all dynamically-allocated buffers duplicated in new buffers.
9228 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
9230 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9231 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9232 /// A pointer to the contents in the success state.
9233 /// Reading from this pointer when `result_ok` is not set is undefined.
9234 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9235 /// A pointer to the contents in the error state.
9236 /// Reading from this pointer when `result_ok` is set is undefined.
9237 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9240 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9241 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9242 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9243 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9244 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9245 /// `err` or `result` depending on the state of `result_ok`.
9246 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9247 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9248 pub result_ok: bool,
9251 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9252 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9253 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9254 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9255 result: Box::into_raw(Box::new(o)),
9261 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9262 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9263 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9264 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9265 err: Box::into_raw(Box::new(e)),
9270 /// Checks if the given object is currently in the success state
9272 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9276 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9277 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9278 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9279 fn drop(&mut self) {
9281 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9282 let _ = unsafe { Box::from_raw(self.contents.result) };
9285 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9286 let _ = unsafe { Box::from_raw(self.contents.err) };
9291 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9292 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9293 let contents = if o.result_ok {
9294 let result = unsafe { o.contents.result };
9295 unsafe { o.contents.result = core::ptr::null_mut() };
9296 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9298 let err = unsafe { o.contents.err };
9299 unsafe { o.contents.err = core::ptr::null_mut(); }
9300 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9304 result_ok: o.result_ok,
9308 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9309 fn clone(&self) -> Self {
9311 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9312 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9315 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9316 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9322 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9323 /// but with all dynamically-allocated buffers duplicated in new buffers.
9324 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9326 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9327 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9328 /// A pointer to the contents in the success state.
9329 /// Reading from this pointer when `result_ok` is not set is undefined.
9330 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9331 /// A pointer to the contents in the error state.
9332 /// Reading from this pointer when `result_ok` is set is undefined.
9333 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9336 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9337 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9338 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9339 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9340 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9341 /// `err` or `result` depending on the state of `result_ok`.
9342 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9343 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9344 pub result_ok: bool,
9347 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9348 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9349 CResult_ChannelCounterpartyDecodeErrorZ {
9350 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9351 result: Box::into_raw(Box::new(o)),
9357 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9358 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9359 CResult_ChannelCounterpartyDecodeErrorZ {
9360 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9361 err: Box::into_raw(Box::new(e)),
9366 /// Checks if the given object is currently in the success state
9368 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9372 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9373 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9374 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9375 fn drop(&mut self) {
9377 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9378 let _ = unsafe { Box::from_raw(self.contents.result) };
9381 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9382 let _ = unsafe { Box::from_raw(self.contents.err) };
9387 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9388 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9389 let contents = if o.result_ok {
9390 let result = unsafe { o.contents.result };
9391 unsafe { o.contents.result = core::ptr::null_mut() };
9392 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9394 let err = unsafe { o.contents.err };
9395 unsafe { o.contents.err = core::ptr::null_mut(); }
9396 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9400 result_ok: o.result_ok,
9404 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9405 fn clone(&self) -> Self {
9407 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9408 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9411 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9412 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9418 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9419 /// but with all dynamically-allocated buffers duplicated in new buffers.
9420 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9422 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9423 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9424 /// A pointer to the contents in the success state.
9425 /// Reading from this pointer when `result_ok` is not set is undefined.
9426 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9427 /// A pointer to the contents in the error state.
9428 /// Reading from this pointer when `result_ok` is set is undefined.
9429 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9432 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9433 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9435 pub struct CResult_ChannelDetailsDecodeErrorZ {
9436 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9437 /// `err` or `result` depending on the state of `result_ok`.
9438 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9439 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9440 pub result_ok: bool,
9443 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9444 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9445 CResult_ChannelDetailsDecodeErrorZ {
9446 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9447 result: Box::into_raw(Box::new(o)),
9453 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9454 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9455 CResult_ChannelDetailsDecodeErrorZ {
9456 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9457 err: Box::into_raw(Box::new(e)),
9462 /// Checks if the given object is currently in the success state
9464 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9468 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9469 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9470 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9471 fn drop(&mut self) {
9473 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9474 let _ = unsafe { Box::from_raw(self.contents.result) };
9477 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9478 let _ = unsafe { Box::from_raw(self.contents.err) };
9483 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9484 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9485 let contents = if o.result_ok {
9486 let result = unsafe { o.contents.result };
9487 unsafe { o.contents.result = core::ptr::null_mut() };
9488 CResult_ChannelDetailsDecodeErrorZPtr { result }
9490 let err = unsafe { o.contents.err };
9491 unsafe { o.contents.err = core::ptr::null_mut(); }
9492 CResult_ChannelDetailsDecodeErrorZPtr { err }
9496 result_ok: o.result_ok,
9500 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9501 fn clone(&self) -> Self {
9503 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9504 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9507 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9508 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9514 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9515 /// but with all dynamically-allocated buffers duplicated in new buffers.
9516 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9518 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9519 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9520 /// A pointer to the contents in the success state.
9521 /// Reading from this pointer when `result_ok` is not set is undefined.
9522 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9523 /// A pointer to the contents in the error state.
9524 /// Reading from this pointer when `result_ok` is set is undefined.
9525 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9528 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9529 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9531 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9532 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9533 /// `err` or `result` depending on the state of `result_ok`.
9534 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9535 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9536 pub result_ok: bool,
9539 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9540 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9541 CResult_PhantomRouteHintsDecodeErrorZ {
9542 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9543 result: Box::into_raw(Box::new(o)),
9549 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9550 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9551 CResult_PhantomRouteHintsDecodeErrorZ {
9552 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9553 err: Box::into_raw(Box::new(e)),
9558 /// Checks if the given object is currently in the success state
9560 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9564 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9565 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9566 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9567 fn drop(&mut self) {
9569 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9570 let _ = unsafe { Box::from_raw(self.contents.result) };
9573 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9574 let _ = unsafe { Box::from_raw(self.contents.err) };
9579 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9580 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9581 let contents = if o.result_ok {
9582 let result = unsafe { o.contents.result };
9583 unsafe { o.contents.result = core::ptr::null_mut() };
9584 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9586 let err = unsafe { o.contents.err };
9587 unsafe { o.contents.err = core::ptr::null_mut(); }
9588 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9592 result_ok: o.result_ok,
9596 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9597 fn clone(&self) -> Self {
9599 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9600 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9603 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9604 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9610 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9611 /// but with all dynamically-allocated buffers duplicated in new buffers.
9612 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9614 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
9615 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
9616 /// A pointer to the contents in the success state.
9617 /// Reading from this pointer when `result_ok` is not set is undefined.
9618 pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
9619 /// A pointer to the contents in the error state.
9620 /// Reading from this pointer when `result_ok` is set is undefined.
9621 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9624 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
9625 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
9626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9627 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
9628 /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
9629 /// `err` or `result` depending on the state of `result_ok`.
9630 pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
9631 /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
9632 pub result_ok: bool,
9635 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
9636 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
9637 CResult_ChannelShutdownStateDecodeErrorZ {
9638 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9639 result: Box::into_raw(Box::new(o)),
9645 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
9646 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
9647 CResult_ChannelShutdownStateDecodeErrorZ {
9648 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9649 err: Box::into_raw(Box::new(e)),
9654 /// Checks if the given object is currently in the success state
9656 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
9660 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
9661 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
9662 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
9663 fn drop(&mut self) {
9665 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9666 let _ = unsafe { Box::from_raw(self.contents.result) };
9669 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9670 let _ = unsafe { Box::from_raw(self.contents.err) };
9675 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
9676 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
9677 let contents = if o.result_ok {
9678 let result = unsafe { o.contents.result };
9679 unsafe { o.contents.result = core::ptr::null_mut() };
9680 CResult_ChannelShutdownStateDecodeErrorZPtr { result }
9682 let err = unsafe { o.contents.err };
9683 unsafe { o.contents.err = core::ptr::null_mut(); }
9684 CResult_ChannelShutdownStateDecodeErrorZPtr { err }
9688 result_ok: o.result_ok,
9692 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
9693 fn clone(&self) -> Self {
9695 Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9696 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
9699 Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9700 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9706 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
9707 /// but with all dynamically-allocated buffers duplicated in new buffers.
9708 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
9710 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9711 /// This corresponds to std::vector in C++
9712 pub struct CVec_ChannelMonitorZ {
9713 /// The elements in the array.
9714 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9715 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9716 /// The number of elements pointed to by `data`.
9719 impl CVec_ChannelMonitorZ {
9720 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9721 if self.datalen == 0 { return Vec::new(); }
9722 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9723 self.data = core::ptr::null_mut();
9727 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9728 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9731 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9732 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9733 let datalen = v.len();
9734 let data = Box::into_raw(v.into_boxed_slice());
9735 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9739 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9740 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9741 impl Drop for CVec_ChannelMonitorZ {
9742 fn drop(&mut self) {
9743 if self.datalen == 0 { return; }
9744 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9747 impl Clone for CVec_ChannelMonitorZ {
9748 fn clone(&self) -> Self {
9749 let mut res = Vec::new();
9750 if self.datalen == 0 { return Self::from(res); }
9751 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9756 /// A tuple of 2 elements. See the individual fields for the types contained.
9757 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
9758 /// The element at position 0
9759 pub a: crate::c_types::ThirtyTwoBytes,
9760 /// The element at position 1
9761 pub b: crate::lightning::ln::channelmanager::ChannelManager,
9763 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
9764 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9771 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
9772 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9776 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
9778 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
9779 C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
9783 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
9784 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
9786 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
9787 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
9788 /// A pointer to the contents in the success state.
9789 /// Reading from this pointer when `result_ok` is not set is undefined.
9790 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
9791 /// A pointer to the contents in the error state.
9792 /// Reading from this pointer when `result_ok` is set is undefined.
9793 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9796 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9797 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9799 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9800 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
9801 /// `err` or `result` depending on the state of `result_ok`.
9802 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
9803 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
9804 pub result_ok: bool,
9807 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
9808 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9809 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9810 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
9811 result: Box::into_raw(Box::new(o)),
9817 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
9818 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9819 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9820 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
9821 err: Box::into_raw(Box::new(e)),
9826 /// Checks if the given object is currently in the success state
9828 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
9832 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
9833 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
9834 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9835 fn drop(&mut self) {
9837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9838 let _ = unsafe { Box::from_raw(self.contents.result) };
9841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9842 let _ = unsafe { Box::from_raw(self.contents.err) };
9847 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
9848 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9849 let contents = if o.result_ok {
9850 let result = unsafe { o.contents.result };
9851 unsafe { o.contents.result = core::ptr::null_mut() };
9852 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
9854 let err = unsafe { o.contents.err };
9855 unsafe { o.contents.err = core::ptr::null_mut(); }
9856 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
9860 result_ok: o.result_ok,
9865 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
9866 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9867 /// A pointer to the contents in the success state.
9868 /// Reading from this pointer when `result_ok` is not set is undefined.
9869 pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
9870 /// A pointer to the contents in the error state.
9871 /// Reading from this pointer when `result_ok` is set is undefined.
9872 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9875 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
9876 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
9877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9878 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
9879 /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
9880 /// `err` or `result` depending on the state of `result_ok`.
9881 pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
9882 /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
9883 pub result_ok: bool,
9886 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
9887 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
9888 CResult_MaxDustHTLCExposureDecodeErrorZ {
9889 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9890 result: Box::into_raw(Box::new(o)),
9896 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
9897 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
9898 CResult_MaxDustHTLCExposureDecodeErrorZ {
9899 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9900 err: Box::into_raw(Box::new(e)),
9905 /// Checks if the given object is currently in the success state
9907 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
9911 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
9912 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
9913 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
9914 fn drop(&mut self) {
9916 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9917 let _ = unsafe { Box::from_raw(self.contents.result) };
9920 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9921 let _ = unsafe { Box::from_raw(self.contents.err) };
9926 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
9927 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
9928 let contents = if o.result_ok {
9929 let result = unsafe { o.contents.result };
9930 unsafe { o.contents.result = core::ptr::null_mut() };
9931 CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
9933 let err = unsafe { o.contents.err };
9934 unsafe { o.contents.err = core::ptr::null_mut(); }
9935 CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
9939 result_ok: o.result_ok,
9943 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
9944 fn clone(&self) -> Self {
9946 Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9947 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
9950 Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9951 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9957 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
9958 /// but with all dynamically-allocated buffers duplicated in new buffers.
9959 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
9961 /// The contents of CResult_ChannelConfigDecodeErrorZ
9962 pub union CResult_ChannelConfigDecodeErrorZPtr {
9963 /// A pointer to the contents in the success state.
9964 /// Reading from this pointer when `result_ok` is not set is undefined.
9965 pub result: *mut crate::lightning::util::config::ChannelConfig,
9966 /// A pointer to the contents in the error state.
9967 /// Reading from this pointer when `result_ok` is set is undefined.
9968 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9971 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9972 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9974 pub struct CResult_ChannelConfigDecodeErrorZ {
9975 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9976 /// `err` or `result` depending on the state of `result_ok`.
9977 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9978 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9979 pub result_ok: bool,
9982 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9983 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9984 CResult_ChannelConfigDecodeErrorZ {
9985 contents: CResult_ChannelConfigDecodeErrorZPtr {
9986 result: Box::into_raw(Box::new(o)),
9992 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9993 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9994 CResult_ChannelConfigDecodeErrorZ {
9995 contents: CResult_ChannelConfigDecodeErrorZPtr {
9996 err: Box::into_raw(Box::new(e)),
10001 /// Checks if the given object is currently in the success state
10003 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
10007 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10008 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
10009 impl Drop for CResult_ChannelConfigDecodeErrorZ {
10010 fn drop(&mut self) {
10011 if self.result_ok {
10012 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10013 let _ = unsafe { Box::from_raw(self.contents.result) };
10016 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10017 let _ = unsafe { Box::from_raw(self.contents.err) };
10022 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
10023 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
10024 let contents = if o.result_ok {
10025 let result = unsafe { o.contents.result };
10026 unsafe { o.contents.result = core::ptr::null_mut() };
10027 CResult_ChannelConfigDecodeErrorZPtr { result }
10029 let err = unsafe { o.contents.err };
10030 unsafe { o.contents.err = core::ptr::null_mut(); }
10031 CResult_ChannelConfigDecodeErrorZPtr { err }
10035 result_ok: o.result_ok,
10039 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10040 fn clone(&self) -> Self {
10041 if self.result_ok {
10042 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10043 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
10046 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
10047 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10053 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10054 /// but with all dynamically-allocated buffers duplicated in new buffers.
10055 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
10058 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
10059 pub enum COption_MaxDustHTLCExposureZ {
10060 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
10061 Some(crate::lightning::util::config::MaxDustHTLCExposure),
10062 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
10065 impl COption_MaxDustHTLCExposureZ {
10066 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10067 if let Self::None = self { false } else { true }
10069 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10072 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
10073 if let Self::Some(v) = self { v } else { unreachable!() }
10077 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
10078 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
10079 COption_MaxDustHTLCExposureZ::Some(o)
10082 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
10083 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
10084 COption_MaxDustHTLCExposureZ::None
10087 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
10088 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
10090 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
10091 /// but with all dynamically-allocated buffers duplicated in new buffers.
10092 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
10095 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
10096 pub enum COption_APIErrorZ {
10097 /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
10098 Some(crate::lightning::util::errors::APIError),
10099 /// When we're in this state, this COption_APIErrorZ contains nothing
10102 impl COption_APIErrorZ {
10103 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10104 if let Self::None = self { false } else { true }
10106 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10109 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
10110 if let Self::Some(v) = self { v } else { unreachable!() }
10114 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
10115 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
10116 COption_APIErrorZ::Some(o)
10119 /// Constructs a new COption_APIErrorZ containing nothing
10120 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
10121 COption_APIErrorZ::None
10124 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
10125 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
10127 /// Creates a new COption_APIErrorZ which has the same data as `orig`
10128 /// but with all dynamically-allocated buffers duplicated in new buffers.
10129 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
10131 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
10132 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
10133 /// A pointer to the contents in the success state.
10134 /// Reading from this pointer when `result_ok` is not set is undefined.
10135 pub result: *mut crate::c_types::derived::COption_APIErrorZ,
10136 /// A pointer to the contents in the error state.
10137 /// Reading from this pointer when `result_ok` is set is undefined.
10138 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10141 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
10142 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10144 pub struct CResult_COption_APIErrorZDecodeErrorZ {
10145 /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
10146 /// `err` or `result` depending on the state of `result_ok`.
10147 pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
10148 /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
10149 pub result_ok: bool,
10152 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
10153 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
10154 CResult_COption_APIErrorZDecodeErrorZ {
10155 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10156 result: Box::into_raw(Box::new(o)),
10162 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
10163 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
10164 CResult_COption_APIErrorZDecodeErrorZ {
10165 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10166 err: Box::into_raw(Box::new(e)),
10171 /// Checks if the given object is currently in the success state
10173 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
10177 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
10178 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
10179 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
10180 fn drop(&mut self) {
10181 if self.result_ok {
10182 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10183 let _ = unsafe { Box::from_raw(self.contents.result) };
10186 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10187 let _ = unsafe { Box::from_raw(self.contents.err) };
10192 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
10193 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10194 let contents = if o.result_ok {
10195 let result = unsafe { o.contents.result };
10196 unsafe { o.contents.result = core::ptr::null_mut() };
10197 CResult_COption_APIErrorZDecodeErrorZPtr { result }
10199 let err = unsafe { o.contents.err };
10200 unsafe { o.contents.err = core::ptr::null_mut(); }
10201 CResult_COption_APIErrorZDecodeErrorZPtr { err }
10205 result_ok: o.result_ok,
10209 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
10210 fn clone(&self) -> Self {
10211 if self.result_ok {
10212 Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10213 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
10216 Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10217 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10223 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
10224 /// but with all dynamically-allocated buffers duplicated in new buffers.
10225 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
10227 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10228 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10229 /// A pointer to the contents in the success state.
10230 /// Reading from this pointer when `result_ok` is not set is undefined.
10231 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10232 /// A pointer to the contents in the error state.
10233 /// Reading from this pointer when `result_ok` is set is undefined.
10234 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10237 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10238 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10240 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10241 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10242 /// `err` or `result` depending on the state of `result_ok`.
10243 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10244 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10245 pub result_ok: bool,
10248 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10249 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10250 CResult_ChannelMonitorUpdateDecodeErrorZ {
10251 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10252 result: Box::into_raw(Box::new(o)),
10258 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10259 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10260 CResult_ChannelMonitorUpdateDecodeErrorZ {
10261 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10262 err: Box::into_raw(Box::new(e)),
10267 /// Checks if the given object is currently in the success state
10269 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10273 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10274 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10275 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10276 fn drop(&mut self) {
10277 if self.result_ok {
10278 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10279 let _ = unsafe { Box::from_raw(self.contents.result) };
10282 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10283 let _ = unsafe { Box::from_raw(self.contents.err) };
10288 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10289 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10290 let contents = if o.result_ok {
10291 let result = unsafe { o.contents.result };
10292 unsafe { o.contents.result = core::ptr::null_mut() };
10293 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10295 let err = unsafe { o.contents.err };
10296 unsafe { o.contents.err = core::ptr::null_mut(); }
10297 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10301 result_ok: o.result_ok,
10305 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10306 fn clone(&self) -> Self {
10307 if self.result_ok {
10308 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10309 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10312 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10313 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10319 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10320 /// but with all dynamically-allocated buffers duplicated in new buffers.
10321 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10324 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10325 pub enum COption_MonitorEventZ {
10326 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10327 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10328 /// When we're in this state, this COption_MonitorEventZ contains nothing
10331 impl COption_MonitorEventZ {
10332 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10333 if let Self::None = self { false } else { true }
10335 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10338 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10339 if let Self::Some(v) = self { v } else { unreachable!() }
10343 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10344 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10345 COption_MonitorEventZ::Some(o)
10348 /// Constructs a new COption_MonitorEventZ containing nothing
10349 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10350 COption_MonitorEventZ::None
10353 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10354 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10356 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10357 /// but with all dynamically-allocated buffers duplicated in new buffers.
10358 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10360 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10361 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10362 /// A pointer to the contents in the success state.
10363 /// Reading from this pointer when `result_ok` is not set is undefined.
10364 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10365 /// A pointer to the contents in the error state.
10366 /// Reading from this pointer when `result_ok` is set is undefined.
10367 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10370 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10371 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10372 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10373 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10374 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10375 /// `err` or `result` depending on the state of `result_ok`.
10376 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10377 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10378 pub result_ok: bool,
10381 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10382 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10383 CResult_COption_MonitorEventZDecodeErrorZ {
10384 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10385 result: Box::into_raw(Box::new(o)),
10391 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10392 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10393 CResult_COption_MonitorEventZDecodeErrorZ {
10394 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10395 err: Box::into_raw(Box::new(e)),
10400 /// Checks if the given object is currently in the success state
10402 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10406 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10407 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10408 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10409 fn drop(&mut self) {
10410 if self.result_ok {
10411 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10412 let _ = unsafe { Box::from_raw(self.contents.result) };
10415 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10416 let _ = unsafe { Box::from_raw(self.contents.err) };
10421 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10422 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10423 let contents = if o.result_ok {
10424 let result = unsafe { o.contents.result };
10425 unsafe { o.contents.result = core::ptr::null_mut() };
10426 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10428 let err = unsafe { o.contents.err };
10429 unsafe { o.contents.err = core::ptr::null_mut(); }
10430 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10434 result_ok: o.result_ok,
10438 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10439 fn clone(&self) -> Self {
10440 if self.result_ok {
10441 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10442 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10445 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10446 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10452 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10453 /// but with all dynamically-allocated buffers duplicated in new buffers.
10454 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10456 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10457 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10458 /// A pointer to the contents in the success state.
10459 /// Reading from this pointer when `result_ok` is not set is undefined.
10460 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10461 /// A pointer to the contents in the error state.
10462 /// Reading from this pointer when `result_ok` is set is undefined.
10463 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10466 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10467 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10469 pub struct CResult_HTLCUpdateDecodeErrorZ {
10470 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10471 /// `err` or `result` depending on the state of `result_ok`.
10472 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10473 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10474 pub result_ok: bool,
10477 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10478 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10479 CResult_HTLCUpdateDecodeErrorZ {
10480 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10481 result: Box::into_raw(Box::new(o)),
10487 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10488 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10489 CResult_HTLCUpdateDecodeErrorZ {
10490 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10491 err: Box::into_raw(Box::new(e)),
10496 /// Checks if the given object is currently in the success state
10498 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10502 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10503 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10504 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10505 fn drop(&mut self) {
10506 if self.result_ok {
10507 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10508 let _ = unsafe { Box::from_raw(self.contents.result) };
10511 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10512 let _ = unsafe { Box::from_raw(self.contents.err) };
10517 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10518 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10519 let contents = if o.result_ok {
10520 let result = unsafe { o.contents.result };
10521 unsafe { o.contents.result = core::ptr::null_mut() };
10522 CResult_HTLCUpdateDecodeErrorZPtr { result }
10524 let err = unsafe { o.contents.err };
10525 unsafe { o.contents.err = core::ptr::null_mut(); }
10526 CResult_HTLCUpdateDecodeErrorZPtr { err }
10530 result_ok: o.result_ok,
10534 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10535 fn clone(&self) -> Self {
10536 if self.result_ok {
10537 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10538 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10541 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10542 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10548 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10549 /// but with all dynamically-allocated buffers duplicated in new buffers.
10550 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10552 /// A tuple of 2 elements. See the individual fields for the types contained.
10553 pub struct C2Tuple_OutPointCVec_u8ZZ {
10554 /// The element at position 0
10555 pub a: crate::lightning::chain::transaction::OutPoint,
10556 /// The element at position 1
10557 pub b: crate::c_types::derived::CVec_u8Z,
10559 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
10560 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10567 impl C2Tuple_OutPointCVec_u8ZZ {
10568 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10572 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
10573 fn clone(&self) -> Self {
10575 a: Clone::clone(&self.a),
10576 b: Clone::clone(&self.b),
10581 /// Creates a new tuple which has the same data as `orig`
10582 /// but with all dynamically-allocated buffers duplicated in new buffers.
10583 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
10584 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
10586 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
10587 C2Tuple_OutPointCVec_u8ZZ { a, b, }
10591 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
10592 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
10594 /// A tuple of 2 elements. See the individual fields for the types contained.
10595 pub struct C2Tuple_u32CVec_u8ZZ {
10596 /// The element at position 0
10598 /// The element at position 1
10599 pub b: crate::c_types::derived::CVec_u8Z,
10601 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
10602 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10609 impl C2Tuple_u32CVec_u8ZZ {
10610 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10614 impl Clone for C2Tuple_u32CVec_u8ZZ {
10615 fn clone(&self) -> Self {
10617 a: Clone::clone(&self.a),
10618 b: Clone::clone(&self.b),
10623 /// Creates a new tuple which has the same data as `orig`
10624 /// but with all dynamically-allocated buffers duplicated in new buffers.
10625 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
10626 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
10628 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
10629 C2Tuple_u32CVec_u8ZZ { a, b, }
10633 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
10634 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
10636 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
10637 /// This corresponds to std::vector in C++
10638 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
10639 /// The elements in the array.
10640 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10641 pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
10642 /// The number of elements pointed to by `data`.
10645 impl CVec_C2Tuple_u32CVec_u8ZZZ {
10646 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
10647 if self.datalen == 0 { return Vec::new(); }
10648 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10649 self.data = core::ptr::null_mut();
10653 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
10654 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10657 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
10658 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
10659 let datalen = v.len();
10660 let data = Box::into_raw(v.into_boxed_slice());
10661 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10665 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10666 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
10667 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
10668 fn drop(&mut self) {
10669 if self.datalen == 0 { return; }
10670 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10673 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
10674 fn clone(&self) -> Self {
10675 let mut res = Vec::new();
10676 if self.datalen == 0 { return Self::from(res); }
10677 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10682 /// A tuple of 2 elements. See the individual fields for the types contained.
10683 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10684 /// The element at position 0
10685 pub a: crate::c_types::ThirtyTwoBytes,
10686 /// The element at position 1
10687 pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
10689 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10690 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
10697 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10698 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
10702 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10703 fn clone(&self) -> Self {
10705 a: Clone::clone(&self.a),
10706 b: Clone::clone(&self.b),
10711 /// Creates a new tuple which has the same data as `orig`
10712 /// but with all dynamically-allocated buffers duplicated in new buffers.
10713 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
10714 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
10716 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 {
10717 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
10721 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
10722 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
10724 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
10725 /// This corresponds to std::vector in C++
10726 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10727 /// The elements in the array.
10728 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10729 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
10730 /// The number of elements pointed to by `data`.
10733 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10734 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
10735 if self.datalen == 0 { return Vec::new(); }
10736 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10737 self.data = core::ptr::null_mut();
10741 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
10742 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10745 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10746 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
10747 let datalen = v.len();
10748 let data = Box::into_raw(v.into_boxed_slice());
10749 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10753 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10754 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
10755 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10756 fn drop(&mut self) {
10757 if self.datalen == 0 { return; }
10758 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10761 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10762 fn clone(&self) -> Self {
10763 let mut res = Vec::new();
10764 if self.datalen == 0 { return Self::from(res); }
10765 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10770 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
10771 /// This corresponds to std::vector in C++
10772 pub struct CVec_CommitmentTransactionZ {
10773 /// The elements in the array.
10774 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10775 pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
10776 /// The number of elements pointed to by `data`.
10779 impl CVec_CommitmentTransactionZ {
10780 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
10781 if self.datalen == 0 { return Vec::new(); }
10782 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10783 self.data = core::ptr::null_mut();
10787 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
10788 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10791 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
10792 fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
10793 let datalen = v.len();
10794 let data = Box::into_raw(v.into_boxed_slice());
10795 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10799 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10800 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
10801 impl Drop for CVec_CommitmentTransactionZ {
10802 fn drop(&mut self) {
10803 if self.datalen == 0 { return; }
10804 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10807 impl Clone for CVec_CommitmentTransactionZ {
10808 fn clone(&self) -> Self {
10809 let mut res = Vec::new();
10810 if self.datalen == 0 { return Self::from(res); }
10811 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10816 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
10817 /// This corresponds to std::vector in C++
10818 pub struct CVec_TransactionZ {
10819 /// The elements in the array.
10820 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10821 pub data: *mut crate::c_types::Transaction,
10822 /// The number of elements pointed to by `data`.
10825 impl CVec_TransactionZ {
10826 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
10827 if self.datalen == 0 { return Vec::new(); }
10828 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10829 self.data = core::ptr::null_mut();
10833 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
10834 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10837 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
10838 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
10839 let datalen = v.len();
10840 let data = Box::into_raw(v.into_boxed_slice());
10841 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10845 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10846 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
10847 impl Drop for CVec_TransactionZ {
10848 fn drop(&mut self) {
10849 if self.datalen == 0 { return; }
10850 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10853 impl Clone for CVec_TransactionZ {
10854 fn clone(&self) -> Self {
10855 let mut res = Vec::new();
10856 if self.datalen == 0 { return Self::from(res); }
10857 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10862 /// A tuple of 2 elements. See the individual fields for the types contained.
10863 pub struct C2Tuple_u32TxOutZ {
10864 /// The element at position 0
10866 /// The element at position 1
10867 pub b: crate::c_types::TxOut,
10869 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
10870 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
10877 impl C2Tuple_u32TxOutZ {
10878 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
10882 impl Clone for C2Tuple_u32TxOutZ {
10883 fn clone(&self) -> Self {
10885 a: Clone::clone(&self.a),
10886 b: Clone::clone(&self.b),
10891 /// Creates a new tuple which has the same data as `orig`
10892 /// but with all dynamically-allocated buffers duplicated in new buffers.
10893 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
10894 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
10896 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
10897 C2Tuple_u32TxOutZ { a, b, }
10901 /// Frees any resources used by the C2Tuple_u32TxOutZ.
10902 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
10904 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
10905 /// This corresponds to std::vector in C++
10906 pub struct CVec_C2Tuple_u32TxOutZZ {
10907 /// The elements in the array.
10908 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10909 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
10910 /// The number of elements pointed to by `data`.
10913 impl CVec_C2Tuple_u32TxOutZZ {
10914 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
10915 if self.datalen == 0 { return Vec::new(); }
10916 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10917 self.data = core::ptr::null_mut();
10921 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
10922 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10925 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
10926 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
10927 let datalen = v.len();
10928 let data = Box::into_raw(v.into_boxed_slice());
10929 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10933 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10934 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
10935 impl Drop for CVec_C2Tuple_u32TxOutZZ {
10936 fn drop(&mut self) {
10937 if self.datalen == 0 { return; }
10938 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10941 impl Clone for CVec_C2Tuple_u32TxOutZZ {
10942 fn clone(&self) -> Self {
10943 let mut res = Vec::new();
10944 if self.datalen == 0 { return Self::from(res); }
10945 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10950 /// A tuple of 2 elements. See the individual fields for the types contained.
10951 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
10952 /// The element at position 0
10953 pub a: crate::c_types::ThirtyTwoBytes,
10954 /// The element at position 1
10955 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
10957 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
10958 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
10965 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
10966 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
10970 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
10971 fn clone(&self) -> Self {
10973 a: Clone::clone(&self.a),
10974 b: Clone::clone(&self.b),
10979 /// Creates a new tuple which has the same data as `orig`
10980 /// but with all dynamically-allocated buffers duplicated in new buffers.
10981 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
10982 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
10984 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 {
10985 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
10989 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
10990 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
10992 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
10993 /// This corresponds to std::vector in C++
10994 pub struct CVec_TransactionOutputsZ {
10995 /// The elements in the array.
10996 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10997 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
10998 /// The number of elements pointed to by `data`.
11001 impl CVec_TransactionOutputsZ {
11002 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
11003 if self.datalen == 0 { return Vec::new(); }
11004 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11005 self.data = core::ptr::null_mut();
11009 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
11010 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11013 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11014 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11015 let datalen = v.len();
11016 let data = Box::into_raw(v.into_boxed_slice());
11017 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11021 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11022 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11023 impl Drop for CVec_TransactionOutputsZ {
11024 fn drop(&mut self) {
11025 if self.datalen == 0 { return; }
11026 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11029 impl Clone for CVec_TransactionOutputsZ {
11030 fn clone(&self) -> Self {
11031 let mut res = Vec::new();
11032 if self.datalen == 0 { return Self::from(res); }
11033 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11038 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11039 /// This corresponds to std::vector in C++
11040 pub struct CVec_BalanceZ {
11041 /// The elements in the array.
11042 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11043 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11044 /// The number of elements pointed to by `data`.
11047 impl CVec_BalanceZ {
11048 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11049 if self.datalen == 0 { return Vec::new(); }
11050 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11051 self.data = core::ptr::null_mut();
11055 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11056 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11059 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11060 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11061 let datalen = v.len();
11062 let data = Box::into_raw(v.into_boxed_slice());
11063 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11067 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11068 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11069 impl Drop for CVec_BalanceZ {
11070 fn drop(&mut self) {
11071 if self.datalen == 0 { return; }
11072 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11075 impl Clone for CVec_BalanceZ {
11076 fn clone(&self) -> Self {
11077 let mut res = Vec::new();
11078 if self.datalen == 0 { return Self::from(res); }
11079 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11084 /// A tuple of 2 elements. See the individual fields for the types contained.
11085 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11086 /// The element at position 0
11087 pub a: crate::c_types::ThirtyTwoBytes,
11088 /// The element at position 1
11089 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
11091 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11092 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
11099 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11100 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
11104 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11105 fn clone(&self) -> Self {
11107 a: Clone::clone(&self.a),
11108 b: Clone::clone(&self.b),
11113 /// Creates a new tuple which has the same data as `orig`
11114 /// but with all dynamically-allocated buffers duplicated in new buffers.
11115 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
11116 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
11118 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11119 C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
11123 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
11124 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
11126 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
11127 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11128 /// A pointer to the contents in the success state.
11129 /// Reading from this pointer when `result_ok` is not set is undefined.
11130 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
11131 /// A pointer to the contents in the error state.
11132 /// Reading from this pointer when `result_ok` is set is undefined.
11133 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11136 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11137 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11139 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11140 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
11141 /// `err` or `result` depending on the state of `result_ok`.
11142 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
11143 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
11144 pub result_ok: bool,
11147 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
11148 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11149 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11150 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11151 result: Box::into_raw(Box::new(o)),
11157 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
11158 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11159 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11160 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11161 err: Box::into_raw(Box::new(e)),
11166 /// Checks if the given object is currently in the success state
11168 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
11172 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
11173 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
11174 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11175 fn drop(&mut self) {
11176 if self.result_ok {
11177 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11178 let _ = unsafe { Box::from_raw(self.contents.result) };
11181 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11182 let _ = unsafe { Box::from_raw(self.contents.err) };
11187 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11188 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11189 let contents = if o.result_ok {
11190 let result = unsafe { o.contents.result };
11191 unsafe { o.contents.result = core::ptr::null_mut() };
11192 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
11194 let err = unsafe { o.contents.err };
11195 unsafe { o.contents.err = core::ptr::null_mut(); }
11196 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
11200 result_ok: o.result_ok,
11204 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11205 fn clone(&self) -> Self {
11206 if self.result_ok {
11207 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11208 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
11211 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11212 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11218 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
11219 /// but with all dynamically-allocated buffers duplicated in new buffers.
11220 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
11222 /// A tuple of 2 elements. See the individual fields for the types contained.
11223 pub struct C2Tuple_PublicKeyTypeZ {
11224 /// The element at position 0
11225 pub a: crate::c_types::PublicKey,
11226 /// The element at position 1
11227 pub b: crate::lightning::ln::wire::Type,
11229 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11230 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11237 impl C2Tuple_PublicKeyTypeZ {
11238 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11242 impl Clone for C2Tuple_PublicKeyTypeZ {
11243 fn clone(&self) -> Self {
11245 a: Clone::clone(&self.a),
11246 b: Clone::clone(&self.b),
11251 /// Creates a new tuple which has the same data as `orig`
11252 /// but with all dynamically-allocated buffers duplicated in new buffers.
11253 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
11254 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11256 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11257 C2Tuple_PublicKeyTypeZ { a, b, }
11261 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11262 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11264 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11265 /// This corresponds to std::vector in C++
11266 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11267 /// The elements in the array.
11268 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11269 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11270 /// The number of elements pointed to by `data`.
11273 impl CVec_C2Tuple_PublicKeyTypeZZ {
11274 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11275 if self.datalen == 0 { return Vec::new(); }
11276 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11277 self.data = core::ptr::null_mut();
11281 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11282 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11285 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11286 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11287 let datalen = v.len();
11288 let data = Box::into_raw(v.into_boxed_slice());
11289 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11293 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11294 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11295 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11296 fn drop(&mut self) {
11297 if self.datalen == 0 { return; }
11298 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11301 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
11302 fn clone(&self) -> Self {
11303 let mut res = Vec::new();
11304 if self.datalen == 0 { return Self::from(res); }
11305 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11311 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
11312 pub enum COption_OffersMessageZ {
11313 /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
11314 Some(crate::lightning::onion_message::offers::OffersMessage),
11315 /// When we're in this state, this COption_OffersMessageZ contains nothing
11318 impl COption_OffersMessageZ {
11319 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11320 if let Self::None = self { false } else { true }
11322 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11325 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
11326 if let Self::Some(v) = self { v } else { unreachable!() }
11330 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
11331 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
11332 COption_OffersMessageZ::Some(o)
11335 /// Constructs a new COption_OffersMessageZ containing nothing
11336 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
11337 COption_OffersMessageZ::None
11340 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
11341 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
11343 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
11344 /// but with all dynamically-allocated buffers duplicated in new buffers.
11345 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
11348 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
11349 pub enum COption_CustomOnionMessageContentsZ {
11350 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
11351 Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
11352 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
11355 impl COption_CustomOnionMessageContentsZ {
11356 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11357 if let Self::None = self { false } else { true }
11359 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11362 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
11363 if let Self::Some(v) = self { v } else { unreachable!() }
11367 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
11368 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
11369 COption_CustomOnionMessageContentsZ::Some(o)
11372 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
11373 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
11374 COption_CustomOnionMessageContentsZ::None
11377 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
11378 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
11380 /// Creates a new COption_CustomOnionMessageContentsZ which has the same data as `orig`
11381 /// but with all dynamically-allocated buffers duplicated in new buffers.
11382 pub extern "C" fn COption_CustomOnionMessageContentsZ_clone(orig: &COption_CustomOnionMessageContentsZ) -> COption_CustomOnionMessageContentsZ { Clone::clone(&orig) }
11384 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
11385 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11386 /// A pointer to the contents in the success state.
11387 /// Reading from this pointer when `result_ok` is not set is undefined.
11388 pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
11389 /// A pointer to the contents in the error state.
11390 /// Reading from this pointer when `result_ok` is set is undefined.
11391 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11394 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
11395 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11397 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11398 /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
11399 /// `err` or `result` depending on the state of `result_ok`.
11400 pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
11401 /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
11402 pub result_ok: bool,
11405 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
11406 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11407 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11408 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11409 result: Box::into_raw(Box::new(o)),
11415 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
11416 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11417 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11418 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11419 err: Box::into_raw(Box::new(e)),
11424 /// Checks if the given object is currently in the success state
11426 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
11430 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
11431 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
11432 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11433 fn drop(&mut self) {
11434 if self.result_ok {
11435 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11436 let _ = unsafe { Box::from_raw(self.contents.result) };
11439 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11440 let _ = unsafe { Box::from_raw(self.contents.err) };
11445 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11446 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11447 let contents = if o.result_ok {
11448 let result = unsafe { o.contents.result };
11449 unsafe { o.contents.result = core::ptr::null_mut() };
11450 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
11452 let err = unsafe { o.contents.err };
11453 unsafe { o.contents.err = core::ptr::null_mut(); }
11454 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
11458 result_ok: o.result_ok,
11462 impl Clone for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11463 fn clone(&self) -> Self {
11464 if self.result_ok {
11465 Self { result_ok: true, contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11466 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_CustomOnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
11469 Self { result_ok: false, contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11470 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11476 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ which has the same data as `orig`
11477 /// but with all dynamically-allocated buffers duplicated in new buffers.
11478 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
11481 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
11482 pub enum COption_TypeZ {
11483 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
11484 Some(crate::lightning::ln::wire::Type),
11485 /// When we're in this state, this COption_TypeZ contains nothing
11488 impl COption_TypeZ {
11489 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11490 if let Self::None = self { false } else { true }
11492 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11495 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
11496 if let Self::Some(v) = self { v } else { unreachable!() }
11500 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
11501 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
11502 COption_TypeZ::Some(o)
11505 /// Constructs a new COption_TypeZ containing nothing
11506 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
11507 COption_TypeZ::None
11510 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
11511 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
11513 /// Creates a new COption_TypeZ which has the same data as `orig`
11514 /// but with all dynamically-allocated buffers duplicated in new buffers.
11515 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
11517 /// The contents of CResult_COption_TypeZDecodeErrorZ
11518 pub union CResult_COption_TypeZDecodeErrorZPtr {
11519 /// A pointer to the contents in the success state.
11520 /// Reading from this pointer when `result_ok` is not set is undefined.
11521 pub result: *mut crate::c_types::derived::COption_TypeZ,
11522 /// A pointer to the contents in the error state.
11523 /// Reading from this pointer when `result_ok` is set is undefined.
11524 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11527 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
11528 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11529 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11530 pub struct CResult_COption_TypeZDecodeErrorZ {
11531 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
11532 /// `err` or `result` depending on the state of `result_ok`.
11533 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
11534 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
11535 pub result_ok: bool,
11538 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
11539 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
11540 CResult_COption_TypeZDecodeErrorZ {
11541 contents: CResult_COption_TypeZDecodeErrorZPtr {
11542 result: Box::into_raw(Box::new(o)),
11548 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
11549 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
11550 CResult_COption_TypeZDecodeErrorZ {
11551 contents: CResult_COption_TypeZDecodeErrorZPtr {
11552 err: Box::into_raw(Box::new(e)),
11557 /// Checks if the given object is currently in the success state
11559 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
11563 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
11564 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
11565 impl Drop for CResult_COption_TypeZDecodeErrorZ {
11566 fn drop(&mut self) {
11567 if self.result_ok {
11568 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11569 let _ = unsafe { Box::from_raw(self.contents.result) };
11572 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11573 let _ = unsafe { Box::from_raw(self.contents.err) };
11578 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
11579 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11580 let contents = if o.result_ok {
11581 let result = unsafe { o.contents.result };
11582 unsafe { o.contents.result = core::ptr::null_mut() };
11583 CResult_COption_TypeZDecodeErrorZPtr { result }
11585 let err = unsafe { o.contents.err };
11586 unsafe { o.contents.err = core::ptr::null_mut(); }
11587 CResult_COption_TypeZDecodeErrorZPtr { err }
11591 result_ok: o.result_ok,
11595 impl Clone for CResult_COption_TypeZDecodeErrorZ {
11596 fn clone(&self) -> Self {
11597 if self.result_ok {
11598 Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
11599 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
11602 Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
11603 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11609 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
11610 /// but with all dynamically-allocated buffers duplicated in new buffers.
11611 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
11614 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
11615 pub enum COption_SocketAddressZ {
11616 /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
11617 Some(crate::lightning::ln::msgs::SocketAddress),
11618 /// When we're in this state, this COption_SocketAddressZ contains nothing
11621 impl COption_SocketAddressZ {
11622 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11623 if let Self::None = self { false } else { true }
11625 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11628 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
11629 if let Self::Some(v) = self { v } else { unreachable!() }
11633 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
11634 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
11635 COption_SocketAddressZ::Some(o)
11638 /// Constructs a new COption_SocketAddressZ containing nothing
11639 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
11640 COption_SocketAddressZ::None
11643 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
11644 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
11646 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
11647 /// but with all dynamically-allocated buffers duplicated in new buffers.
11648 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
11650 /// A tuple of 2 elements. See the individual fields for the types contained.
11651 pub struct C2Tuple_PublicKeyCOption_SocketAddressZZ {
11652 /// The element at position 0
11653 pub a: crate::c_types::PublicKey,
11654 /// The element at position 1
11655 pub b: crate::c_types::derived::COption_SocketAddressZ,
11657 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)> for C2Tuple_PublicKeyCOption_SocketAddressZZ {
11658 fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)) -> Self {
11665 impl C2Tuple_PublicKeyCOption_SocketAddressZZ {
11666 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ) {
11670 impl Clone for C2Tuple_PublicKeyCOption_SocketAddressZZ {
11671 fn clone(&self) -> Self {
11673 a: Clone::clone(&self.a),
11674 b: Clone::clone(&self.b),
11679 /// Creates a new tuple which has the same data as `orig`
11680 /// but with all dynamically-allocated buffers duplicated in new buffers.
11681 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_SocketAddressZZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ { Clone::clone(&orig) }
11682 /// Creates a new C2Tuple_PublicKeyCOption_SocketAddressZZ from the contained elements.
11684 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_SocketAddressZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ {
11685 C2Tuple_PublicKeyCOption_SocketAddressZZ { a, b, }
11689 /// Frees any resources used by the C2Tuple_PublicKeyCOption_SocketAddressZZ.
11690 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCOption_SocketAddressZZ) { }
11692 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZs of arbitrary size.
11693 /// This corresponds to std::vector in C++
11694 pub struct CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
11695 /// The elements in the array.
11696 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11697 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ,
11698 /// The number of elements pointed to by `data`.
11701 impl CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
11702 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ> {
11703 if self.datalen == 0 { return Vec::new(); }
11704 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11705 self.data = core::ptr::null_mut();
11709 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ] {
11710 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11713 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
11714 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>) -> Self {
11715 let datalen = v.len();
11716 let data = Box::into_raw(v.into_boxed_slice());
11717 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11721 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11722 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ) { }
11723 impl Drop for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
11724 fn drop(&mut self) {
11725 if self.datalen == 0 { return; }
11726 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11729 impl Clone for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
11730 fn clone(&self) -> Self {
11731 let mut res = Vec::new();
11732 if self.datalen == 0 { return Self::from(res); }
11733 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11738 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11739 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11740 /// A pointer to the contents in the success state.
11741 /// Reading from this pointer when `result_ok` is not set is undefined.
11742 pub result: *mut crate::c_types::derived::CVec_u8Z,
11743 /// A pointer to the contents in the error state.
11744 /// Reading from this pointer when `result_ok` is set is undefined.
11745 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11748 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11749 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11751 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11752 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11753 /// `err` or `result` depending on the state of `result_ok`.
11754 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11755 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11756 pub result_ok: bool,
11759 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11760 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11761 CResult_CVec_u8ZPeerHandleErrorZ {
11762 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11763 result: Box::into_raw(Box::new(o)),
11769 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11770 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11771 CResult_CVec_u8ZPeerHandleErrorZ {
11772 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11773 err: Box::into_raw(Box::new(e)),
11778 /// Checks if the given object is currently in the success state
11780 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11784 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11785 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11786 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11787 fn drop(&mut self) {
11788 if self.result_ok {
11789 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11790 let _ = unsafe { Box::from_raw(self.contents.result) };
11793 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11794 let _ = unsafe { Box::from_raw(self.contents.err) };
11799 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11800 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11801 let contents = if o.result_ok {
11802 let result = unsafe { o.contents.result };
11803 unsafe { o.contents.result = core::ptr::null_mut() };
11804 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11806 let err = unsafe { o.contents.err };
11807 unsafe { o.contents.err = core::ptr::null_mut(); }
11808 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11812 result_ok: o.result_ok,
11816 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11817 fn clone(&self) -> Self {
11818 if self.result_ok {
11819 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11820 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11823 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11824 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11830 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11831 /// but with all dynamically-allocated buffers duplicated in new buffers.
11832 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11834 /// The contents of CResult_NonePeerHandleErrorZ
11835 pub union CResult_NonePeerHandleErrorZPtr {
11836 /// Note that this value is always NULL, as there are no contents in the OK variant
11837 pub result: *mut core::ffi::c_void,
11838 /// A pointer to the contents in the error state.
11839 /// Reading from this pointer when `result_ok` is set is undefined.
11840 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11843 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11844 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11845 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11846 pub struct CResult_NonePeerHandleErrorZ {
11847 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11848 /// `err` or `result` depending on the state of `result_ok`.
11849 pub contents: CResult_NonePeerHandleErrorZPtr,
11850 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11851 pub result_ok: bool,
11854 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11855 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11856 CResult_NonePeerHandleErrorZ {
11857 contents: CResult_NonePeerHandleErrorZPtr {
11858 result: core::ptr::null_mut(),
11864 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11865 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11866 CResult_NonePeerHandleErrorZ {
11867 contents: CResult_NonePeerHandleErrorZPtr {
11868 err: Box::into_raw(Box::new(e)),
11873 /// Checks if the given object is currently in the success state
11875 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11879 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11880 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11881 impl Drop for CResult_NonePeerHandleErrorZ {
11882 fn drop(&mut self) {
11883 if self.result_ok {
11885 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11886 let _ = unsafe { Box::from_raw(self.contents.err) };
11891 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11892 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11893 let contents = if o.result_ok {
11894 let _ = unsafe { Box::from_raw(o.contents.result) };
11895 o.contents.result = core::ptr::null_mut();
11896 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11898 let err = unsafe { o.contents.err };
11899 unsafe { o.contents.err = core::ptr::null_mut(); }
11900 CResult_NonePeerHandleErrorZPtr { err }
11904 result_ok: o.result_ok,
11908 impl Clone for CResult_NonePeerHandleErrorZ {
11909 fn clone(&self) -> Self {
11910 if self.result_ok {
11911 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11912 result: core::ptr::null_mut()
11915 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11916 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11922 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11923 /// but with all dynamically-allocated buffers duplicated in new buffers.
11924 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11926 /// The contents of CResult_boolPeerHandleErrorZ
11927 pub union CResult_boolPeerHandleErrorZPtr {
11928 /// A pointer to the contents in the success state.
11929 /// Reading from this pointer when `result_ok` is not set is undefined.
11930 pub result: *mut bool,
11931 /// A pointer to the contents in the error state.
11932 /// Reading from this pointer when `result_ok` is set is undefined.
11933 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11936 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11937 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11939 pub struct CResult_boolPeerHandleErrorZ {
11940 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11941 /// `err` or `result` depending on the state of `result_ok`.
11942 pub contents: CResult_boolPeerHandleErrorZPtr,
11943 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11944 pub result_ok: bool,
11947 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11948 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11949 CResult_boolPeerHandleErrorZ {
11950 contents: CResult_boolPeerHandleErrorZPtr {
11951 result: Box::into_raw(Box::new(o)),
11957 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11958 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
11959 CResult_boolPeerHandleErrorZ {
11960 contents: CResult_boolPeerHandleErrorZPtr {
11961 err: Box::into_raw(Box::new(e)),
11966 /// Checks if the given object is currently in the success state
11968 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
11972 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
11973 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
11974 impl Drop for CResult_boolPeerHandleErrorZ {
11975 fn drop(&mut self) {
11976 if self.result_ok {
11977 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11978 let _ = unsafe { Box::from_raw(self.contents.result) };
11981 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11982 let _ = unsafe { Box::from_raw(self.contents.err) };
11987 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
11988 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11989 let contents = if o.result_ok {
11990 let result = unsafe { o.contents.result };
11991 unsafe { o.contents.result = core::ptr::null_mut() };
11992 CResult_boolPeerHandleErrorZPtr { result }
11994 let err = unsafe { o.contents.err };
11995 unsafe { o.contents.err = core::ptr::null_mut(); }
11996 CResult_boolPeerHandleErrorZPtr { err }
12000 result_ok: o.result_ok,
12004 impl Clone for CResult_boolPeerHandleErrorZ {
12005 fn clone(&self) -> Self {
12006 if self.result_ok {
12007 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12008 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12011 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12012 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12018 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12019 /// but with all dynamically-allocated buffers duplicated in new buffers.
12020 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12022 /// The contents of CResult_u32GraphSyncErrorZ
12023 pub union CResult_u32GraphSyncErrorZPtr {
12024 /// A pointer to the contents in the success state.
12025 /// Reading from this pointer when `result_ok` is not set is undefined.
12026 pub result: *mut u32,
12027 /// A pointer to the contents in the error state.
12028 /// Reading from this pointer when `result_ok` is set is undefined.
12029 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12032 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12033 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12035 pub struct CResult_u32GraphSyncErrorZ {
12036 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12037 /// `err` or `result` depending on the state of `result_ok`.
12038 pub contents: CResult_u32GraphSyncErrorZPtr,
12039 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12040 pub result_ok: bool,
12043 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12044 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12045 CResult_u32GraphSyncErrorZ {
12046 contents: CResult_u32GraphSyncErrorZPtr {
12047 result: Box::into_raw(Box::new(o)),
12053 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12054 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12055 CResult_u32GraphSyncErrorZ {
12056 contents: CResult_u32GraphSyncErrorZPtr {
12057 err: Box::into_raw(Box::new(e)),
12062 /// Checks if the given object is currently in the success state
12064 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12068 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12069 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12070 impl Drop for CResult_u32GraphSyncErrorZ {
12071 fn drop(&mut self) {
12072 if self.result_ok {
12073 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12074 let _ = unsafe { Box::from_raw(self.contents.result) };
12077 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12078 let _ = unsafe { Box::from_raw(self.contents.err) };
12083 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12084 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12085 let contents = if o.result_ok {
12086 let result = unsafe { o.contents.result };
12087 unsafe { o.contents.result = core::ptr::null_mut() };
12088 CResult_u32GraphSyncErrorZPtr { result }
12090 let err = unsafe { o.contents.err };
12091 unsafe { o.contents.err = core::ptr::null_mut(); }
12092 CResult_u32GraphSyncErrorZPtr { err }
12096 result_ok: o.result_ok,
12101 /// The contents of CResult_CVec_u8ZIOErrorZ
12102 pub union CResult_CVec_u8ZIOErrorZPtr {
12103 /// A pointer to the contents in the success state.
12104 /// Reading from this pointer when `result_ok` is not set is undefined.
12105 pub result: *mut crate::c_types::derived::CVec_u8Z,
12106 /// A pointer to the contents in the error state.
12107 /// Reading from this pointer when `result_ok` is set is undefined.
12108 pub err: *mut crate::c_types::IOError,
12111 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
12112 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
12113 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12114 pub struct CResult_CVec_u8ZIOErrorZ {
12115 /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
12116 /// `err` or `result` depending on the state of `result_ok`.
12117 pub contents: CResult_CVec_u8ZIOErrorZPtr,
12118 /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
12119 pub result_ok: bool,
12122 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
12123 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
12124 CResult_CVec_u8ZIOErrorZ {
12125 contents: CResult_CVec_u8ZIOErrorZPtr {
12126 result: Box::into_raw(Box::new(o)),
12132 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
12133 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
12134 CResult_CVec_u8ZIOErrorZ {
12135 contents: CResult_CVec_u8ZIOErrorZPtr {
12136 err: Box::into_raw(Box::new(e)),
12141 /// Checks if the given object is currently in the success state
12143 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
12147 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
12148 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
12149 impl Drop for CResult_CVec_u8ZIOErrorZ {
12150 fn drop(&mut self) {
12151 if self.result_ok {
12152 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12153 let _ = unsafe { Box::from_raw(self.contents.result) };
12156 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12157 let _ = unsafe { Box::from_raw(self.contents.err) };
12162 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
12163 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
12164 let contents = if o.result_ok {
12165 let result = unsafe { o.contents.result };
12166 unsafe { o.contents.result = core::ptr::null_mut() };
12167 CResult_CVec_u8ZIOErrorZPtr { result }
12169 let err = unsafe { o.contents.err };
12170 unsafe { o.contents.err = core::ptr::null_mut(); }
12171 CResult_CVec_u8ZIOErrorZPtr { err }
12175 result_ok: o.result_ok,
12179 impl Clone for CResult_CVec_u8ZIOErrorZ {
12180 fn clone(&self) -> Self {
12181 if self.result_ok {
12182 Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
12183 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12186 Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
12187 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12193 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
12194 /// but with all dynamically-allocated buffers duplicated in new buffers.
12195 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
12197 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
12198 /// This corresponds to std::vector in C++
12199 pub struct CVec_StrZ {
12200 /// The elements in the array.
12201 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12202 pub data: *mut crate::c_types::Str,
12203 /// The number of elements pointed to by `data`.
12207 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
12208 if self.datalen == 0 { return Vec::new(); }
12209 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12210 self.data = core::ptr::null_mut();
12214 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
12215 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12218 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
12219 fn from(v: Vec<crate::c_types::Str>) -> Self {
12220 let datalen = v.len();
12221 let data = Box::into_raw(v.into_boxed_slice());
12222 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12226 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12227 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
12228 impl Drop for CVec_StrZ {
12229 fn drop(&mut self) {
12230 if self.datalen == 0 { return; }
12231 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12234 impl Clone for CVec_StrZ {
12235 fn clone(&self) -> Self {
12236 let mut res = Vec::new();
12237 if self.datalen == 0 { return Self::from(res); }
12238 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12243 /// The contents of CResult_CVec_StrZIOErrorZ
12244 pub union CResult_CVec_StrZIOErrorZPtr {
12245 /// A pointer to the contents in the success state.
12246 /// Reading from this pointer when `result_ok` is not set is undefined.
12247 pub result: *mut crate::c_types::derived::CVec_StrZ,
12248 /// A pointer to the contents in the error state.
12249 /// Reading from this pointer when `result_ok` is set is undefined.
12250 pub err: *mut crate::c_types::IOError,
12253 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
12254 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
12255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12256 pub struct CResult_CVec_StrZIOErrorZ {
12257 /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
12258 /// `err` or `result` depending on the state of `result_ok`.
12259 pub contents: CResult_CVec_StrZIOErrorZPtr,
12260 /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
12261 pub result_ok: bool,
12264 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
12265 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
12266 CResult_CVec_StrZIOErrorZ {
12267 contents: CResult_CVec_StrZIOErrorZPtr {
12268 result: Box::into_raw(Box::new(o)),
12274 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
12275 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
12276 CResult_CVec_StrZIOErrorZ {
12277 contents: CResult_CVec_StrZIOErrorZPtr {
12278 err: Box::into_raw(Box::new(e)),
12283 /// Checks if the given object is currently in the success state
12285 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
12289 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
12290 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
12291 impl Drop for CResult_CVec_StrZIOErrorZ {
12292 fn drop(&mut self) {
12293 if self.result_ok {
12294 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12295 let _ = unsafe { Box::from_raw(self.contents.result) };
12298 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12299 let _ = unsafe { Box::from_raw(self.contents.err) };
12304 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
12305 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
12306 let contents = if o.result_ok {
12307 let result = unsafe { o.contents.result };
12308 unsafe { o.contents.result = core::ptr::null_mut() };
12309 CResult_CVec_StrZIOErrorZPtr { result }
12311 let err = unsafe { o.contents.err };
12312 unsafe { o.contents.err = core::ptr::null_mut(); }
12313 CResult_CVec_StrZIOErrorZPtr { err }
12317 result_ok: o.result_ok,
12321 impl Clone for CResult_CVec_StrZIOErrorZ {
12322 fn clone(&self) -> Self {
12323 if self.result_ok {
12324 Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
12325 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
12328 Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
12329 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12335 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
12336 /// but with all dynamically-allocated buffers duplicated in new buffers.
12337 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
12339 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
12340 /// This corresponds to std::vector in C++
12341 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12342 /// The elements in the array.
12343 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12344 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12345 /// The number of elements pointed to by `data`.
12348 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12349 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
12350 if self.datalen == 0 { return Vec::new(); }
12351 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12352 self.data = core::ptr::null_mut();
12356 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
12357 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12360 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12361 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
12362 let datalen = v.len();
12363 let data = Box::into_raw(v.into_boxed_slice());
12364 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12368 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12369 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
12370 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12371 fn drop(&mut self) {
12372 if self.datalen == 0 { return; }
12373 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12376 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12377 fn clone(&self) -> Self {
12378 let mut res = Vec::new();
12379 if self.datalen == 0 { return Self::from(res); }
12380 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12385 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
12386 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12387 /// A pointer to the contents in the success state.
12388 /// Reading from this pointer when `result_ok` is not set is undefined.
12389 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
12390 /// A pointer to the contents in the error state.
12391 /// Reading from this pointer when `result_ok` is set is undefined.
12392 pub err: *mut crate::c_types::IOError,
12395 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
12396 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
12397 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12398 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12399 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
12400 /// `err` or `result` depending on the state of `result_ok`.
12401 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
12402 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
12403 pub result_ok: bool,
12406 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
12407 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12408 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12409 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12410 result: Box::into_raw(Box::new(o)),
12416 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
12417 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12418 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12419 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12420 err: Box::into_raw(Box::new(e)),
12425 /// Checks if the given object is currently in the success state
12427 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
12431 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
12432 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
12433 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12434 fn drop(&mut self) {
12435 if self.result_ok {
12436 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12437 let _ = unsafe { Box::from_raw(self.contents.result) };
12440 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12441 let _ = unsafe { Box::from_raw(self.contents.err) };
12446 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12447 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> Self {
12448 let contents = if o.result_ok {
12449 let result = unsafe { o.contents.result };
12450 unsafe { o.contents.result = core::ptr::null_mut() };
12451 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
12453 let err = unsafe { o.contents.err };
12454 unsafe { o.contents.err = core::ptr::null_mut(); }
12455 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
12459 result_ok: o.result_ok,
12463 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12464 fn clone(&self) -> Self {
12465 if self.result_ok {
12466 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12467 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
12470 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12471 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12477 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
12478 /// but with all dynamically-allocated buffers duplicated in new buffers.
12479 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
12481 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
12482 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12483 /// A pointer to the contents in the success state.
12484 /// Reading from this pointer when `result_ok` is not set is undefined.
12485 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12486 /// A pointer to the contents in the error state.
12487 /// Reading from this pointer when `result_ok` is set is undefined.
12488 pub err: *mut crate::c_types::IOError,
12491 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
12492 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
12493 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12494 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12495 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
12496 /// `err` or `result` depending on the state of `result_ok`.
12497 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
12498 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
12499 pub result_ok: bool,
12502 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
12503 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12504 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12505 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12506 result: Box::into_raw(Box::new(o)),
12512 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
12513 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12514 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12515 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12516 err: Box::into_raw(Box::new(e)),
12521 /// Checks if the given object is currently in the success state
12523 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
12527 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
12528 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
12529 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12530 fn drop(&mut self) {
12531 if self.result_ok {
12532 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12533 let _ = unsafe { Box::from_raw(self.contents.result) };
12536 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12537 let _ = unsafe { Box::from_raw(self.contents.err) };
12542 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12543 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
12544 let contents = if o.result_ok {
12545 let result = unsafe { o.contents.result };
12546 unsafe { o.contents.result = core::ptr::null_mut() };
12547 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
12549 let err = unsafe { o.contents.err };
12550 unsafe { o.contents.err = core::ptr::null_mut(); }
12551 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
12555 result_ok: o.result_ok,
12559 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12560 fn clone(&self) -> Self {
12561 if self.result_ok {
12562 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12563 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
12566 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12567 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12573 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
12574 /// but with all dynamically-allocated buffers duplicated in new buffers.
12575 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
12578 /// An enum which can either contain a crate::c_types::SecretKey or not
12579 pub enum COption_SecretKeyZ {
12580 /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
12581 Some(crate::c_types::SecretKey),
12582 /// When we're in this state, this COption_SecretKeyZ contains nothing
12585 impl COption_SecretKeyZ {
12586 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12587 if let Self::None = self { false } else { true }
12589 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12592 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
12593 if let Self::Some(v) = self { v } else { unreachable!() }
12597 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
12598 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
12599 COption_SecretKeyZ::Some(o)
12602 /// Constructs a new COption_SecretKeyZ containing nothing
12603 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
12604 COption_SecretKeyZ::None
12607 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
12608 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
12610 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
12611 /// but with all dynamically-allocated buffers duplicated in new buffers.
12612 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
12614 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
12615 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
12616 /// A pointer to the contents in the success state.
12617 /// Reading from this pointer when `result_ok` is not set is undefined.
12618 pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
12619 /// Note that this value is always NULL, as there are no contents in the Err variant
12620 pub err: *mut core::ffi::c_void,
12623 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
12624 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
12625 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12626 pub struct CResult_VerifiedInvoiceRequestNoneZ {
12627 /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
12628 /// `err` or `result` depending on the state of `result_ok`.
12629 pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
12630 /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
12631 pub result_ok: bool,
12634 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
12635 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
12636 CResult_VerifiedInvoiceRequestNoneZ {
12637 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12638 result: Box::into_raw(Box::new(o)),
12644 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
12645 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
12646 CResult_VerifiedInvoiceRequestNoneZ {
12647 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12648 err: core::ptr::null_mut(),
12653 /// Checks if the given object is currently in the success state
12655 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
12659 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
12660 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
12661 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
12662 fn drop(&mut self) {
12663 if self.result_ok {
12664 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12665 let _ = unsafe { Box::from_raw(self.contents.result) };
12671 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
12672 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
12673 let contents = if o.result_ok {
12674 let result = unsafe { o.contents.result };
12675 unsafe { o.contents.result = core::ptr::null_mut() };
12676 CResult_VerifiedInvoiceRequestNoneZPtr { result }
12678 let _ = unsafe { Box::from_raw(o.contents.err) };
12679 o.contents.err = core::ptr::null_mut();
12680 CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
12684 result_ok: o.result_ok,
12688 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
12689 fn clone(&self) -> Self {
12690 if self.result_ok {
12691 Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12692 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
12695 Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12696 err: core::ptr::null_mut()
12702 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
12703 /// but with all dynamically-allocated buffers duplicated in new buffers.
12704 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
12706 /// An enum which can either contain a or not
12707 pub enum COption_NoneZ {
12708 /// When we're in this state, this COption_NoneZ contains a
12710 /// When we're in this state, this COption_NoneZ contains nothing
12713 impl COption_NoneZ {
12714 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12715 if let Self::None = self { false } else { true }
12717 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12722 /// Constructs a new COption_NoneZ containing a
12723 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
12724 COption_NoneZ::Some
12727 /// Constructs a new COption_NoneZ containing nothing
12728 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
12729 COption_NoneZ::None
12732 /// Frees any resources associated with the , if we are in the Some state
12733 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
12735 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
12736 /// This corresponds to std::vector in C++
12737 pub struct CVec_WitnessZ {
12738 /// The elements in the array.
12739 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12740 pub data: *mut crate::c_types::Witness,
12741 /// The number of elements pointed to by `data`.
12744 impl CVec_WitnessZ {
12745 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
12746 if self.datalen == 0 { return Vec::new(); }
12747 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12748 self.data = core::ptr::null_mut();
12752 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
12753 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12756 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
12757 fn from(v: Vec<crate::c_types::Witness>) -> Self {
12758 let datalen = v.len();
12759 let data = Box::into_raw(v.into_boxed_slice());
12760 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12764 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12765 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
12766 impl Drop for CVec_WitnessZ {
12767 fn drop(&mut self) {
12768 if self.datalen == 0 { return; }
12769 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12772 impl Clone for CVec_WitnessZ {
12773 fn clone(&self) -> Self {
12774 let mut res = Vec::new();
12775 if self.datalen == 0 { return Self::from(res); }
12776 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12782 /// An enum which can either contain a i64 or not
12783 pub enum COption_i64Z {
12784 /// When we're in this state, this COption_i64Z contains a i64
12786 /// When we're in this state, this COption_i64Z contains nothing
12789 impl COption_i64Z {
12790 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12791 if let Self::None = self { false } else { true }
12793 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12796 #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
12797 if let Self::Some(v) = self { v } else { unreachable!() }
12801 /// Constructs a new COption_i64Z containing a i64
12802 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
12803 COption_i64Z::Some(o)
12806 /// Constructs a new COption_i64Z containing nothing
12807 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
12811 /// Frees any resources associated with the i64, if we are in the Some state
12812 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
12814 /// Creates a new COption_i64Z which has the same data as `orig`
12815 /// but with all dynamically-allocated buffers duplicated in new buffers.
12816 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
12818 /// The contents of CResult_SocketAddressDecodeErrorZ
12819 pub union CResult_SocketAddressDecodeErrorZPtr {
12820 /// A pointer to the contents in the success state.
12821 /// Reading from this pointer when `result_ok` is not set is undefined.
12822 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
12823 /// A pointer to the contents in the error state.
12824 /// Reading from this pointer when `result_ok` is set is undefined.
12825 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12828 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
12829 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
12830 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12831 pub struct CResult_SocketAddressDecodeErrorZ {
12832 /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
12833 /// `err` or `result` depending on the state of `result_ok`.
12834 pub contents: CResult_SocketAddressDecodeErrorZPtr,
12835 /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
12836 pub result_ok: bool,
12839 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
12840 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
12841 CResult_SocketAddressDecodeErrorZ {
12842 contents: CResult_SocketAddressDecodeErrorZPtr {
12843 result: Box::into_raw(Box::new(o)),
12849 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
12850 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
12851 CResult_SocketAddressDecodeErrorZ {
12852 contents: CResult_SocketAddressDecodeErrorZPtr {
12853 err: Box::into_raw(Box::new(e)),
12858 /// Checks if the given object is currently in the success state
12860 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
12864 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
12865 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
12866 impl Drop for CResult_SocketAddressDecodeErrorZ {
12867 fn drop(&mut self) {
12868 if self.result_ok {
12869 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12870 let _ = unsafe { Box::from_raw(self.contents.result) };
12873 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12874 let _ = unsafe { Box::from_raw(self.contents.err) };
12879 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
12880 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
12881 let contents = if o.result_ok {
12882 let result = unsafe { o.contents.result };
12883 unsafe { o.contents.result = core::ptr::null_mut() };
12884 CResult_SocketAddressDecodeErrorZPtr { result }
12886 let err = unsafe { o.contents.err };
12887 unsafe { o.contents.err = core::ptr::null_mut(); }
12888 CResult_SocketAddressDecodeErrorZPtr { err }
12892 result_ok: o.result_ok,
12896 impl Clone for CResult_SocketAddressDecodeErrorZ {
12897 fn clone(&self) -> Self {
12898 if self.result_ok {
12899 Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
12900 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
12903 Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
12904 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12910 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
12911 /// but with all dynamically-allocated buffers duplicated in new buffers.
12912 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
12914 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
12915 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
12916 /// A pointer to the contents in the success state.
12917 /// Reading from this pointer when `result_ok` is not set is undefined.
12918 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
12919 /// A pointer to the contents in the error state.
12920 /// Reading from this pointer when `result_ok` is set is undefined.
12921 pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
12924 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
12925 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
12926 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12927 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
12928 /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
12929 /// `err` or `result` depending on the state of `result_ok`.
12930 pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
12931 /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
12932 pub result_ok: bool,
12935 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
12936 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
12937 CResult_SocketAddressSocketAddressParseErrorZ {
12938 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
12939 result: Box::into_raw(Box::new(o)),
12945 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
12946 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
12947 CResult_SocketAddressSocketAddressParseErrorZ {
12948 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
12949 err: Box::into_raw(Box::new(e)),
12954 /// Checks if the given object is currently in the success state
12956 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
12960 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
12961 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
12962 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
12963 fn drop(&mut self) {
12964 if self.result_ok {
12965 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12966 let _ = unsafe { Box::from_raw(self.contents.result) };
12969 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12970 let _ = unsafe { Box::from_raw(self.contents.err) };
12975 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
12976 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
12977 let contents = if o.result_ok {
12978 let result = unsafe { o.contents.result };
12979 unsafe { o.contents.result = core::ptr::null_mut() };
12980 CResult_SocketAddressSocketAddressParseErrorZPtr { result }
12982 let err = unsafe { o.contents.err };
12983 unsafe { o.contents.err = core::ptr::null_mut(); }
12984 CResult_SocketAddressSocketAddressParseErrorZPtr { err }
12988 result_ok: o.result_ok,
12992 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
12993 fn clone(&self) -> Self {
12994 if self.result_ok {
12995 Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
12996 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
12999 Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
13000 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
13006 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
13007 /// but with all dynamically-allocated buffers duplicated in new buffers.
13008 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
13010 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
13011 /// This corresponds to std::vector in C++
13012 pub struct CVec_UpdateAddHTLCZ {
13013 /// The elements in the array.
13014 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13015 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13016 /// The number of elements pointed to by `data`.
13019 impl CVec_UpdateAddHTLCZ {
13020 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
13021 if self.datalen == 0 { return Vec::new(); }
13022 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13023 self.data = core::ptr::null_mut();
13027 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
13028 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13031 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
13032 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
13033 let datalen = v.len();
13034 let data = Box::into_raw(v.into_boxed_slice());
13035 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13039 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13040 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
13041 impl Drop for CVec_UpdateAddHTLCZ {
13042 fn drop(&mut self) {
13043 if self.datalen == 0 { return; }
13044 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13047 impl Clone for CVec_UpdateAddHTLCZ {
13048 fn clone(&self) -> Self {
13049 let mut res = Vec::new();
13050 if self.datalen == 0 { return Self::from(res); }
13051 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13056 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
13057 /// This corresponds to std::vector in C++
13058 pub struct CVec_UpdateFulfillHTLCZ {
13059 /// The elements in the array.
13060 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13061 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13062 /// The number of elements pointed to by `data`.
13065 impl CVec_UpdateFulfillHTLCZ {
13066 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
13067 if self.datalen == 0 { return Vec::new(); }
13068 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13069 self.data = core::ptr::null_mut();
13073 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
13074 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13077 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
13078 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
13079 let datalen = v.len();
13080 let data = Box::into_raw(v.into_boxed_slice());
13081 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13085 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13086 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
13087 impl Drop for CVec_UpdateFulfillHTLCZ {
13088 fn drop(&mut self) {
13089 if self.datalen == 0 { return; }
13090 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13093 impl Clone for CVec_UpdateFulfillHTLCZ {
13094 fn clone(&self) -> Self {
13095 let mut res = Vec::new();
13096 if self.datalen == 0 { return Self::from(res); }
13097 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13102 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
13103 /// This corresponds to std::vector in C++
13104 pub struct CVec_UpdateFailHTLCZ {
13105 /// The elements in the array.
13106 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13107 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13108 /// The number of elements pointed to by `data`.
13111 impl CVec_UpdateFailHTLCZ {
13112 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
13113 if self.datalen == 0 { return Vec::new(); }
13114 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13115 self.data = core::ptr::null_mut();
13119 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
13120 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13123 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
13124 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
13125 let datalen = v.len();
13126 let data = Box::into_raw(v.into_boxed_slice());
13127 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13131 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13132 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
13133 impl Drop for CVec_UpdateFailHTLCZ {
13134 fn drop(&mut self) {
13135 if self.datalen == 0 { return; }
13136 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13139 impl Clone for CVec_UpdateFailHTLCZ {
13140 fn clone(&self) -> Self {
13141 let mut res = Vec::new();
13142 if self.datalen == 0 { return Self::from(res); }
13143 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13148 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
13149 /// This corresponds to std::vector in C++
13150 pub struct CVec_UpdateFailMalformedHTLCZ {
13151 /// The elements in the array.
13152 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13153 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13154 /// The number of elements pointed to by `data`.
13157 impl CVec_UpdateFailMalformedHTLCZ {
13158 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
13159 if self.datalen == 0 { return Vec::new(); }
13160 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13161 self.data = core::ptr::null_mut();
13165 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
13166 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13169 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
13170 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
13171 let datalen = v.len();
13172 let data = Box::into_raw(v.into_boxed_slice());
13173 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13177 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13178 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
13179 impl Drop for CVec_UpdateFailMalformedHTLCZ {
13180 fn drop(&mut self) {
13181 if self.datalen == 0 { return; }
13182 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13185 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13186 fn clone(&self) -> Self {
13187 let mut res = Vec::new();
13188 if self.datalen == 0 { return Self::from(res); }
13189 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13194 /// The contents of CResult_AcceptChannelDecodeErrorZ
13195 pub union CResult_AcceptChannelDecodeErrorZPtr {
13196 /// A pointer to the contents in the success state.
13197 /// Reading from this pointer when `result_ok` is not set is undefined.
13198 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13199 /// A pointer to the contents in the error state.
13200 /// Reading from this pointer when `result_ok` is set is undefined.
13201 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13204 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13205 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13207 pub struct CResult_AcceptChannelDecodeErrorZ {
13208 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13209 /// `err` or `result` depending on the state of `result_ok`.
13210 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13211 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13212 pub result_ok: bool,
13215 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13216 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13217 CResult_AcceptChannelDecodeErrorZ {
13218 contents: CResult_AcceptChannelDecodeErrorZPtr {
13219 result: Box::into_raw(Box::new(o)),
13225 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13226 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13227 CResult_AcceptChannelDecodeErrorZ {
13228 contents: CResult_AcceptChannelDecodeErrorZPtr {
13229 err: Box::into_raw(Box::new(e)),
13234 /// Checks if the given object is currently in the success state
13236 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13240 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13241 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13242 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13243 fn drop(&mut self) {
13244 if self.result_ok {
13245 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13246 let _ = unsafe { Box::from_raw(self.contents.result) };
13249 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13250 let _ = unsafe { Box::from_raw(self.contents.err) };
13255 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13256 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13257 let contents = if o.result_ok {
13258 let result = unsafe { o.contents.result };
13259 unsafe { o.contents.result = core::ptr::null_mut() };
13260 CResult_AcceptChannelDecodeErrorZPtr { result }
13262 let err = unsafe { o.contents.err };
13263 unsafe { o.contents.err = core::ptr::null_mut(); }
13264 CResult_AcceptChannelDecodeErrorZPtr { err }
13268 result_ok: o.result_ok,
13272 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13273 fn clone(&self) -> Self {
13274 if self.result_ok {
13275 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13276 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13279 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13280 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13286 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13287 /// but with all dynamically-allocated buffers duplicated in new buffers.
13288 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13290 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
13291 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
13292 /// A pointer to the contents in the success state.
13293 /// Reading from this pointer when `result_ok` is not set is undefined.
13294 pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
13295 /// A pointer to the contents in the error state.
13296 /// Reading from this pointer when `result_ok` is set is undefined.
13297 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13300 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
13301 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
13302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13303 pub struct CResult_AcceptChannelV2DecodeErrorZ {
13304 /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
13305 /// `err` or `result` depending on the state of `result_ok`.
13306 pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
13307 /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
13308 pub result_ok: bool,
13311 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
13312 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
13313 CResult_AcceptChannelV2DecodeErrorZ {
13314 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13315 result: Box::into_raw(Box::new(o)),
13321 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
13322 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
13323 CResult_AcceptChannelV2DecodeErrorZ {
13324 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13325 err: Box::into_raw(Box::new(e)),
13330 /// Checks if the given object is currently in the success state
13332 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
13336 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
13337 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
13338 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
13339 fn drop(&mut self) {
13340 if self.result_ok {
13341 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13342 let _ = unsafe { Box::from_raw(self.contents.result) };
13345 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13346 let _ = unsafe { Box::from_raw(self.contents.err) };
13351 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
13352 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
13353 let contents = if o.result_ok {
13354 let result = unsafe { o.contents.result };
13355 unsafe { o.contents.result = core::ptr::null_mut() };
13356 CResult_AcceptChannelV2DecodeErrorZPtr { result }
13358 let err = unsafe { o.contents.err };
13359 unsafe { o.contents.err = core::ptr::null_mut(); }
13360 CResult_AcceptChannelV2DecodeErrorZPtr { err }
13364 result_ok: o.result_ok,
13368 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
13369 fn clone(&self) -> Self {
13370 if self.result_ok {
13371 Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13372 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
13375 Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13376 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13382 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
13383 /// but with all dynamically-allocated buffers duplicated in new buffers.
13384 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
13386 /// The contents of CResult_TxAddInputDecodeErrorZ
13387 pub union CResult_TxAddInputDecodeErrorZPtr {
13388 /// A pointer to the contents in the success state.
13389 /// Reading from this pointer when `result_ok` is not set is undefined.
13390 pub result: *mut crate::lightning::ln::msgs::TxAddInput,
13391 /// A pointer to the contents in the error state.
13392 /// Reading from this pointer when `result_ok` is set is undefined.
13393 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13396 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
13397 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13399 pub struct CResult_TxAddInputDecodeErrorZ {
13400 /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
13401 /// `err` or `result` depending on the state of `result_ok`.
13402 pub contents: CResult_TxAddInputDecodeErrorZPtr,
13403 /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
13404 pub result_ok: bool,
13407 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
13408 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
13409 CResult_TxAddInputDecodeErrorZ {
13410 contents: CResult_TxAddInputDecodeErrorZPtr {
13411 result: Box::into_raw(Box::new(o)),
13417 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
13418 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
13419 CResult_TxAddInputDecodeErrorZ {
13420 contents: CResult_TxAddInputDecodeErrorZPtr {
13421 err: Box::into_raw(Box::new(e)),
13426 /// Checks if the given object is currently in the success state
13428 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
13432 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
13433 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
13434 impl Drop for CResult_TxAddInputDecodeErrorZ {
13435 fn drop(&mut self) {
13436 if self.result_ok {
13437 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13438 let _ = unsafe { Box::from_raw(self.contents.result) };
13441 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13442 let _ = unsafe { Box::from_raw(self.contents.err) };
13447 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
13448 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13449 let contents = if o.result_ok {
13450 let result = unsafe { o.contents.result };
13451 unsafe { o.contents.result = core::ptr::null_mut() };
13452 CResult_TxAddInputDecodeErrorZPtr { result }
13454 let err = unsafe { o.contents.err };
13455 unsafe { o.contents.err = core::ptr::null_mut(); }
13456 CResult_TxAddInputDecodeErrorZPtr { err }
13460 result_ok: o.result_ok,
13464 impl Clone for CResult_TxAddInputDecodeErrorZ {
13465 fn clone(&self) -> Self {
13466 if self.result_ok {
13467 Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
13468 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
13471 Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
13472 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13478 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
13479 /// but with all dynamically-allocated buffers duplicated in new buffers.
13480 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
13482 /// The contents of CResult_TxAddOutputDecodeErrorZ
13483 pub union CResult_TxAddOutputDecodeErrorZPtr {
13484 /// A pointer to the contents in the success state.
13485 /// Reading from this pointer when `result_ok` is not set is undefined.
13486 pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
13487 /// A pointer to the contents in the error state.
13488 /// Reading from this pointer when `result_ok` is set is undefined.
13489 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13492 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
13493 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13495 pub struct CResult_TxAddOutputDecodeErrorZ {
13496 /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
13497 /// `err` or `result` depending on the state of `result_ok`.
13498 pub contents: CResult_TxAddOutputDecodeErrorZPtr,
13499 /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
13500 pub result_ok: bool,
13503 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
13504 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
13505 CResult_TxAddOutputDecodeErrorZ {
13506 contents: CResult_TxAddOutputDecodeErrorZPtr {
13507 result: Box::into_raw(Box::new(o)),
13513 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
13514 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
13515 CResult_TxAddOutputDecodeErrorZ {
13516 contents: CResult_TxAddOutputDecodeErrorZPtr {
13517 err: Box::into_raw(Box::new(e)),
13522 /// Checks if the given object is currently in the success state
13524 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
13528 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
13529 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
13530 impl Drop for CResult_TxAddOutputDecodeErrorZ {
13531 fn drop(&mut self) {
13532 if self.result_ok {
13533 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13534 let _ = unsafe { Box::from_raw(self.contents.result) };
13537 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13538 let _ = unsafe { Box::from_raw(self.contents.err) };
13543 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
13544 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13545 let contents = if o.result_ok {
13546 let result = unsafe { o.contents.result };
13547 unsafe { o.contents.result = core::ptr::null_mut() };
13548 CResult_TxAddOutputDecodeErrorZPtr { result }
13550 let err = unsafe { o.contents.err };
13551 unsafe { o.contents.err = core::ptr::null_mut(); }
13552 CResult_TxAddOutputDecodeErrorZPtr { err }
13556 result_ok: o.result_ok,
13560 impl Clone for CResult_TxAddOutputDecodeErrorZ {
13561 fn clone(&self) -> Self {
13562 if self.result_ok {
13563 Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
13564 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
13567 Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
13568 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13574 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
13575 /// but with all dynamically-allocated buffers duplicated in new buffers.
13576 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
13578 /// The contents of CResult_TxRemoveInputDecodeErrorZ
13579 pub union CResult_TxRemoveInputDecodeErrorZPtr {
13580 /// A pointer to the contents in the success state.
13581 /// Reading from this pointer when `result_ok` is not set is undefined.
13582 pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
13583 /// A pointer to the contents in the error state.
13584 /// Reading from this pointer when `result_ok` is set is undefined.
13585 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13588 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
13589 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13591 pub struct CResult_TxRemoveInputDecodeErrorZ {
13592 /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
13593 /// `err` or `result` depending on the state of `result_ok`.
13594 pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
13595 /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
13596 pub result_ok: bool,
13599 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
13600 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
13601 CResult_TxRemoveInputDecodeErrorZ {
13602 contents: CResult_TxRemoveInputDecodeErrorZPtr {
13603 result: Box::into_raw(Box::new(o)),
13609 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
13610 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
13611 CResult_TxRemoveInputDecodeErrorZ {
13612 contents: CResult_TxRemoveInputDecodeErrorZPtr {
13613 err: Box::into_raw(Box::new(e)),
13618 /// Checks if the given object is currently in the success state
13620 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
13624 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
13625 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
13626 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
13627 fn drop(&mut self) {
13628 if self.result_ok {
13629 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13630 let _ = unsafe { Box::from_raw(self.contents.result) };
13633 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13634 let _ = unsafe { Box::from_raw(self.contents.err) };
13639 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
13640 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13641 let contents = if o.result_ok {
13642 let result = unsafe { o.contents.result };
13643 unsafe { o.contents.result = core::ptr::null_mut() };
13644 CResult_TxRemoveInputDecodeErrorZPtr { result }
13646 let err = unsafe { o.contents.err };
13647 unsafe { o.contents.err = core::ptr::null_mut(); }
13648 CResult_TxRemoveInputDecodeErrorZPtr { err }
13652 result_ok: o.result_ok,
13656 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
13657 fn clone(&self) -> Self {
13658 if self.result_ok {
13659 Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
13660 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
13663 Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
13664 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13670 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
13671 /// but with all dynamically-allocated buffers duplicated in new buffers.
13672 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
13674 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
13675 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
13676 /// A pointer to the contents in the success state.
13677 /// Reading from this pointer when `result_ok` is not set is undefined.
13678 pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
13679 /// A pointer to the contents in the error state.
13680 /// Reading from this pointer when `result_ok` is set is undefined.
13681 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13684 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
13685 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13687 pub struct CResult_TxRemoveOutputDecodeErrorZ {
13688 /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
13689 /// `err` or `result` depending on the state of `result_ok`.
13690 pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
13691 /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
13692 pub result_ok: bool,
13695 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
13696 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
13697 CResult_TxRemoveOutputDecodeErrorZ {
13698 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
13699 result: Box::into_raw(Box::new(o)),
13705 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
13706 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
13707 CResult_TxRemoveOutputDecodeErrorZ {
13708 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
13709 err: Box::into_raw(Box::new(e)),
13714 /// Checks if the given object is currently in the success state
13716 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
13720 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
13721 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
13722 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
13723 fn drop(&mut self) {
13724 if self.result_ok {
13725 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13726 let _ = unsafe { Box::from_raw(self.contents.result) };
13729 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13730 let _ = unsafe { Box::from_raw(self.contents.err) };
13735 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
13736 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13737 let contents = if o.result_ok {
13738 let result = unsafe { o.contents.result };
13739 unsafe { o.contents.result = core::ptr::null_mut() };
13740 CResult_TxRemoveOutputDecodeErrorZPtr { result }
13742 let err = unsafe { o.contents.err };
13743 unsafe { o.contents.err = core::ptr::null_mut(); }
13744 CResult_TxRemoveOutputDecodeErrorZPtr { err }
13748 result_ok: o.result_ok,
13752 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
13753 fn clone(&self) -> Self {
13754 if self.result_ok {
13755 Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
13756 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
13759 Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
13760 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13766 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
13767 /// but with all dynamically-allocated buffers duplicated in new buffers.
13768 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
13770 /// The contents of CResult_TxCompleteDecodeErrorZ
13771 pub union CResult_TxCompleteDecodeErrorZPtr {
13772 /// A pointer to the contents in the success state.
13773 /// Reading from this pointer when `result_ok` is not set is undefined.
13774 pub result: *mut crate::lightning::ln::msgs::TxComplete,
13775 /// A pointer to the contents in the error state.
13776 /// Reading from this pointer when `result_ok` is set is undefined.
13777 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13780 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
13781 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
13782 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13783 pub struct CResult_TxCompleteDecodeErrorZ {
13784 /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
13785 /// `err` or `result` depending on the state of `result_ok`.
13786 pub contents: CResult_TxCompleteDecodeErrorZPtr,
13787 /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
13788 pub result_ok: bool,
13791 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
13792 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
13793 CResult_TxCompleteDecodeErrorZ {
13794 contents: CResult_TxCompleteDecodeErrorZPtr {
13795 result: Box::into_raw(Box::new(o)),
13801 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
13802 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
13803 CResult_TxCompleteDecodeErrorZ {
13804 contents: CResult_TxCompleteDecodeErrorZPtr {
13805 err: Box::into_raw(Box::new(e)),
13810 /// Checks if the given object is currently in the success state
13812 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
13816 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
13817 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
13818 impl Drop for CResult_TxCompleteDecodeErrorZ {
13819 fn drop(&mut self) {
13820 if self.result_ok {
13821 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13822 let _ = unsafe { Box::from_raw(self.contents.result) };
13825 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13826 let _ = unsafe { Box::from_raw(self.contents.err) };
13831 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
13832 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
13833 let contents = if o.result_ok {
13834 let result = unsafe { o.contents.result };
13835 unsafe { o.contents.result = core::ptr::null_mut() };
13836 CResult_TxCompleteDecodeErrorZPtr { result }
13838 let err = unsafe { o.contents.err };
13839 unsafe { o.contents.err = core::ptr::null_mut(); }
13840 CResult_TxCompleteDecodeErrorZPtr { err }
13844 result_ok: o.result_ok,
13848 impl Clone for CResult_TxCompleteDecodeErrorZ {
13849 fn clone(&self) -> Self {
13850 if self.result_ok {
13851 Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
13852 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
13855 Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
13856 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13862 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
13863 /// but with all dynamically-allocated buffers duplicated in new buffers.
13864 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
13866 /// The contents of CResult_TxSignaturesDecodeErrorZ
13867 pub union CResult_TxSignaturesDecodeErrorZPtr {
13868 /// A pointer to the contents in the success state.
13869 /// Reading from this pointer when `result_ok` is not set is undefined.
13870 pub result: *mut crate::lightning::ln::msgs::TxSignatures,
13871 /// A pointer to the contents in the error state.
13872 /// Reading from this pointer when `result_ok` is set is undefined.
13873 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13876 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
13877 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13879 pub struct CResult_TxSignaturesDecodeErrorZ {
13880 /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
13881 /// `err` or `result` depending on the state of `result_ok`.
13882 pub contents: CResult_TxSignaturesDecodeErrorZPtr,
13883 /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
13884 pub result_ok: bool,
13887 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
13888 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
13889 CResult_TxSignaturesDecodeErrorZ {
13890 contents: CResult_TxSignaturesDecodeErrorZPtr {
13891 result: Box::into_raw(Box::new(o)),
13897 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
13898 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
13899 CResult_TxSignaturesDecodeErrorZ {
13900 contents: CResult_TxSignaturesDecodeErrorZPtr {
13901 err: Box::into_raw(Box::new(e)),
13906 /// Checks if the given object is currently in the success state
13908 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
13912 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
13913 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
13914 impl Drop for CResult_TxSignaturesDecodeErrorZ {
13915 fn drop(&mut self) {
13916 if self.result_ok {
13917 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13918 let _ = unsafe { Box::from_raw(self.contents.result) };
13921 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13922 let _ = unsafe { Box::from_raw(self.contents.err) };
13927 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
13928 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13929 let contents = if o.result_ok {
13930 let result = unsafe { o.contents.result };
13931 unsafe { o.contents.result = core::ptr::null_mut() };
13932 CResult_TxSignaturesDecodeErrorZPtr { result }
13934 let err = unsafe { o.contents.err };
13935 unsafe { o.contents.err = core::ptr::null_mut(); }
13936 CResult_TxSignaturesDecodeErrorZPtr { err }
13940 result_ok: o.result_ok,
13944 impl Clone for CResult_TxSignaturesDecodeErrorZ {
13945 fn clone(&self) -> Self {
13946 if self.result_ok {
13947 Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
13948 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
13951 Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
13952 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13958 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
13959 /// but with all dynamically-allocated buffers duplicated in new buffers.
13960 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
13962 /// The contents of CResult_TxInitRbfDecodeErrorZ
13963 pub union CResult_TxInitRbfDecodeErrorZPtr {
13964 /// A pointer to the contents in the success state.
13965 /// Reading from this pointer when `result_ok` is not set is undefined.
13966 pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
13967 /// A pointer to the contents in the error state.
13968 /// Reading from this pointer when `result_ok` is set is undefined.
13969 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13972 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
13973 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
13974 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13975 pub struct CResult_TxInitRbfDecodeErrorZ {
13976 /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
13977 /// `err` or `result` depending on the state of `result_ok`.
13978 pub contents: CResult_TxInitRbfDecodeErrorZPtr,
13979 /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
13980 pub result_ok: bool,
13983 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
13984 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
13985 CResult_TxInitRbfDecodeErrorZ {
13986 contents: CResult_TxInitRbfDecodeErrorZPtr {
13987 result: Box::into_raw(Box::new(o)),
13993 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
13994 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
13995 CResult_TxInitRbfDecodeErrorZ {
13996 contents: CResult_TxInitRbfDecodeErrorZPtr {
13997 err: Box::into_raw(Box::new(e)),
14002 /// Checks if the given object is currently in the success state
14004 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
14008 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
14009 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
14010 impl Drop for CResult_TxInitRbfDecodeErrorZ {
14011 fn drop(&mut self) {
14012 if self.result_ok {
14013 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14014 let _ = unsafe { Box::from_raw(self.contents.result) };
14017 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14018 let _ = unsafe { Box::from_raw(self.contents.err) };
14023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
14024 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
14025 let contents = if o.result_ok {
14026 let result = unsafe { o.contents.result };
14027 unsafe { o.contents.result = core::ptr::null_mut() };
14028 CResult_TxInitRbfDecodeErrorZPtr { result }
14030 let err = unsafe { o.contents.err };
14031 unsafe { o.contents.err = core::ptr::null_mut(); }
14032 CResult_TxInitRbfDecodeErrorZPtr { err }
14036 result_ok: o.result_ok,
14040 impl Clone for CResult_TxInitRbfDecodeErrorZ {
14041 fn clone(&self) -> Self {
14042 if self.result_ok {
14043 Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
14044 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
14047 Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
14048 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14054 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
14055 /// but with all dynamically-allocated buffers duplicated in new buffers.
14056 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
14058 /// The contents of CResult_TxAckRbfDecodeErrorZ
14059 pub union CResult_TxAckRbfDecodeErrorZPtr {
14060 /// A pointer to the contents in the success state.
14061 /// Reading from this pointer when `result_ok` is not set is undefined.
14062 pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
14063 /// A pointer to the contents in the error state.
14064 /// Reading from this pointer when `result_ok` is set is undefined.
14065 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14068 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
14069 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
14070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14071 pub struct CResult_TxAckRbfDecodeErrorZ {
14072 /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
14073 /// `err` or `result` depending on the state of `result_ok`.
14074 pub contents: CResult_TxAckRbfDecodeErrorZPtr,
14075 /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
14076 pub result_ok: bool,
14079 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
14080 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
14081 CResult_TxAckRbfDecodeErrorZ {
14082 contents: CResult_TxAckRbfDecodeErrorZPtr {
14083 result: Box::into_raw(Box::new(o)),
14089 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
14090 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
14091 CResult_TxAckRbfDecodeErrorZ {
14092 contents: CResult_TxAckRbfDecodeErrorZPtr {
14093 err: Box::into_raw(Box::new(e)),
14098 /// Checks if the given object is currently in the success state
14100 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
14104 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
14105 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
14106 impl Drop for CResult_TxAckRbfDecodeErrorZ {
14107 fn drop(&mut self) {
14108 if self.result_ok {
14109 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14110 let _ = unsafe { Box::from_raw(self.contents.result) };
14113 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14114 let _ = unsafe { Box::from_raw(self.contents.err) };
14119 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
14120 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
14121 let contents = if o.result_ok {
14122 let result = unsafe { o.contents.result };
14123 unsafe { o.contents.result = core::ptr::null_mut() };
14124 CResult_TxAckRbfDecodeErrorZPtr { result }
14126 let err = unsafe { o.contents.err };
14127 unsafe { o.contents.err = core::ptr::null_mut(); }
14128 CResult_TxAckRbfDecodeErrorZPtr { err }
14132 result_ok: o.result_ok,
14136 impl Clone for CResult_TxAckRbfDecodeErrorZ {
14137 fn clone(&self) -> Self {
14138 if self.result_ok {
14139 Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
14140 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
14143 Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
14144 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14150 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
14151 /// but with all dynamically-allocated buffers duplicated in new buffers.
14152 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
14154 /// The contents of CResult_TxAbortDecodeErrorZ
14155 pub union CResult_TxAbortDecodeErrorZPtr {
14156 /// A pointer to the contents in the success state.
14157 /// Reading from this pointer when `result_ok` is not set is undefined.
14158 pub result: *mut crate::lightning::ln::msgs::TxAbort,
14159 /// A pointer to the contents in the error state.
14160 /// Reading from this pointer when `result_ok` is set is undefined.
14161 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14164 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
14165 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
14166 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14167 pub struct CResult_TxAbortDecodeErrorZ {
14168 /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
14169 /// `err` or `result` depending on the state of `result_ok`.
14170 pub contents: CResult_TxAbortDecodeErrorZPtr,
14171 /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
14172 pub result_ok: bool,
14175 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
14176 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
14177 CResult_TxAbortDecodeErrorZ {
14178 contents: CResult_TxAbortDecodeErrorZPtr {
14179 result: Box::into_raw(Box::new(o)),
14185 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
14186 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
14187 CResult_TxAbortDecodeErrorZ {
14188 contents: CResult_TxAbortDecodeErrorZPtr {
14189 err: Box::into_raw(Box::new(e)),
14194 /// Checks if the given object is currently in the success state
14196 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
14200 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
14201 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
14202 impl Drop for CResult_TxAbortDecodeErrorZ {
14203 fn drop(&mut self) {
14204 if self.result_ok {
14205 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14206 let _ = unsafe { Box::from_raw(self.contents.result) };
14209 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14210 let _ = unsafe { Box::from_raw(self.contents.err) };
14215 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
14216 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
14217 let contents = if o.result_ok {
14218 let result = unsafe { o.contents.result };
14219 unsafe { o.contents.result = core::ptr::null_mut() };
14220 CResult_TxAbortDecodeErrorZPtr { result }
14222 let err = unsafe { o.contents.err };
14223 unsafe { o.contents.err = core::ptr::null_mut(); }
14224 CResult_TxAbortDecodeErrorZPtr { err }
14228 result_ok: o.result_ok,
14232 impl Clone for CResult_TxAbortDecodeErrorZ {
14233 fn clone(&self) -> Self {
14234 if self.result_ok {
14235 Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
14236 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
14239 Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
14240 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14246 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
14247 /// but with all dynamically-allocated buffers duplicated in new buffers.
14248 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
14250 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
14251 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
14252 /// A pointer to the contents in the success state.
14253 /// Reading from this pointer when `result_ok` is not set is undefined.
14254 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
14255 /// A pointer to the contents in the error state.
14256 /// Reading from this pointer when `result_ok` is set is undefined.
14257 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14260 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
14261 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
14262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14263 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
14264 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
14265 /// `err` or `result` depending on the state of `result_ok`.
14266 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
14267 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
14268 pub result_ok: bool,
14271 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
14272 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14273 CResult_AnnouncementSignaturesDecodeErrorZ {
14274 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14275 result: Box::into_raw(Box::new(o)),
14281 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
14282 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14283 CResult_AnnouncementSignaturesDecodeErrorZ {
14284 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14285 err: Box::into_raw(Box::new(e)),
14290 /// Checks if the given object is currently in the success state
14292 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
14296 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
14297 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
14298 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
14299 fn drop(&mut self) {
14300 if self.result_ok {
14301 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14302 let _ = unsafe { Box::from_raw(self.contents.result) };
14305 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14306 let _ = unsafe { Box::from_raw(self.contents.err) };
14311 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
14312 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
14313 let contents = if o.result_ok {
14314 let result = unsafe { o.contents.result };
14315 unsafe { o.contents.result = core::ptr::null_mut() };
14316 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
14318 let err = unsafe { o.contents.err };
14319 unsafe { o.contents.err = core::ptr::null_mut(); }
14320 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
14324 result_ok: o.result_ok,
14328 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
14329 fn clone(&self) -> Self {
14330 if self.result_ok {
14331 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14332 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
14335 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14336 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14342 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
14343 /// but with all dynamically-allocated buffers duplicated in new buffers.
14344 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
14346 /// The contents of CResult_ChannelReestablishDecodeErrorZ
14347 pub union CResult_ChannelReestablishDecodeErrorZPtr {
14348 /// A pointer to the contents in the success state.
14349 /// Reading from this pointer when `result_ok` is not set is undefined.
14350 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
14351 /// A pointer to the contents in the error state.
14352 /// Reading from this pointer when `result_ok` is set is undefined.
14353 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14356 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
14357 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
14358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14359 pub struct CResult_ChannelReestablishDecodeErrorZ {
14360 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
14361 /// `err` or `result` depending on the state of `result_ok`.
14362 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
14363 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
14364 pub result_ok: bool,
14367 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
14368 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
14369 CResult_ChannelReestablishDecodeErrorZ {
14370 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14371 result: Box::into_raw(Box::new(o)),
14377 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
14378 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
14379 CResult_ChannelReestablishDecodeErrorZ {
14380 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14381 err: Box::into_raw(Box::new(e)),
14386 /// Checks if the given object is currently in the success state
14388 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
14392 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
14393 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
14394 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
14395 fn drop(&mut self) {
14396 if self.result_ok {
14397 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14398 let _ = unsafe { Box::from_raw(self.contents.result) };
14401 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14402 let _ = unsafe { Box::from_raw(self.contents.err) };
14407 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
14408 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
14409 let contents = if o.result_ok {
14410 let result = unsafe { o.contents.result };
14411 unsafe { o.contents.result = core::ptr::null_mut() };
14412 CResult_ChannelReestablishDecodeErrorZPtr { result }
14414 let err = unsafe { o.contents.err };
14415 unsafe { o.contents.err = core::ptr::null_mut(); }
14416 CResult_ChannelReestablishDecodeErrorZPtr { err }
14420 result_ok: o.result_ok,
14424 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
14425 fn clone(&self) -> Self {
14426 if self.result_ok {
14427 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14428 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
14431 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14432 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14438 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14439 /// but with all dynamically-allocated buffers duplicated in new buffers.
14440 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
14442 /// The contents of CResult_ClosingSignedDecodeErrorZ
14443 pub union CResult_ClosingSignedDecodeErrorZPtr {
14444 /// A pointer to the contents in the success state.
14445 /// Reading from this pointer when `result_ok` is not set is undefined.
14446 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
14447 /// A pointer to the contents in the error state.
14448 /// Reading from this pointer when `result_ok` is set is undefined.
14449 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14452 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
14453 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14454 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14455 pub struct CResult_ClosingSignedDecodeErrorZ {
14456 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
14457 /// `err` or `result` depending on the state of `result_ok`.
14458 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
14459 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
14460 pub result_ok: bool,
14463 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14464 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
14465 CResult_ClosingSignedDecodeErrorZ {
14466 contents: CResult_ClosingSignedDecodeErrorZPtr {
14467 result: Box::into_raw(Box::new(o)),
14473 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14474 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
14475 CResult_ClosingSignedDecodeErrorZ {
14476 contents: CResult_ClosingSignedDecodeErrorZPtr {
14477 err: Box::into_raw(Box::new(e)),
14482 /// Checks if the given object is currently in the success state
14484 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
14488 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14489 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
14490 impl Drop for CResult_ClosingSignedDecodeErrorZ {
14491 fn drop(&mut self) {
14492 if self.result_ok {
14493 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14494 let _ = unsafe { Box::from_raw(self.contents.result) };
14497 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14498 let _ = unsafe { Box::from_raw(self.contents.err) };
14503 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
14504 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14505 let contents = if o.result_ok {
14506 let result = unsafe { o.contents.result };
14507 unsafe { o.contents.result = core::ptr::null_mut() };
14508 CResult_ClosingSignedDecodeErrorZPtr { result }
14510 let err = unsafe { o.contents.err };
14511 unsafe { o.contents.err = core::ptr::null_mut(); }
14512 CResult_ClosingSignedDecodeErrorZPtr { err }
14516 result_ok: o.result_ok,
14520 impl Clone for CResult_ClosingSignedDecodeErrorZ {
14521 fn clone(&self) -> Self {
14522 if self.result_ok {
14523 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
14524 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
14527 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
14528 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14534 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14535 /// but with all dynamically-allocated buffers duplicated in new buffers.
14536 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
14538 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
14539 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14540 /// A pointer to the contents in the success state.
14541 /// Reading from this pointer when `result_ok` is not set is undefined.
14542 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
14543 /// A pointer to the contents in the error state.
14544 /// Reading from this pointer when `result_ok` is set is undefined.
14545 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14548 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
14549 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14551 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
14552 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
14553 /// `err` or `result` depending on the state of `result_ok`.
14554 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
14555 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
14556 pub result_ok: bool,
14559 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14560 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14561 CResult_ClosingSignedFeeRangeDecodeErrorZ {
14562 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14563 result: Box::into_raw(Box::new(o)),
14569 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14570 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14571 CResult_ClosingSignedFeeRangeDecodeErrorZ {
14572 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14573 err: Box::into_raw(Box::new(e)),
14578 /// Checks if the given object is currently in the success state
14580 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
14584 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14585 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
14586 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14587 fn drop(&mut self) {
14588 if self.result_ok {
14589 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14590 let _ = unsafe { Box::from_raw(self.contents.result) };
14593 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14594 let _ = unsafe { Box::from_raw(self.contents.err) };
14599 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14600 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14601 let contents = if o.result_ok {
14602 let result = unsafe { o.contents.result };
14603 unsafe { o.contents.result = core::ptr::null_mut() };
14604 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
14606 let err = unsafe { o.contents.err };
14607 unsafe { o.contents.err = core::ptr::null_mut(); }
14608 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
14612 result_ok: o.result_ok,
14616 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14617 fn clone(&self) -> Self {
14618 if self.result_ok {
14619 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14620 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
14623 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14624 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14630 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
14631 /// but with all dynamically-allocated buffers duplicated in new buffers.
14632 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
14634 /// The contents of CResult_CommitmentSignedDecodeErrorZ
14635 pub union CResult_CommitmentSignedDecodeErrorZPtr {
14636 /// A pointer to the contents in the success state.
14637 /// Reading from this pointer when `result_ok` is not set is undefined.
14638 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
14639 /// A pointer to the contents in the error state.
14640 /// Reading from this pointer when `result_ok` is set is undefined.
14641 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14644 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
14645 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14646 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14647 pub struct CResult_CommitmentSignedDecodeErrorZ {
14648 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
14649 /// `err` or `result` depending on the state of `result_ok`.
14650 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
14651 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
14652 pub result_ok: bool,
14655 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
14656 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
14657 CResult_CommitmentSignedDecodeErrorZ {
14658 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14659 result: Box::into_raw(Box::new(o)),
14665 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
14666 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
14667 CResult_CommitmentSignedDecodeErrorZ {
14668 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14669 err: Box::into_raw(Box::new(e)),
14674 /// Checks if the given object is currently in the success state
14676 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
14680 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
14681 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
14682 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
14683 fn drop(&mut self) {
14684 if self.result_ok {
14685 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14686 let _ = unsafe { Box::from_raw(self.contents.result) };
14689 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14690 let _ = unsafe { Box::from_raw(self.contents.err) };
14695 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
14696 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14697 let contents = if o.result_ok {
14698 let result = unsafe { o.contents.result };
14699 unsafe { o.contents.result = core::ptr::null_mut() };
14700 CResult_CommitmentSignedDecodeErrorZPtr { result }
14702 let err = unsafe { o.contents.err };
14703 unsafe { o.contents.err = core::ptr::null_mut(); }
14704 CResult_CommitmentSignedDecodeErrorZPtr { err }
14708 result_ok: o.result_ok,
14712 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
14713 fn clone(&self) -> Self {
14714 if self.result_ok {
14715 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
14716 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
14719 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
14720 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14726 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
14727 /// but with all dynamically-allocated buffers duplicated in new buffers.
14728 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
14730 /// The contents of CResult_FundingCreatedDecodeErrorZ
14731 pub union CResult_FundingCreatedDecodeErrorZPtr {
14732 /// A pointer to the contents in the success state.
14733 /// Reading from this pointer when `result_ok` is not set is undefined.
14734 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
14735 /// A pointer to the contents in the error state.
14736 /// Reading from this pointer when `result_ok` is set is undefined.
14737 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14740 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
14741 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
14742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14743 pub struct CResult_FundingCreatedDecodeErrorZ {
14744 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
14745 /// `err` or `result` depending on the state of `result_ok`.
14746 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
14747 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
14748 pub result_ok: bool,
14751 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
14752 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
14753 CResult_FundingCreatedDecodeErrorZ {
14754 contents: CResult_FundingCreatedDecodeErrorZPtr {
14755 result: Box::into_raw(Box::new(o)),
14761 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
14762 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
14763 CResult_FundingCreatedDecodeErrorZ {
14764 contents: CResult_FundingCreatedDecodeErrorZPtr {
14765 err: Box::into_raw(Box::new(e)),
14770 /// Checks if the given object is currently in the success state
14772 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
14776 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
14777 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
14778 impl Drop for CResult_FundingCreatedDecodeErrorZ {
14779 fn drop(&mut self) {
14780 if self.result_ok {
14781 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14782 let _ = unsafe { Box::from_raw(self.contents.result) };
14785 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14786 let _ = unsafe { Box::from_raw(self.contents.err) };
14791 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
14792 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
14793 let contents = if o.result_ok {
14794 let result = unsafe { o.contents.result };
14795 unsafe { o.contents.result = core::ptr::null_mut() };
14796 CResult_FundingCreatedDecodeErrorZPtr { result }
14798 let err = unsafe { o.contents.err };
14799 unsafe { o.contents.err = core::ptr::null_mut(); }
14800 CResult_FundingCreatedDecodeErrorZPtr { err }
14804 result_ok: o.result_ok,
14808 impl Clone for CResult_FundingCreatedDecodeErrorZ {
14809 fn clone(&self) -> Self {
14810 if self.result_ok {
14811 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
14812 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
14815 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
14816 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14822 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
14823 /// but with all dynamically-allocated buffers duplicated in new buffers.
14824 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
14826 /// The contents of CResult_FundingSignedDecodeErrorZ
14827 pub union CResult_FundingSignedDecodeErrorZPtr {
14828 /// A pointer to the contents in the success state.
14829 /// Reading from this pointer when `result_ok` is not set is undefined.
14830 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
14831 /// A pointer to the contents in the error state.
14832 /// Reading from this pointer when `result_ok` is set is undefined.
14833 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14836 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
14837 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14839 pub struct CResult_FundingSignedDecodeErrorZ {
14840 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
14841 /// `err` or `result` depending on the state of `result_ok`.
14842 pub contents: CResult_FundingSignedDecodeErrorZPtr,
14843 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
14844 pub result_ok: bool,
14847 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
14848 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
14849 CResult_FundingSignedDecodeErrorZ {
14850 contents: CResult_FundingSignedDecodeErrorZPtr {
14851 result: Box::into_raw(Box::new(o)),
14857 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
14858 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
14859 CResult_FundingSignedDecodeErrorZ {
14860 contents: CResult_FundingSignedDecodeErrorZPtr {
14861 err: Box::into_raw(Box::new(e)),
14866 /// Checks if the given object is currently in the success state
14868 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
14872 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
14873 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
14874 impl Drop for CResult_FundingSignedDecodeErrorZ {
14875 fn drop(&mut self) {
14876 if self.result_ok {
14877 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14878 let _ = unsafe { Box::from_raw(self.contents.result) };
14881 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14882 let _ = unsafe { Box::from_raw(self.contents.err) };
14887 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
14888 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14889 let contents = if o.result_ok {
14890 let result = unsafe { o.contents.result };
14891 unsafe { o.contents.result = core::ptr::null_mut() };
14892 CResult_FundingSignedDecodeErrorZPtr { result }
14894 let err = unsafe { o.contents.err };
14895 unsafe { o.contents.err = core::ptr::null_mut(); }
14896 CResult_FundingSignedDecodeErrorZPtr { err }
14900 result_ok: o.result_ok,
14904 impl Clone for CResult_FundingSignedDecodeErrorZ {
14905 fn clone(&self) -> Self {
14906 if self.result_ok {
14907 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
14908 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
14911 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
14912 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14918 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
14919 /// but with all dynamically-allocated buffers duplicated in new buffers.
14920 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
14922 /// The contents of CResult_ChannelReadyDecodeErrorZ
14923 pub union CResult_ChannelReadyDecodeErrorZPtr {
14924 /// A pointer to the contents in the success state.
14925 /// Reading from this pointer when `result_ok` is not set is undefined.
14926 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
14927 /// A pointer to the contents in the error state.
14928 /// Reading from this pointer when `result_ok` is set is undefined.
14929 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14932 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
14933 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
14934 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14935 pub struct CResult_ChannelReadyDecodeErrorZ {
14936 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
14937 /// `err` or `result` depending on the state of `result_ok`.
14938 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
14939 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
14940 pub result_ok: bool,
14943 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
14944 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
14945 CResult_ChannelReadyDecodeErrorZ {
14946 contents: CResult_ChannelReadyDecodeErrorZPtr {
14947 result: Box::into_raw(Box::new(o)),
14953 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
14954 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
14955 CResult_ChannelReadyDecodeErrorZ {
14956 contents: CResult_ChannelReadyDecodeErrorZPtr {
14957 err: Box::into_raw(Box::new(e)),
14962 /// Checks if the given object is currently in the success state
14964 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
14968 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
14969 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
14970 impl Drop for CResult_ChannelReadyDecodeErrorZ {
14971 fn drop(&mut self) {
14972 if self.result_ok {
14973 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14974 let _ = unsafe { Box::from_raw(self.contents.result) };
14977 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14978 let _ = unsafe { Box::from_raw(self.contents.err) };
14983 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
14984 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
14985 let contents = if o.result_ok {
14986 let result = unsafe { o.contents.result };
14987 unsafe { o.contents.result = core::ptr::null_mut() };
14988 CResult_ChannelReadyDecodeErrorZPtr { result }
14990 let err = unsafe { o.contents.err };
14991 unsafe { o.contents.err = core::ptr::null_mut(); }
14992 CResult_ChannelReadyDecodeErrorZPtr { err }
14996 result_ok: o.result_ok,
15000 impl Clone for CResult_ChannelReadyDecodeErrorZ {
15001 fn clone(&self) -> Self {
15002 if self.result_ok {
15003 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
15004 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
15007 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
15008 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15014 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
15015 /// but with all dynamically-allocated buffers duplicated in new buffers.
15016 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
15018 /// The contents of CResult_InitDecodeErrorZ
15019 pub union CResult_InitDecodeErrorZPtr {
15020 /// A pointer to the contents in the success state.
15021 /// Reading from this pointer when `result_ok` is not set is undefined.
15022 pub result: *mut crate::lightning::ln::msgs::Init,
15023 /// A pointer to the contents in the error state.
15024 /// Reading from this pointer when `result_ok` is set is undefined.
15025 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15028 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
15029 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
15030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15031 pub struct CResult_InitDecodeErrorZ {
15032 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
15033 /// `err` or `result` depending on the state of `result_ok`.
15034 pub contents: CResult_InitDecodeErrorZPtr,
15035 /// Whether this CResult_InitDecodeErrorZ represents a success state.
15036 pub result_ok: bool,
15039 /// Creates a new CResult_InitDecodeErrorZ in the success state.
15040 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
15041 CResult_InitDecodeErrorZ {
15042 contents: CResult_InitDecodeErrorZPtr {
15043 result: Box::into_raw(Box::new(o)),
15049 /// Creates a new CResult_InitDecodeErrorZ in the error state.
15050 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
15051 CResult_InitDecodeErrorZ {
15052 contents: CResult_InitDecodeErrorZPtr {
15053 err: Box::into_raw(Box::new(e)),
15058 /// Checks if the given object is currently in the success state
15060 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
15064 /// Frees any resources used by the CResult_InitDecodeErrorZ.
15065 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
15066 impl Drop for CResult_InitDecodeErrorZ {
15067 fn drop(&mut self) {
15068 if self.result_ok {
15069 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15070 let _ = unsafe { Box::from_raw(self.contents.result) };
15073 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15074 let _ = unsafe { Box::from_raw(self.contents.err) };
15079 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
15080 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
15081 let contents = if o.result_ok {
15082 let result = unsafe { o.contents.result };
15083 unsafe { o.contents.result = core::ptr::null_mut() };
15084 CResult_InitDecodeErrorZPtr { result }
15086 let err = unsafe { o.contents.err };
15087 unsafe { o.contents.err = core::ptr::null_mut(); }
15088 CResult_InitDecodeErrorZPtr { err }
15092 result_ok: o.result_ok,
15096 impl Clone for CResult_InitDecodeErrorZ {
15097 fn clone(&self) -> Self {
15098 if self.result_ok {
15099 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
15100 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
15103 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
15104 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15110 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15111 /// but with all dynamically-allocated buffers duplicated in new buffers.
15112 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
15114 /// The contents of CResult_OpenChannelDecodeErrorZ
15115 pub union CResult_OpenChannelDecodeErrorZPtr {
15116 /// A pointer to the contents in the success state.
15117 /// Reading from this pointer when `result_ok` is not set is undefined.
15118 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
15119 /// A pointer to the contents in the error state.
15120 /// Reading from this pointer when `result_ok` is set is undefined.
15121 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15124 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
15125 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15126 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15127 pub struct CResult_OpenChannelDecodeErrorZ {
15128 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
15129 /// `err` or `result` depending on the state of `result_ok`.
15130 pub contents: CResult_OpenChannelDecodeErrorZPtr,
15131 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
15132 pub result_ok: bool,
15135 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15136 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
15137 CResult_OpenChannelDecodeErrorZ {
15138 contents: CResult_OpenChannelDecodeErrorZPtr {
15139 result: Box::into_raw(Box::new(o)),
15145 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15146 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
15147 CResult_OpenChannelDecodeErrorZ {
15148 contents: CResult_OpenChannelDecodeErrorZPtr {
15149 err: Box::into_raw(Box::new(e)),
15154 /// Checks if the given object is currently in the success state
15156 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
15160 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15161 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
15162 impl Drop for CResult_OpenChannelDecodeErrorZ {
15163 fn drop(&mut self) {
15164 if self.result_ok {
15165 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15166 let _ = unsafe { Box::from_raw(self.contents.result) };
15169 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15170 let _ = unsafe { Box::from_raw(self.contents.err) };
15175 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
15176 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15177 let contents = if o.result_ok {
15178 let result = unsafe { o.contents.result };
15179 unsafe { o.contents.result = core::ptr::null_mut() };
15180 CResult_OpenChannelDecodeErrorZPtr { result }
15182 let err = unsafe { o.contents.err };
15183 unsafe { o.contents.err = core::ptr::null_mut(); }
15184 CResult_OpenChannelDecodeErrorZPtr { err }
15188 result_ok: o.result_ok,
15192 impl Clone for CResult_OpenChannelDecodeErrorZ {
15193 fn clone(&self) -> Self {
15194 if self.result_ok {
15195 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
15196 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
15199 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
15200 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15206 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15207 /// but with all dynamically-allocated buffers duplicated in new buffers.
15208 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
15210 /// The contents of CResult_OpenChannelV2DecodeErrorZ
15211 pub union CResult_OpenChannelV2DecodeErrorZPtr {
15212 /// A pointer to the contents in the success state.
15213 /// Reading from this pointer when `result_ok` is not set is undefined.
15214 pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
15215 /// A pointer to the contents in the error state.
15216 /// Reading from this pointer when `result_ok` is set is undefined.
15217 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15220 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
15221 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
15222 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15223 pub struct CResult_OpenChannelV2DecodeErrorZ {
15224 /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
15225 /// `err` or `result` depending on the state of `result_ok`.
15226 pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
15227 /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
15228 pub result_ok: bool,
15231 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
15232 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
15233 CResult_OpenChannelV2DecodeErrorZ {
15234 contents: CResult_OpenChannelV2DecodeErrorZPtr {
15235 result: Box::into_raw(Box::new(o)),
15241 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
15242 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
15243 CResult_OpenChannelV2DecodeErrorZ {
15244 contents: CResult_OpenChannelV2DecodeErrorZPtr {
15245 err: Box::into_raw(Box::new(e)),
15250 /// Checks if the given object is currently in the success state
15252 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
15256 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
15257 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
15258 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
15259 fn drop(&mut self) {
15260 if self.result_ok {
15261 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15262 let _ = unsafe { Box::from_raw(self.contents.result) };
15265 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15266 let _ = unsafe { Box::from_raw(self.contents.err) };
15271 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
15272 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
15273 let contents = if o.result_ok {
15274 let result = unsafe { o.contents.result };
15275 unsafe { o.contents.result = core::ptr::null_mut() };
15276 CResult_OpenChannelV2DecodeErrorZPtr { result }
15278 let err = unsafe { o.contents.err };
15279 unsafe { o.contents.err = core::ptr::null_mut(); }
15280 CResult_OpenChannelV2DecodeErrorZPtr { err }
15284 result_ok: o.result_ok,
15288 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
15289 fn clone(&self) -> Self {
15290 if self.result_ok {
15291 Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
15292 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
15295 Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
15296 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15302 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
15303 /// but with all dynamically-allocated buffers duplicated in new buffers.
15304 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
15306 /// The contents of CResult_RevokeAndACKDecodeErrorZ
15307 pub union CResult_RevokeAndACKDecodeErrorZPtr {
15308 /// A pointer to the contents in the success state.
15309 /// Reading from this pointer when `result_ok` is not set is undefined.
15310 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
15311 /// A pointer to the contents in the error state.
15312 /// Reading from this pointer when `result_ok` is set is undefined.
15313 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15316 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
15317 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
15318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15319 pub struct CResult_RevokeAndACKDecodeErrorZ {
15320 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
15321 /// `err` or `result` depending on the state of `result_ok`.
15322 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
15323 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
15324 pub result_ok: bool,
15327 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15328 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
15329 CResult_RevokeAndACKDecodeErrorZ {
15330 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15331 result: Box::into_raw(Box::new(o)),
15337 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15338 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
15339 CResult_RevokeAndACKDecodeErrorZ {
15340 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15341 err: Box::into_raw(Box::new(e)),
15346 /// Checks if the given object is currently in the success state
15348 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
15352 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15353 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
15354 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
15355 fn drop(&mut self) {
15356 if self.result_ok {
15357 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15358 let _ = unsafe { Box::from_raw(self.contents.result) };
15361 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15362 let _ = unsafe { Box::from_raw(self.contents.err) };
15367 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
15368 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
15369 let contents = if o.result_ok {
15370 let result = unsafe { o.contents.result };
15371 unsafe { o.contents.result = core::ptr::null_mut() };
15372 CResult_RevokeAndACKDecodeErrorZPtr { result }
15374 let err = unsafe { o.contents.err };
15375 unsafe { o.contents.err = core::ptr::null_mut(); }
15376 CResult_RevokeAndACKDecodeErrorZPtr { err }
15380 result_ok: o.result_ok,
15384 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
15385 fn clone(&self) -> Self {
15386 if self.result_ok {
15387 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15388 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
15391 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15392 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15398 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15399 /// but with all dynamically-allocated buffers duplicated in new buffers.
15400 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
15402 /// The contents of CResult_ShutdownDecodeErrorZ
15403 pub union CResult_ShutdownDecodeErrorZPtr {
15404 /// A pointer to the contents in the success state.
15405 /// Reading from this pointer when `result_ok` is not set is undefined.
15406 pub result: *mut crate::lightning::ln::msgs::Shutdown,
15407 /// A pointer to the contents in the error state.
15408 /// Reading from this pointer when `result_ok` is set is undefined.
15409 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15412 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
15413 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
15414 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15415 pub struct CResult_ShutdownDecodeErrorZ {
15416 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
15417 /// `err` or `result` depending on the state of `result_ok`.
15418 pub contents: CResult_ShutdownDecodeErrorZPtr,
15419 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
15420 pub result_ok: bool,
15423 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15424 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
15425 CResult_ShutdownDecodeErrorZ {
15426 contents: CResult_ShutdownDecodeErrorZPtr {
15427 result: Box::into_raw(Box::new(o)),
15433 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15434 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
15435 CResult_ShutdownDecodeErrorZ {
15436 contents: CResult_ShutdownDecodeErrorZPtr {
15437 err: Box::into_raw(Box::new(e)),
15442 /// Checks if the given object is currently in the success state
15444 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
15448 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
15449 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
15450 impl Drop for CResult_ShutdownDecodeErrorZ {
15451 fn drop(&mut self) {
15452 if self.result_ok {
15453 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15454 let _ = unsafe { Box::from_raw(self.contents.result) };
15457 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15458 let _ = unsafe { Box::from_raw(self.contents.err) };
15463 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
15464 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
15465 let contents = if o.result_ok {
15466 let result = unsafe { o.contents.result };
15467 unsafe { o.contents.result = core::ptr::null_mut() };
15468 CResult_ShutdownDecodeErrorZPtr { result }
15470 let err = unsafe { o.contents.err };
15471 unsafe { o.contents.err = core::ptr::null_mut(); }
15472 CResult_ShutdownDecodeErrorZPtr { err }
15476 result_ok: o.result_ok,
15480 impl Clone for CResult_ShutdownDecodeErrorZ {
15481 fn clone(&self) -> Self {
15482 if self.result_ok {
15483 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
15484 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
15487 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
15488 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15494 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
15495 /// but with all dynamically-allocated buffers duplicated in new buffers.
15496 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
15498 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
15499 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
15500 /// A pointer to the contents in the success state.
15501 /// Reading from this pointer when `result_ok` is not set is undefined.
15502 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15503 /// A pointer to the contents in the error state.
15504 /// Reading from this pointer when `result_ok` is set is undefined.
15505 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15508 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
15509 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15510 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15511 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
15512 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
15513 /// `err` or `result` depending on the state of `result_ok`.
15514 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
15515 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
15516 pub result_ok: bool,
15519 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15520 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
15521 CResult_UpdateFailHTLCDecodeErrorZ {
15522 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15523 result: Box::into_raw(Box::new(o)),
15529 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15530 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
15531 CResult_UpdateFailHTLCDecodeErrorZ {
15532 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15533 err: Box::into_raw(Box::new(e)),
15538 /// Checks if the given object is currently in the success state
15540 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
15544 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15545 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
15546 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
15547 fn drop(&mut self) {
15548 if self.result_ok {
15549 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15550 let _ = unsafe { Box::from_raw(self.contents.result) };
15553 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15554 let _ = unsafe { Box::from_raw(self.contents.err) };
15559 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
15560 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15561 let contents = if o.result_ok {
15562 let result = unsafe { o.contents.result };
15563 unsafe { o.contents.result = core::ptr::null_mut() };
15564 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
15566 let err = unsafe { o.contents.err };
15567 unsafe { o.contents.err = core::ptr::null_mut(); }
15568 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
15572 result_ok: o.result_ok,
15576 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
15577 fn clone(&self) -> Self {
15578 if self.result_ok {
15579 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15580 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
15583 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15584 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15590 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15591 /// but with all dynamically-allocated buffers duplicated in new buffers.
15592 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
15594 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
15595 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15596 /// A pointer to the contents in the success state.
15597 /// Reading from this pointer when `result_ok` is not set is undefined.
15598 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15599 /// A pointer to the contents in the error state.
15600 /// Reading from this pointer when `result_ok` is set is undefined.
15601 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15604 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
15605 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15607 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15608 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
15609 /// `err` or `result` depending on the state of `result_ok`.
15610 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
15611 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
15612 pub result_ok: bool,
15615 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15616 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15617 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15618 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15619 result: Box::into_raw(Box::new(o)),
15625 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15626 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15627 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15628 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15629 err: Box::into_raw(Box::new(e)),
15634 /// Checks if the given object is currently in the success state
15636 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
15640 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15641 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
15642 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15643 fn drop(&mut self) {
15644 if self.result_ok {
15645 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15646 let _ = unsafe { Box::from_raw(self.contents.result) };
15649 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15650 let _ = unsafe { Box::from_raw(self.contents.err) };
15655 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15656 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15657 let contents = if o.result_ok {
15658 let result = unsafe { o.contents.result };
15659 unsafe { o.contents.result = core::ptr::null_mut() };
15660 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
15662 let err = unsafe { o.contents.err };
15663 unsafe { o.contents.err = core::ptr::null_mut(); }
15664 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
15668 result_ok: o.result_ok,
15672 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15673 fn clone(&self) -> Self {
15674 if self.result_ok {
15675 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15676 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
15679 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15680 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15686 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
15687 /// but with all dynamically-allocated buffers duplicated in new buffers.
15688 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
15690 /// The contents of CResult_UpdateFeeDecodeErrorZ
15691 pub union CResult_UpdateFeeDecodeErrorZPtr {
15692 /// A pointer to the contents in the success state.
15693 /// Reading from this pointer when `result_ok` is not set is undefined.
15694 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
15695 /// A pointer to the contents in the error state.
15696 /// Reading from this pointer when `result_ok` is set is undefined.
15697 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15700 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
15701 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
15702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15703 pub struct CResult_UpdateFeeDecodeErrorZ {
15704 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
15705 /// `err` or `result` depending on the state of `result_ok`.
15706 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
15707 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
15708 pub result_ok: bool,
15711 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
15712 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
15713 CResult_UpdateFeeDecodeErrorZ {
15714 contents: CResult_UpdateFeeDecodeErrorZPtr {
15715 result: Box::into_raw(Box::new(o)),
15721 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
15722 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
15723 CResult_UpdateFeeDecodeErrorZ {
15724 contents: CResult_UpdateFeeDecodeErrorZPtr {
15725 err: Box::into_raw(Box::new(e)),
15730 /// Checks if the given object is currently in the success state
15732 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
15736 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
15737 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
15738 impl Drop for CResult_UpdateFeeDecodeErrorZ {
15739 fn drop(&mut self) {
15740 if self.result_ok {
15741 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15742 let _ = unsafe { Box::from_raw(self.contents.result) };
15745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15746 let _ = unsafe { Box::from_raw(self.contents.err) };
15751 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
15752 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
15753 let contents = if o.result_ok {
15754 let result = unsafe { o.contents.result };
15755 unsafe { o.contents.result = core::ptr::null_mut() };
15756 CResult_UpdateFeeDecodeErrorZPtr { result }
15758 let err = unsafe { o.contents.err };
15759 unsafe { o.contents.err = core::ptr::null_mut(); }
15760 CResult_UpdateFeeDecodeErrorZPtr { err }
15764 result_ok: o.result_ok,
15768 impl Clone for CResult_UpdateFeeDecodeErrorZ {
15769 fn clone(&self) -> Self {
15770 if self.result_ok {
15771 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
15772 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
15775 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
15776 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15782 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
15783 /// but with all dynamically-allocated buffers duplicated in new buffers.
15784 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
15786 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
15787 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15788 /// A pointer to the contents in the success state.
15789 /// Reading from this pointer when `result_ok` is not set is undefined.
15790 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
15791 /// A pointer to the contents in the error state.
15792 /// Reading from this pointer when `result_ok` is set is undefined.
15793 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15796 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
15797 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15799 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
15800 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
15801 /// `err` or `result` depending on the state of `result_ok`.
15802 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
15803 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
15804 pub result_ok: bool,
15807 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
15808 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
15809 CResult_UpdateFulfillHTLCDecodeErrorZ {
15810 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15811 result: Box::into_raw(Box::new(o)),
15817 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
15818 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
15819 CResult_UpdateFulfillHTLCDecodeErrorZ {
15820 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15821 err: Box::into_raw(Box::new(e)),
15826 /// Checks if the given object is currently in the success state
15828 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
15832 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
15833 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
15834 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
15835 fn drop(&mut self) {
15836 if self.result_ok {
15837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15838 let _ = unsafe { Box::from_raw(self.contents.result) };
15841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15842 let _ = unsafe { Box::from_raw(self.contents.err) };
15847 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
15848 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15849 let contents = if o.result_ok {
15850 let result = unsafe { o.contents.result };
15851 unsafe { o.contents.result = core::ptr::null_mut() };
15852 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
15854 let err = unsafe { o.contents.err };
15855 unsafe { o.contents.err = core::ptr::null_mut(); }
15856 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
15860 result_ok: o.result_ok,
15864 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
15865 fn clone(&self) -> Self {
15866 if self.result_ok {
15867 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15868 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
15871 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15872 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15878 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
15879 /// but with all dynamically-allocated buffers duplicated in new buffers.
15880 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
15882 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
15883 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
15884 /// A pointer to the contents in the success state.
15885 /// Reading from this pointer when `result_ok` is not set is undefined.
15886 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15887 /// A pointer to the contents in the error state.
15888 /// Reading from this pointer when `result_ok` is set is undefined.
15889 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15892 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
15893 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15895 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
15896 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
15897 /// `err` or `result` depending on the state of `result_ok`.
15898 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
15899 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
15900 pub result_ok: bool,
15903 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
15904 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
15905 CResult_UpdateAddHTLCDecodeErrorZ {
15906 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15907 result: Box::into_raw(Box::new(o)),
15913 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
15914 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
15915 CResult_UpdateAddHTLCDecodeErrorZ {
15916 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15917 err: Box::into_raw(Box::new(e)),
15922 /// Checks if the given object is currently in the success state
15924 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
15928 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
15929 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
15930 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
15931 fn drop(&mut self) {
15932 if self.result_ok {
15933 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15934 let _ = unsafe { Box::from_raw(self.contents.result) };
15937 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15938 let _ = unsafe { Box::from_raw(self.contents.err) };
15943 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
15944 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15945 let contents = if o.result_ok {
15946 let result = unsafe { o.contents.result };
15947 unsafe { o.contents.result = core::ptr::null_mut() };
15948 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
15950 let err = unsafe { o.contents.err };
15951 unsafe { o.contents.err = core::ptr::null_mut(); }
15952 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
15956 result_ok: o.result_ok,
15960 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
15961 fn clone(&self) -> Self {
15962 if self.result_ok {
15963 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15964 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
15967 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15968 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15974 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
15975 /// but with all dynamically-allocated buffers duplicated in new buffers.
15976 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
15978 /// The contents of CResult_OnionMessageDecodeErrorZ
15979 pub union CResult_OnionMessageDecodeErrorZPtr {
15980 /// A pointer to the contents in the success state.
15981 /// Reading from this pointer when `result_ok` is not set is undefined.
15982 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
15983 /// A pointer to the contents in the error state.
15984 /// Reading from this pointer when `result_ok` is set is undefined.
15985 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15988 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
15989 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15991 pub struct CResult_OnionMessageDecodeErrorZ {
15992 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
15993 /// `err` or `result` depending on the state of `result_ok`.
15994 pub contents: CResult_OnionMessageDecodeErrorZPtr,
15995 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
15996 pub result_ok: bool,
15999 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
16000 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
16001 CResult_OnionMessageDecodeErrorZ {
16002 contents: CResult_OnionMessageDecodeErrorZPtr {
16003 result: Box::into_raw(Box::new(o)),
16009 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
16010 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
16011 CResult_OnionMessageDecodeErrorZ {
16012 contents: CResult_OnionMessageDecodeErrorZPtr {
16013 err: Box::into_raw(Box::new(e)),
16018 /// Checks if the given object is currently in the success state
16020 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
16024 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
16025 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
16026 impl Drop for CResult_OnionMessageDecodeErrorZ {
16027 fn drop(&mut self) {
16028 if self.result_ok {
16029 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16030 let _ = unsafe { Box::from_raw(self.contents.result) };
16033 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16034 let _ = unsafe { Box::from_raw(self.contents.err) };
16039 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
16040 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16041 let contents = if o.result_ok {
16042 let result = unsafe { o.contents.result };
16043 unsafe { o.contents.result = core::ptr::null_mut() };
16044 CResult_OnionMessageDecodeErrorZPtr { result }
16046 let err = unsafe { o.contents.err };
16047 unsafe { o.contents.err = core::ptr::null_mut(); }
16048 CResult_OnionMessageDecodeErrorZPtr { err }
16052 result_ok: o.result_ok,
16056 impl Clone for CResult_OnionMessageDecodeErrorZ {
16057 fn clone(&self) -> Self {
16058 if self.result_ok {
16059 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
16060 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
16063 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
16064 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16070 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
16071 /// but with all dynamically-allocated buffers duplicated in new buffers.
16072 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
16074 /// The contents of CResult_PingDecodeErrorZ
16075 pub union CResult_PingDecodeErrorZPtr {
16076 /// A pointer to the contents in the success state.
16077 /// Reading from this pointer when `result_ok` is not set is undefined.
16078 pub result: *mut crate::lightning::ln::msgs::Ping,
16079 /// A pointer to the contents in the error state.
16080 /// Reading from this pointer when `result_ok` is set is undefined.
16081 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16084 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
16085 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
16086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16087 pub struct CResult_PingDecodeErrorZ {
16088 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
16089 /// `err` or `result` depending on the state of `result_ok`.
16090 pub contents: CResult_PingDecodeErrorZPtr,
16091 /// Whether this CResult_PingDecodeErrorZ represents a success state.
16092 pub result_ok: bool,
16095 /// Creates a new CResult_PingDecodeErrorZ in the success state.
16096 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
16097 CResult_PingDecodeErrorZ {
16098 contents: CResult_PingDecodeErrorZPtr {
16099 result: Box::into_raw(Box::new(o)),
16105 /// Creates a new CResult_PingDecodeErrorZ in the error state.
16106 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
16107 CResult_PingDecodeErrorZ {
16108 contents: CResult_PingDecodeErrorZPtr {
16109 err: Box::into_raw(Box::new(e)),
16114 /// Checks if the given object is currently in the success state
16116 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
16120 /// Frees any resources used by the CResult_PingDecodeErrorZ.
16121 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
16122 impl Drop for CResult_PingDecodeErrorZ {
16123 fn drop(&mut self) {
16124 if self.result_ok {
16125 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16126 let _ = unsafe { Box::from_raw(self.contents.result) };
16129 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16130 let _ = unsafe { Box::from_raw(self.contents.err) };
16135 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
16136 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
16137 let contents = if o.result_ok {
16138 let result = unsafe { o.contents.result };
16139 unsafe { o.contents.result = core::ptr::null_mut() };
16140 CResult_PingDecodeErrorZPtr { result }
16142 let err = unsafe { o.contents.err };
16143 unsafe { o.contents.err = core::ptr::null_mut(); }
16144 CResult_PingDecodeErrorZPtr { err }
16148 result_ok: o.result_ok,
16152 impl Clone for CResult_PingDecodeErrorZ {
16153 fn clone(&self) -> Self {
16154 if self.result_ok {
16155 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
16156 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
16159 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
16160 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16166 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16167 /// but with all dynamically-allocated buffers duplicated in new buffers.
16168 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
16170 /// The contents of CResult_PongDecodeErrorZ
16171 pub union CResult_PongDecodeErrorZPtr {
16172 /// A pointer to the contents in the success state.
16173 /// Reading from this pointer when `result_ok` is not set is undefined.
16174 pub result: *mut crate::lightning::ln::msgs::Pong,
16175 /// A pointer to the contents in the error state.
16176 /// Reading from this pointer when `result_ok` is set is undefined.
16177 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16180 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
16181 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
16182 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16183 pub struct CResult_PongDecodeErrorZ {
16184 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
16185 /// `err` or `result` depending on the state of `result_ok`.
16186 pub contents: CResult_PongDecodeErrorZPtr,
16187 /// Whether this CResult_PongDecodeErrorZ represents a success state.
16188 pub result_ok: bool,
16191 /// Creates a new CResult_PongDecodeErrorZ in the success state.
16192 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
16193 CResult_PongDecodeErrorZ {
16194 contents: CResult_PongDecodeErrorZPtr {
16195 result: Box::into_raw(Box::new(o)),
16201 /// Creates a new CResult_PongDecodeErrorZ in the error state.
16202 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
16203 CResult_PongDecodeErrorZ {
16204 contents: CResult_PongDecodeErrorZPtr {
16205 err: Box::into_raw(Box::new(e)),
16210 /// Checks if the given object is currently in the success state
16212 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
16216 /// Frees any resources used by the CResult_PongDecodeErrorZ.
16217 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
16218 impl Drop for CResult_PongDecodeErrorZ {
16219 fn drop(&mut self) {
16220 if self.result_ok {
16221 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16222 let _ = unsafe { Box::from_raw(self.contents.result) };
16225 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16226 let _ = unsafe { Box::from_raw(self.contents.err) };
16231 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
16232 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
16233 let contents = if o.result_ok {
16234 let result = unsafe { o.contents.result };
16235 unsafe { o.contents.result = core::ptr::null_mut() };
16236 CResult_PongDecodeErrorZPtr { result }
16238 let err = unsafe { o.contents.err };
16239 unsafe { o.contents.err = core::ptr::null_mut(); }
16240 CResult_PongDecodeErrorZPtr { err }
16244 result_ok: o.result_ok,
16248 impl Clone for CResult_PongDecodeErrorZ {
16249 fn clone(&self) -> Self {
16250 if self.result_ok {
16251 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
16252 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
16255 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
16256 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16262 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16263 /// but with all dynamically-allocated buffers duplicated in new buffers.
16264 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
16266 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
16267 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16268 /// A pointer to the contents in the success state.
16269 /// Reading from this pointer when `result_ok` is not set is undefined.
16270 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
16271 /// A pointer to the contents in the error state.
16272 /// Reading from this pointer when `result_ok` is set is undefined.
16273 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16276 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16277 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16279 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16280 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
16281 /// `err` or `result` depending on the state of `result_ok`.
16282 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
16283 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
16284 pub result_ok: bool,
16287 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16288 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16289 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16290 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16291 result: Box::into_raw(Box::new(o)),
16297 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16298 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16299 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16300 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16301 err: Box::into_raw(Box::new(e)),
16306 /// Checks if the given object is currently in the success state
16308 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
16312 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16313 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
16314 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16315 fn drop(&mut self) {
16316 if self.result_ok {
16317 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16318 let _ = unsafe { Box::from_raw(self.contents.result) };
16321 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16322 let _ = unsafe { Box::from_raw(self.contents.err) };
16327 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16328 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16329 let contents = if o.result_ok {
16330 let result = unsafe { o.contents.result };
16331 unsafe { o.contents.result = core::ptr::null_mut() };
16332 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
16334 let err = unsafe { o.contents.err };
16335 unsafe { o.contents.err = core::ptr::null_mut(); }
16336 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
16340 result_ok: o.result_ok,
16344 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16345 fn clone(&self) -> Self {
16346 if self.result_ok {
16347 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16348 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16351 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16352 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16358 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16359 /// but with all dynamically-allocated buffers duplicated in new buffers.
16360 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16362 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
16363 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
16364 /// A pointer to the contents in the success state.
16365 /// Reading from this pointer when `result_ok` is not set is undefined.
16366 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
16367 /// A pointer to the contents in the error state.
16368 /// Reading from this pointer when `result_ok` is set is undefined.
16369 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16372 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16373 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16375 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
16376 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
16377 /// `err` or `result` depending on the state of `result_ok`.
16378 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
16379 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
16380 pub result_ok: bool,
16383 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16384 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
16385 CResult_ChannelAnnouncementDecodeErrorZ {
16386 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16387 result: Box::into_raw(Box::new(o)),
16393 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16394 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
16395 CResult_ChannelAnnouncementDecodeErrorZ {
16396 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16397 err: Box::into_raw(Box::new(e)),
16402 /// Checks if the given object is currently in the success state
16404 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
16408 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16409 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
16410 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
16411 fn drop(&mut self) {
16412 if self.result_ok {
16413 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16414 let _ = unsafe { Box::from_raw(self.contents.result) };
16417 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16418 let _ = unsafe { Box::from_raw(self.contents.err) };
16423 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
16424 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16425 let contents = if o.result_ok {
16426 let result = unsafe { o.contents.result };
16427 unsafe { o.contents.result = core::ptr::null_mut() };
16428 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
16430 let err = unsafe { o.contents.err };
16431 unsafe { o.contents.err = core::ptr::null_mut(); }
16432 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
16436 result_ok: o.result_ok,
16440 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
16441 fn clone(&self) -> Self {
16442 if self.result_ok {
16443 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16444 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16447 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16448 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16454 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16455 /// but with all dynamically-allocated buffers duplicated in new buffers.
16456 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16458 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
16459 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16460 /// A pointer to the contents in the success state.
16461 /// Reading from this pointer when `result_ok` is not set is undefined.
16462 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
16463 /// A pointer to the contents in the error state.
16464 /// Reading from this pointer when `result_ok` is set is undefined.
16465 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16468 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16469 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16471 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
16472 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
16473 /// `err` or `result` depending on the state of `result_ok`.
16474 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
16475 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
16476 pub result_ok: bool,
16479 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16480 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16481 CResult_UnsignedChannelUpdateDecodeErrorZ {
16482 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16483 result: Box::into_raw(Box::new(o)),
16489 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16490 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16491 CResult_UnsignedChannelUpdateDecodeErrorZ {
16492 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16493 err: Box::into_raw(Box::new(e)),
16498 /// Checks if the given object is currently in the success state
16500 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
16504 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16505 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
16506 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
16507 fn drop(&mut self) {
16508 if self.result_ok {
16509 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16510 let _ = unsafe { Box::from_raw(self.contents.result) };
16513 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16514 let _ = unsafe { Box::from_raw(self.contents.err) };
16519 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
16520 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16521 let contents = if o.result_ok {
16522 let result = unsafe { o.contents.result };
16523 unsafe { o.contents.result = core::ptr::null_mut() };
16524 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
16526 let err = unsafe { o.contents.err };
16527 unsafe { o.contents.err = core::ptr::null_mut(); }
16528 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
16532 result_ok: o.result_ok,
16536 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
16537 fn clone(&self) -> Self {
16538 if self.result_ok {
16539 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16540 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
16543 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16544 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16550 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16551 /// but with all dynamically-allocated buffers duplicated in new buffers.
16552 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16554 /// The contents of CResult_ChannelUpdateDecodeErrorZ
16555 pub union CResult_ChannelUpdateDecodeErrorZPtr {
16556 /// A pointer to the contents in the success state.
16557 /// Reading from this pointer when `result_ok` is not set is undefined.
16558 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
16559 /// A pointer to the contents in the error state.
16560 /// Reading from this pointer when `result_ok` is set is undefined.
16561 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16564 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16565 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16567 pub struct CResult_ChannelUpdateDecodeErrorZ {
16568 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
16569 /// `err` or `result` depending on the state of `result_ok`.
16570 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
16571 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
16572 pub result_ok: bool,
16575 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16576 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
16577 CResult_ChannelUpdateDecodeErrorZ {
16578 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16579 result: Box::into_raw(Box::new(o)),
16585 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16586 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
16587 CResult_ChannelUpdateDecodeErrorZ {
16588 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16589 err: Box::into_raw(Box::new(e)),
16594 /// Checks if the given object is currently in the success state
16596 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
16600 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16601 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
16602 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
16603 fn drop(&mut self) {
16604 if self.result_ok {
16605 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16606 let _ = unsafe { Box::from_raw(self.contents.result) };
16609 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16610 let _ = unsafe { Box::from_raw(self.contents.err) };
16615 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
16616 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16617 let contents = if o.result_ok {
16618 let result = unsafe { o.contents.result };
16619 unsafe { o.contents.result = core::ptr::null_mut() };
16620 CResult_ChannelUpdateDecodeErrorZPtr { result }
16622 let err = unsafe { o.contents.err };
16623 unsafe { o.contents.err = core::ptr::null_mut(); }
16624 CResult_ChannelUpdateDecodeErrorZPtr { err }
16628 result_ok: o.result_ok,
16632 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
16633 fn clone(&self) -> Self {
16634 if self.result_ok {
16635 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16636 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
16639 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16640 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16646 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16647 /// but with all dynamically-allocated buffers duplicated in new buffers.
16648 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16650 /// The contents of CResult_ErrorMessageDecodeErrorZ
16651 pub union CResult_ErrorMessageDecodeErrorZPtr {
16652 /// A pointer to the contents in the success state.
16653 /// Reading from this pointer when `result_ok` is not set is undefined.
16654 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
16655 /// A pointer to the contents in the error state.
16656 /// Reading from this pointer when `result_ok` is set is undefined.
16657 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16660 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
16661 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16663 pub struct CResult_ErrorMessageDecodeErrorZ {
16664 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
16665 /// `err` or `result` depending on the state of `result_ok`.
16666 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
16667 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
16668 pub result_ok: bool,
16671 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16672 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
16673 CResult_ErrorMessageDecodeErrorZ {
16674 contents: CResult_ErrorMessageDecodeErrorZPtr {
16675 result: Box::into_raw(Box::new(o)),
16681 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16682 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
16683 CResult_ErrorMessageDecodeErrorZ {
16684 contents: CResult_ErrorMessageDecodeErrorZPtr {
16685 err: Box::into_raw(Box::new(e)),
16690 /// Checks if the given object is currently in the success state
16692 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
16696 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16697 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
16698 impl Drop for CResult_ErrorMessageDecodeErrorZ {
16699 fn drop(&mut self) {
16700 if self.result_ok {
16701 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16702 let _ = unsafe { Box::from_raw(self.contents.result) };
16705 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16706 let _ = unsafe { Box::from_raw(self.contents.err) };
16711 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
16712 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16713 let contents = if o.result_ok {
16714 let result = unsafe { o.contents.result };
16715 unsafe { o.contents.result = core::ptr::null_mut() };
16716 CResult_ErrorMessageDecodeErrorZPtr { result }
16718 let err = unsafe { o.contents.err };
16719 unsafe { o.contents.err = core::ptr::null_mut(); }
16720 CResult_ErrorMessageDecodeErrorZPtr { err }
16724 result_ok: o.result_ok,
16728 impl Clone for CResult_ErrorMessageDecodeErrorZ {
16729 fn clone(&self) -> Self {
16730 if self.result_ok {
16731 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
16732 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
16735 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
16736 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16742 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
16743 /// but with all dynamically-allocated buffers duplicated in new buffers.
16744 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
16746 /// The contents of CResult_WarningMessageDecodeErrorZ
16747 pub union CResult_WarningMessageDecodeErrorZPtr {
16748 /// A pointer to the contents in the success state.
16749 /// Reading from this pointer when `result_ok` is not set is undefined.
16750 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
16751 /// A pointer to the contents in the error state.
16752 /// Reading from this pointer when `result_ok` is set is undefined.
16753 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16756 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
16757 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16759 pub struct CResult_WarningMessageDecodeErrorZ {
16760 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
16761 /// `err` or `result` depending on the state of `result_ok`.
16762 pub contents: CResult_WarningMessageDecodeErrorZPtr,
16763 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
16764 pub result_ok: bool,
16767 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
16768 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
16769 CResult_WarningMessageDecodeErrorZ {
16770 contents: CResult_WarningMessageDecodeErrorZPtr {
16771 result: Box::into_raw(Box::new(o)),
16777 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
16778 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
16779 CResult_WarningMessageDecodeErrorZ {
16780 contents: CResult_WarningMessageDecodeErrorZPtr {
16781 err: Box::into_raw(Box::new(e)),
16786 /// Checks if the given object is currently in the success state
16788 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
16792 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
16793 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
16794 impl Drop for CResult_WarningMessageDecodeErrorZ {
16795 fn drop(&mut self) {
16796 if self.result_ok {
16797 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16798 let _ = unsafe { Box::from_raw(self.contents.result) };
16801 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16802 let _ = unsafe { Box::from_raw(self.contents.err) };
16807 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
16808 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16809 let contents = if o.result_ok {
16810 let result = unsafe { o.contents.result };
16811 unsafe { o.contents.result = core::ptr::null_mut() };
16812 CResult_WarningMessageDecodeErrorZPtr { result }
16814 let err = unsafe { o.contents.err };
16815 unsafe { o.contents.err = core::ptr::null_mut(); }
16816 CResult_WarningMessageDecodeErrorZPtr { err }
16820 result_ok: o.result_ok,
16824 impl Clone for CResult_WarningMessageDecodeErrorZ {
16825 fn clone(&self) -> Self {
16826 if self.result_ok {
16827 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
16828 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
16831 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
16832 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16838 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
16839 /// but with all dynamically-allocated buffers duplicated in new buffers.
16840 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
16842 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
16843 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16844 /// A pointer to the contents in the success state.
16845 /// Reading from this pointer when `result_ok` is not set is undefined.
16846 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
16847 /// A pointer to the contents in the error state.
16848 /// Reading from this pointer when `result_ok` is set is undefined.
16849 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16852 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16853 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16854 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16855 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16856 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
16857 /// `err` or `result` depending on the state of `result_ok`.
16858 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
16859 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
16860 pub result_ok: bool,
16863 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
16864 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16865 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16866 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16867 result: Box::into_raw(Box::new(o)),
16873 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
16874 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16875 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16876 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16877 err: Box::into_raw(Box::new(e)),
16882 /// Checks if the given object is currently in the success state
16884 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
16888 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16889 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
16890 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16891 fn drop(&mut self) {
16892 if self.result_ok {
16893 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16894 let _ = unsafe { Box::from_raw(self.contents.result) };
16897 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16898 let _ = unsafe { Box::from_raw(self.contents.err) };
16903 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16904 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16905 let contents = if o.result_ok {
16906 let result = unsafe { o.contents.result };
16907 unsafe { o.contents.result = core::ptr::null_mut() };
16908 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
16910 let err = unsafe { o.contents.err };
16911 unsafe { o.contents.err = core::ptr::null_mut(); }
16912 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
16916 result_ok: o.result_ok,
16920 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16921 fn clone(&self) -> Self {
16922 if self.result_ok {
16923 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16924 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
16927 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16928 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16934 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16935 /// but with all dynamically-allocated buffers duplicated in new buffers.
16936 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16938 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
16939 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
16940 /// A pointer to the contents in the success state.
16941 /// Reading from this pointer when `result_ok` is not set is undefined.
16942 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
16943 /// A pointer to the contents in the error state.
16944 /// Reading from this pointer when `result_ok` is set is undefined.
16945 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16948 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16949 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16950 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16951 pub struct CResult_NodeAnnouncementDecodeErrorZ {
16952 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
16953 /// `err` or `result` depending on the state of `result_ok`.
16954 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
16955 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
16956 pub result_ok: bool,
16959 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16960 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
16961 CResult_NodeAnnouncementDecodeErrorZ {
16962 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16963 result: Box::into_raw(Box::new(o)),
16969 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16970 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
16971 CResult_NodeAnnouncementDecodeErrorZ {
16972 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16973 err: Box::into_raw(Box::new(e)),
16978 /// Checks if the given object is currently in the success state
16980 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
16984 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16985 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
16986 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
16987 fn drop(&mut self) {
16988 if self.result_ok {
16989 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16990 let _ = unsafe { Box::from_raw(self.contents.result) };
16993 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16994 let _ = unsafe { Box::from_raw(self.contents.err) };
16999 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
17000 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17001 let contents = if o.result_ok {
17002 let result = unsafe { o.contents.result };
17003 unsafe { o.contents.result = core::ptr::null_mut() };
17004 CResult_NodeAnnouncementDecodeErrorZPtr { result }
17006 let err = unsafe { o.contents.err };
17007 unsafe { o.contents.err = core::ptr::null_mut(); }
17008 CResult_NodeAnnouncementDecodeErrorZPtr { err }
17012 result_ok: o.result_ok,
17016 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
17017 fn clone(&self) -> Self {
17018 if self.result_ok {
17019 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17020 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17023 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17024 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17030 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
17031 /// but with all dynamically-allocated buffers duplicated in new buffers.
17032 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17034 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
17035 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
17036 /// A pointer to the contents in the success state.
17037 /// Reading from this pointer when `result_ok` is not set is undefined.
17038 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
17039 /// A pointer to the contents in the error state.
17040 /// Reading from this pointer when `result_ok` is set is undefined.
17041 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17044 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
17045 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
17046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17047 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
17048 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
17049 /// `err` or `result` depending on the state of `result_ok`.
17050 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
17051 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
17052 pub result_ok: bool,
17055 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
17056 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17057 CResult_QueryShortChannelIdsDecodeErrorZ {
17058 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17059 result: Box::into_raw(Box::new(o)),
17065 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
17066 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17067 CResult_QueryShortChannelIdsDecodeErrorZ {
17068 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17069 err: Box::into_raw(Box::new(e)),
17074 /// Checks if the given object is currently in the success state
17076 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
17080 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
17081 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
17082 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
17083 fn drop(&mut self) {
17084 if self.result_ok {
17085 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17086 let _ = unsafe { Box::from_raw(self.contents.result) };
17089 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17090 let _ = unsafe { Box::from_raw(self.contents.err) };
17095 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
17096 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
17097 let contents = if o.result_ok {
17098 let result = unsafe { o.contents.result };
17099 unsafe { o.contents.result = core::ptr::null_mut() };
17100 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
17102 let err = unsafe { o.contents.err };
17103 unsafe { o.contents.err = core::ptr::null_mut(); }
17104 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
17108 result_ok: o.result_ok,
17112 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
17113 fn clone(&self) -> Self {
17114 if self.result_ok {
17115 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17116 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
17119 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17120 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17126 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
17127 /// but with all dynamically-allocated buffers duplicated in new buffers.
17128 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
17130 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
17131 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17132 /// A pointer to the contents in the success state.
17133 /// Reading from this pointer when `result_ok` is not set is undefined.
17134 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
17135 /// A pointer to the contents in the error state.
17136 /// Reading from this pointer when `result_ok` is set is undefined.
17137 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17140 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
17141 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
17142 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17143 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17144 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
17145 /// `err` or `result` depending on the state of `result_ok`.
17146 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
17147 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
17148 pub result_ok: bool,
17151 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
17152 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17153 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17154 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17155 result: Box::into_raw(Box::new(o)),
17161 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
17162 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17163 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17164 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17165 err: Box::into_raw(Box::new(e)),
17170 /// Checks if the given object is currently in the success state
17172 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
17176 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
17177 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
17178 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17179 fn drop(&mut self) {
17180 if self.result_ok {
17181 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17182 let _ = unsafe { Box::from_raw(self.contents.result) };
17185 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17186 let _ = unsafe { Box::from_raw(self.contents.err) };
17191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17192 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
17193 let contents = if o.result_ok {
17194 let result = unsafe { o.contents.result };
17195 unsafe { o.contents.result = core::ptr::null_mut() };
17196 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
17198 let err = unsafe { o.contents.err };
17199 unsafe { o.contents.err = core::ptr::null_mut(); }
17200 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
17204 result_ok: o.result_ok,
17208 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17209 fn clone(&self) -> Self {
17210 if self.result_ok {
17211 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17212 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
17215 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17216 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17222 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
17223 /// but with all dynamically-allocated buffers duplicated in new buffers.
17224 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
17226 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
17227 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
17228 /// A pointer to the contents in the success state.
17229 /// Reading from this pointer when `result_ok` is not set is undefined.
17230 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
17231 /// A pointer to the contents in the error state.
17232 /// Reading from this pointer when `result_ok` is set is undefined.
17233 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17236 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
17237 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17239 pub struct CResult_QueryChannelRangeDecodeErrorZ {
17240 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
17241 /// `err` or `result` depending on the state of `result_ok`.
17242 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
17243 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
17244 pub result_ok: bool,
17247 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
17248 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
17249 CResult_QueryChannelRangeDecodeErrorZ {
17250 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17251 result: Box::into_raw(Box::new(o)),
17257 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
17258 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
17259 CResult_QueryChannelRangeDecodeErrorZ {
17260 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17261 err: Box::into_raw(Box::new(e)),
17266 /// Checks if the given object is currently in the success state
17268 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
17272 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
17273 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
17274 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
17275 fn drop(&mut self) {
17276 if self.result_ok {
17277 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17278 let _ = unsafe { Box::from_raw(self.contents.result) };
17281 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17282 let _ = unsafe { Box::from_raw(self.contents.err) };
17287 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
17288 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17289 let contents = if o.result_ok {
17290 let result = unsafe { o.contents.result };
17291 unsafe { o.contents.result = core::ptr::null_mut() };
17292 CResult_QueryChannelRangeDecodeErrorZPtr { result }
17294 let err = unsafe { o.contents.err };
17295 unsafe { o.contents.err = core::ptr::null_mut(); }
17296 CResult_QueryChannelRangeDecodeErrorZPtr { err }
17300 result_ok: o.result_ok,
17304 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
17305 fn clone(&self) -> Self {
17306 if self.result_ok {
17307 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17308 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
17311 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17312 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17318 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
17319 /// but with all dynamically-allocated buffers duplicated in new buffers.
17320 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17322 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
17323 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
17324 /// A pointer to the contents in the success state.
17325 /// Reading from this pointer when `result_ok` is not set is undefined.
17326 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
17327 /// A pointer to the contents in the error state.
17328 /// Reading from this pointer when `result_ok` is set is undefined.
17329 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17332 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
17333 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17335 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
17336 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
17337 /// `err` or `result` depending on the state of `result_ok`.
17338 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
17339 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
17340 pub result_ok: bool,
17343 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
17344 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
17345 CResult_ReplyChannelRangeDecodeErrorZ {
17346 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17347 result: Box::into_raw(Box::new(o)),
17353 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
17354 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
17355 CResult_ReplyChannelRangeDecodeErrorZ {
17356 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17357 err: Box::into_raw(Box::new(e)),
17362 /// Checks if the given object is currently in the success state
17364 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
17368 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
17369 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
17370 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
17371 fn drop(&mut self) {
17372 if self.result_ok {
17373 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17374 let _ = unsafe { Box::from_raw(self.contents.result) };
17377 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17378 let _ = unsafe { Box::from_raw(self.contents.err) };
17383 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
17384 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17385 let contents = if o.result_ok {
17386 let result = unsafe { o.contents.result };
17387 unsafe { o.contents.result = core::ptr::null_mut() };
17388 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
17390 let err = unsafe { o.contents.err };
17391 unsafe { o.contents.err = core::ptr::null_mut(); }
17392 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
17396 result_ok: o.result_ok,
17400 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
17401 fn clone(&self) -> Self {
17402 if self.result_ok {
17403 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17404 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
17407 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17408 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17414 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
17415 /// but with all dynamically-allocated buffers duplicated in new buffers.
17416 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17418 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
17419 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
17420 /// A pointer to the contents in the success state.
17421 /// Reading from this pointer when `result_ok` is not set is undefined.
17422 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
17423 /// A pointer to the contents in the error state.
17424 /// Reading from this pointer when `result_ok` is set is undefined.
17425 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17428 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
17429 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
17430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17431 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
17432 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
17433 /// `err` or `result` depending on the state of `result_ok`.
17434 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
17435 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
17436 pub result_ok: bool,
17439 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
17440 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
17441 CResult_GossipTimestampFilterDecodeErrorZ {
17442 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17443 result: Box::into_raw(Box::new(o)),
17449 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
17450 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
17451 CResult_GossipTimestampFilterDecodeErrorZ {
17452 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17453 err: Box::into_raw(Box::new(e)),
17458 /// Checks if the given object is currently in the success state
17460 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
17464 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
17465 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
17466 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
17467 fn drop(&mut self) {
17468 if self.result_ok {
17469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17470 let _ = unsafe { Box::from_raw(self.contents.result) };
17473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17474 let _ = unsafe { Box::from_raw(self.contents.err) };
17479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
17480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
17481 let contents = if o.result_ok {
17482 let result = unsafe { o.contents.result };
17483 unsafe { o.contents.result = core::ptr::null_mut() };
17484 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
17486 let err = unsafe { o.contents.err };
17487 unsafe { o.contents.err = core::ptr::null_mut(); }
17488 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
17492 result_ok: o.result_ok,
17496 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
17497 fn clone(&self) -> Self {
17498 if self.result_ok {
17499 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17500 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
17503 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17504 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17510 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17511 /// but with all dynamically-allocated buffers duplicated in new buffers.
17512 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
17514 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
17515 /// This corresponds to std::vector in C++
17516 pub struct CVec_PhantomRouteHintsZ {
17517 /// The elements in the array.
17518 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17519 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
17520 /// The number of elements pointed to by `data`.
17523 impl CVec_PhantomRouteHintsZ {
17524 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
17525 if self.datalen == 0 { return Vec::new(); }
17526 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17527 self.data = core::ptr::null_mut();
17531 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
17532 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17535 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
17536 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
17537 let datalen = v.len();
17538 let data = Box::into_raw(v.into_boxed_slice());
17539 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17543 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17544 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
17545 impl Drop for CVec_PhantomRouteHintsZ {
17546 fn drop(&mut self) {
17547 if self.datalen == 0 { return; }
17548 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17551 impl Clone for CVec_PhantomRouteHintsZ {
17552 fn clone(&self) -> Self {
17553 let mut res = Vec::new();
17554 if self.datalen == 0 { return Self::from(res); }
17555 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17560 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
17561 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17562 /// A pointer to the contents in the success state.
17563 /// Reading from this pointer when `result_ok` is not set is undefined.
17564 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
17565 /// A pointer to the contents in the error state.
17566 /// Reading from this pointer when `result_ok` is set is undefined.
17567 pub err: *mut crate::lightning_invoice::SignOrCreationError,
17570 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
17571 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
17572 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17573 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
17574 /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
17575 /// `err` or `result` depending on the state of `result_ok`.
17576 pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
17577 /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
17578 pub result_ok: bool,
17581 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
17582 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
17583 CResult_Bolt11InvoiceSignOrCreationErrorZ {
17584 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17585 result: Box::into_raw(Box::new(o)),
17591 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
17592 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
17593 CResult_Bolt11InvoiceSignOrCreationErrorZ {
17594 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17595 err: Box::into_raw(Box::new(e)),
17600 /// Checks if the given object is currently in the success state
17602 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
17606 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
17607 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
17608 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17609 fn drop(&mut self) {
17610 if self.result_ok {
17611 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17612 let _ = unsafe { Box::from_raw(self.contents.result) };
17615 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17616 let _ = unsafe { Box::from_raw(self.contents.err) };
17621 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17622 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
17623 let contents = if o.result_ok {
17624 let result = unsafe { o.contents.result };
17625 unsafe { o.contents.result = core::ptr::null_mut() };
17626 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
17628 let err = unsafe { o.contents.err };
17629 unsafe { o.contents.err = core::ptr::null_mut(); }
17630 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
17634 result_ok: o.result_ok,
17638 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17639 fn clone(&self) -> Self {
17640 if self.result_ok {
17641 Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17642 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
17645 Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17646 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
17652 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
17653 /// but with all dynamically-allocated buffers duplicated in new buffers.
17654 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
17656 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
17657 /// This corresponds to std::vector in C++
17658 pub struct CVec_FutureZ {
17659 /// The elements in the array.
17660 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17661 pub data: *mut crate::lightning::util::wakers::Future,
17662 /// The number of elements pointed to by `data`.
17665 impl CVec_FutureZ {
17666 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
17667 if self.datalen == 0 { return Vec::new(); }
17668 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17669 self.data = core::ptr::null_mut();
17673 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
17674 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17677 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
17678 fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
17679 let datalen = v.len();
17680 let data = Box::into_raw(v.into_boxed_slice());
17681 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17685 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17686 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
17687 impl Drop for CVec_FutureZ {
17688 fn drop(&mut self) {
17689 if self.datalen == 0 { return; }
17690 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17693 impl Clone for CVec_FutureZ {
17694 fn clone(&self) -> Self {
17695 let mut res = Vec::new();
17696 if self.datalen == 0 { return Self::from(res); }
17697 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17702 /// The contents of CResult_OffersMessageDecodeErrorZ
17703 pub union CResult_OffersMessageDecodeErrorZPtr {
17704 /// A pointer to the contents in the success state.
17705 /// Reading from this pointer when `result_ok` is not set is undefined.
17706 pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
17707 /// A pointer to the contents in the error state.
17708 /// Reading from this pointer when `result_ok` is set is undefined.
17709 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17712 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
17713 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
17714 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17715 pub struct CResult_OffersMessageDecodeErrorZ {
17716 /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
17717 /// `err` or `result` depending on the state of `result_ok`.
17718 pub contents: CResult_OffersMessageDecodeErrorZPtr,
17719 /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
17720 pub result_ok: bool,
17723 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
17724 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
17725 CResult_OffersMessageDecodeErrorZ {
17726 contents: CResult_OffersMessageDecodeErrorZPtr {
17727 result: Box::into_raw(Box::new(o)),
17733 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
17734 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
17735 CResult_OffersMessageDecodeErrorZ {
17736 contents: CResult_OffersMessageDecodeErrorZPtr {
17737 err: Box::into_raw(Box::new(e)),
17742 /// Checks if the given object is currently in the success state
17744 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
17748 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
17749 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
17750 impl Drop for CResult_OffersMessageDecodeErrorZ {
17751 fn drop(&mut self) {
17752 if self.result_ok {
17753 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17754 let _ = unsafe { Box::from_raw(self.contents.result) };
17757 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17758 let _ = unsafe { Box::from_raw(self.contents.err) };
17763 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
17764 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17765 let contents = if o.result_ok {
17766 let result = unsafe { o.contents.result };
17767 unsafe { o.contents.result = core::ptr::null_mut() };
17768 CResult_OffersMessageDecodeErrorZPtr { result }
17770 let err = unsafe { o.contents.err };
17771 unsafe { o.contents.err = core::ptr::null_mut(); }
17772 CResult_OffersMessageDecodeErrorZPtr { err }
17776 result_ok: o.result_ok,
17780 impl Clone for CResult_OffersMessageDecodeErrorZ {
17781 fn clone(&self) -> Self {
17782 if self.result_ok {
17783 Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
17784 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
17787 Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
17788 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17794 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
17795 /// but with all dynamically-allocated buffers duplicated in new buffers.
17796 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
17798 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
17799 pub enum COption_HTLCClaimZ {
17800 /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
17801 Some(crate::lightning::ln::chan_utils::HTLCClaim),
17802 /// When we're in this state, this COption_HTLCClaimZ contains nothing
17805 impl COption_HTLCClaimZ {
17806 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
17807 if let Self::None = self { false } else { true }
17809 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
17812 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
17813 if let Self::Some(v) = self { v } else { unreachable!() }
17817 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
17818 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
17819 COption_HTLCClaimZ::Some(o)
17822 /// Constructs a new COption_HTLCClaimZ containing nothing
17823 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
17824 COption_HTLCClaimZ::None
17827 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
17828 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
17830 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
17831 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
17832 /// A pointer to the contents in the success state.
17833 /// Reading from this pointer when `result_ok` is not set is undefined.
17834 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
17835 /// A pointer to the contents in the error state.
17836 /// Reading from this pointer when `result_ok` is set is undefined.
17837 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17840 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
17841 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
17842 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17843 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17844 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
17845 /// `err` or `result` depending on the state of `result_ok`.
17846 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
17847 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
17848 pub result_ok: bool,
17851 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
17852 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17853 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17854 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
17855 result: Box::into_raw(Box::new(o)),
17861 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
17862 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17863 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17864 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
17865 err: Box::into_raw(Box::new(e)),
17870 /// Checks if the given object is currently in the success state
17872 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
17876 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
17877 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
17878 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17879 fn drop(&mut self) {
17880 if self.result_ok {
17881 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17882 let _ = unsafe { Box::from_raw(self.contents.result) };
17885 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17886 let _ = unsafe { Box::from_raw(self.contents.err) };
17891 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17892 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
17893 let contents = if o.result_ok {
17894 let result = unsafe { o.contents.result };
17895 unsafe { o.contents.result = core::ptr::null_mut() };
17896 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
17898 let err = unsafe { o.contents.err };
17899 unsafe { o.contents.err = core::ptr::null_mut(); }
17900 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
17904 result_ok: o.result_ok,
17908 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
17909 fn clone(&self) -> Self {
17910 if self.result_ok {
17911 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
17912 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
17915 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
17916 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17922 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
17923 /// but with all dynamically-allocated buffers duplicated in new buffers.
17924 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
17926 /// The contents of CResult_TxCreationKeysDecodeErrorZ
17927 pub union CResult_TxCreationKeysDecodeErrorZPtr {
17928 /// A pointer to the contents in the success state.
17929 /// Reading from this pointer when `result_ok` is not set is undefined.
17930 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
17931 /// A pointer to the contents in the error state.
17932 /// Reading from this pointer when `result_ok` is set is undefined.
17933 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17936 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
17937 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
17938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17939 pub struct CResult_TxCreationKeysDecodeErrorZ {
17940 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
17941 /// `err` or `result` depending on the state of `result_ok`.
17942 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
17943 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
17944 pub result_ok: bool,
17947 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
17948 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
17949 CResult_TxCreationKeysDecodeErrorZ {
17950 contents: CResult_TxCreationKeysDecodeErrorZPtr {
17951 result: Box::into_raw(Box::new(o)),
17957 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
17958 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
17959 CResult_TxCreationKeysDecodeErrorZ {
17960 contents: CResult_TxCreationKeysDecodeErrorZPtr {
17961 err: Box::into_raw(Box::new(e)),
17966 /// Checks if the given object is currently in the success state
17968 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
17972 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
17973 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
17974 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
17975 fn drop(&mut self) {
17976 if self.result_ok {
17977 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17978 let _ = unsafe { Box::from_raw(self.contents.result) };
17981 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17982 let _ = unsafe { Box::from_raw(self.contents.err) };
17987 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
17988 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
17989 let contents = if o.result_ok {
17990 let result = unsafe { o.contents.result };
17991 unsafe { o.contents.result = core::ptr::null_mut() };
17992 CResult_TxCreationKeysDecodeErrorZPtr { result }
17994 let err = unsafe { o.contents.err };
17995 unsafe { o.contents.err = core::ptr::null_mut(); }
17996 CResult_TxCreationKeysDecodeErrorZPtr { err }
18000 result_ok: o.result_ok,
18004 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
18005 fn clone(&self) -> Self {
18006 if self.result_ok {
18007 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
18008 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
18011 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
18012 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18018 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
18019 /// but with all dynamically-allocated buffers duplicated in new buffers.
18020 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
18022 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
18023 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
18024 /// A pointer to the contents in the success state.
18025 /// Reading from this pointer when `result_ok` is not set is undefined.
18026 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
18027 /// A pointer to the contents in the error state.
18028 /// Reading from this pointer when `result_ok` is set is undefined.
18029 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18032 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
18033 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
18034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18035 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
18036 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
18037 /// `err` or `result` depending on the state of `result_ok`.
18038 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
18039 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
18040 pub result_ok: bool,
18043 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
18044 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
18045 CResult_ChannelPublicKeysDecodeErrorZ {
18046 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18047 result: Box::into_raw(Box::new(o)),
18053 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
18054 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
18055 CResult_ChannelPublicKeysDecodeErrorZ {
18056 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18057 err: Box::into_raw(Box::new(e)),
18062 /// Checks if the given object is currently in the success state
18064 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
18068 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
18069 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
18070 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
18071 fn drop(&mut self) {
18072 if self.result_ok {
18073 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18074 let _ = unsafe { Box::from_raw(self.contents.result) };
18077 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18078 let _ = unsafe { Box::from_raw(self.contents.err) };
18083 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
18084 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
18085 let contents = if o.result_ok {
18086 let result = unsafe { o.contents.result };
18087 unsafe { o.contents.result = core::ptr::null_mut() };
18088 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
18090 let err = unsafe { o.contents.err };
18091 unsafe { o.contents.err = core::ptr::null_mut(); }
18092 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
18096 result_ok: o.result_ok,
18100 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
18101 fn clone(&self) -> Self {
18102 if self.result_ok {
18103 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18104 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
18107 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18108 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18114 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
18115 /// but with all dynamically-allocated buffers duplicated in new buffers.
18116 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
18118 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
18119 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18120 /// A pointer to the contents in the success state.
18121 /// Reading from this pointer when `result_ok` is not set is undefined.
18122 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
18123 /// A pointer to the contents in the error state.
18124 /// Reading from this pointer when `result_ok` is set is undefined.
18125 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18128 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
18129 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
18130 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18131 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
18132 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
18133 /// `err` or `result` depending on the state of `result_ok`.
18134 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
18135 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
18136 pub result_ok: bool,
18139 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
18140 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
18141 CResult_HTLCOutputInCommitmentDecodeErrorZ {
18142 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18143 result: Box::into_raw(Box::new(o)),
18149 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
18150 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
18151 CResult_HTLCOutputInCommitmentDecodeErrorZ {
18152 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18153 err: Box::into_raw(Box::new(e)),
18158 /// Checks if the given object is currently in the success state
18160 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
18164 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
18165 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
18166 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18167 fn drop(&mut self) {
18168 if self.result_ok {
18169 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18170 let _ = unsafe { Box::from_raw(self.contents.result) };
18173 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18174 let _ = unsafe { Box::from_raw(self.contents.err) };
18179 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18180 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
18181 let contents = if o.result_ok {
18182 let result = unsafe { o.contents.result };
18183 unsafe { o.contents.result = core::ptr::null_mut() };
18184 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
18186 let err = unsafe { o.contents.err };
18187 unsafe { o.contents.err = core::ptr::null_mut(); }
18188 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
18192 result_ok: o.result_ok,
18196 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18197 fn clone(&self) -> Self {
18198 if self.result_ok {
18199 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18200 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
18203 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18204 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18210 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
18211 /// but with all dynamically-allocated buffers duplicated in new buffers.
18212 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
18214 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
18215 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18216 /// A pointer to the contents in the success state.
18217 /// Reading from this pointer when `result_ok` is not set is undefined.
18218 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
18219 /// A pointer to the contents in the error state.
18220 /// Reading from this pointer when `result_ok` is set is undefined.
18221 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18224 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
18225 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
18226 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18227 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18228 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
18229 /// `err` or `result` depending on the state of `result_ok`.
18230 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
18231 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
18232 pub result_ok: bool,
18235 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
18236 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18237 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18238 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18239 result: Box::into_raw(Box::new(o)),
18245 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
18246 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18247 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18248 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18249 err: Box::into_raw(Box::new(e)),
18254 /// Checks if the given object is currently in the success state
18256 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
18260 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
18261 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
18262 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18263 fn drop(&mut self) {
18264 if self.result_ok {
18265 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18266 let _ = unsafe { Box::from_raw(self.contents.result) };
18269 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18270 let _ = unsafe { Box::from_raw(self.contents.err) };
18275 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18276 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
18277 let contents = if o.result_ok {
18278 let result = unsafe { o.contents.result };
18279 unsafe { o.contents.result = core::ptr::null_mut() };
18280 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
18282 let err = unsafe { o.contents.err };
18283 unsafe { o.contents.err = core::ptr::null_mut(); }
18284 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
18288 result_ok: o.result_ok,
18292 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18293 fn clone(&self) -> Self {
18294 if self.result_ok {
18295 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18296 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
18299 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18300 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18306 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
18307 /// but with all dynamically-allocated buffers duplicated in new buffers.
18308 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
18310 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
18311 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
18312 /// A pointer to the contents in the success state.
18313 /// Reading from this pointer when `result_ok` is not set is undefined.
18314 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
18315 /// A pointer to the contents in the error state.
18316 /// Reading from this pointer when `result_ok` is set is undefined.
18317 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18320 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
18321 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
18322 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18323 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
18324 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
18325 /// `err` or `result` depending on the state of `result_ok`.
18326 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
18327 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
18328 pub result_ok: bool,
18331 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
18332 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
18333 CResult_ChannelTransactionParametersDecodeErrorZ {
18334 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18335 result: Box::into_raw(Box::new(o)),
18341 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
18342 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
18343 CResult_ChannelTransactionParametersDecodeErrorZ {
18344 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18345 err: Box::into_raw(Box::new(e)),
18350 /// Checks if the given object is currently in the success state
18352 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
18356 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
18357 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
18358 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
18359 fn drop(&mut self) {
18360 if self.result_ok {
18361 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18362 let _ = unsafe { Box::from_raw(self.contents.result) };
18365 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18366 let _ = unsafe { Box::from_raw(self.contents.err) };
18371 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
18372 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
18373 let contents = if o.result_ok {
18374 let result = unsafe { o.contents.result };
18375 unsafe { o.contents.result = core::ptr::null_mut() };
18376 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
18378 let err = unsafe { o.contents.err };
18379 unsafe { o.contents.err = core::ptr::null_mut(); }
18380 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
18384 result_ok: o.result_ok,
18388 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
18389 fn clone(&self) -> Self {
18390 if self.result_ok {
18391 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18392 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
18395 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18396 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18402 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
18403 /// but with all dynamically-allocated buffers duplicated in new buffers.
18404 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
18406 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
18407 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18408 /// A pointer to the contents in the success state.
18409 /// Reading from this pointer when `result_ok` is not set is undefined.
18410 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
18411 /// A pointer to the contents in the error state.
18412 /// Reading from this pointer when `result_ok` is set is undefined.
18413 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18416 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18417 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18418 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18419 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
18420 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
18421 /// `err` or `result` depending on the state of `result_ok`.
18422 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
18423 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
18424 pub result_ok: bool,
18427 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
18428 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
18429 CResult_HolderCommitmentTransactionDecodeErrorZ {
18430 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18431 result: Box::into_raw(Box::new(o)),
18437 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
18438 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
18439 CResult_HolderCommitmentTransactionDecodeErrorZ {
18440 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18441 err: Box::into_raw(Box::new(e)),
18446 /// Checks if the given object is currently in the success state
18448 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
18452 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
18453 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
18454 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
18455 fn drop(&mut self) {
18456 if self.result_ok {
18457 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18458 let _ = unsafe { Box::from_raw(self.contents.result) };
18461 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18462 let _ = unsafe { Box::from_raw(self.contents.err) };
18467 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
18468 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
18469 let contents = if o.result_ok {
18470 let result = unsafe { o.contents.result };
18471 unsafe { o.contents.result = core::ptr::null_mut() };
18472 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
18474 let err = unsafe { o.contents.err };
18475 unsafe { o.contents.err = core::ptr::null_mut(); }
18476 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
18480 result_ok: o.result_ok,
18484 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
18485 fn clone(&self) -> Self {
18486 if self.result_ok {
18487 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18488 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
18491 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18492 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18498 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
18499 /// but with all dynamically-allocated buffers duplicated in new buffers.
18500 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
18502 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
18503 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18504 /// A pointer to the contents in the success state.
18505 /// Reading from this pointer when `result_ok` is not set is undefined.
18506 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
18507 /// A pointer to the contents in the error state.
18508 /// Reading from this pointer when `result_ok` is set is undefined.
18509 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18512 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18513 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18514 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18515 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
18516 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
18517 /// `err` or `result` depending on the state of `result_ok`.
18518 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
18519 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
18520 pub result_ok: bool,
18523 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
18524 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
18525 CResult_BuiltCommitmentTransactionDecodeErrorZ {
18526 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18527 result: Box::into_raw(Box::new(o)),
18533 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
18534 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
18535 CResult_BuiltCommitmentTransactionDecodeErrorZ {
18536 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18537 err: Box::into_raw(Box::new(e)),
18542 /// Checks if the given object is currently in the success state
18544 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
18548 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
18549 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
18550 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18551 fn drop(&mut self) {
18552 if self.result_ok {
18553 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18554 let _ = unsafe { Box::from_raw(self.contents.result) };
18557 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18558 let _ = unsafe { Box::from_raw(self.contents.err) };
18563 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18564 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
18565 let contents = if o.result_ok {
18566 let result = unsafe { o.contents.result };
18567 unsafe { o.contents.result = core::ptr::null_mut() };
18568 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
18570 let err = unsafe { o.contents.err };
18571 unsafe { o.contents.err = core::ptr::null_mut(); }
18572 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
18576 result_ok: o.result_ok,
18580 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18581 fn clone(&self) -> Self {
18582 if self.result_ok {
18583 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18584 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
18587 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18588 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18594 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
18595 /// but with all dynamically-allocated buffers duplicated in new buffers.
18596 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
18598 /// The contents of CResult_TrustedClosingTransactionNoneZ
18599 pub union CResult_TrustedClosingTransactionNoneZPtr {
18600 /// A pointer to the contents in the success state.
18601 /// Reading from this pointer when `result_ok` is not set is undefined.
18602 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
18603 /// Note that this value is always NULL, as there are no contents in the Err variant
18604 pub err: *mut core::ffi::c_void,
18607 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
18608 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
18609 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18610 pub struct CResult_TrustedClosingTransactionNoneZ {
18611 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
18612 /// `err` or `result` depending on the state of `result_ok`.
18613 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
18614 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
18615 pub result_ok: bool,
18618 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
18619 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
18620 CResult_TrustedClosingTransactionNoneZ {
18621 contents: CResult_TrustedClosingTransactionNoneZPtr {
18622 result: Box::into_raw(Box::new(o)),
18628 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
18629 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
18630 CResult_TrustedClosingTransactionNoneZ {
18631 contents: CResult_TrustedClosingTransactionNoneZPtr {
18632 err: core::ptr::null_mut(),
18637 /// Checks if the given object is currently in the success state
18639 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
18643 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
18644 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
18645 impl Drop for CResult_TrustedClosingTransactionNoneZ {
18646 fn drop(&mut self) {
18647 if self.result_ok {
18648 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18649 let _ = unsafe { Box::from_raw(self.contents.result) };
18655 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
18656 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
18657 let contents = if o.result_ok {
18658 let result = unsafe { o.contents.result };
18659 unsafe { o.contents.result = core::ptr::null_mut() };
18660 CResult_TrustedClosingTransactionNoneZPtr { result }
18662 let _ = unsafe { Box::from_raw(o.contents.err) };
18663 o.contents.err = core::ptr::null_mut();
18664 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
18668 result_ok: o.result_ok,
18673 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
18674 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
18675 /// A pointer to the contents in the success state.
18676 /// Reading from this pointer when `result_ok` is not set is undefined.
18677 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
18678 /// A pointer to the contents in the error state.
18679 /// Reading from this pointer when `result_ok` is set is undefined.
18680 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18683 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18684 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18685 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18686 pub struct CResult_CommitmentTransactionDecodeErrorZ {
18687 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
18688 /// `err` or `result` depending on the state of `result_ok`.
18689 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
18690 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
18691 pub result_ok: bool,
18694 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
18695 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
18696 CResult_CommitmentTransactionDecodeErrorZ {
18697 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
18698 result: Box::into_raw(Box::new(o)),
18704 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
18705 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
18706 CResult_CommitmentTransactionDecodeErrorZ {
18707 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
18708 err: Box::into_raw(Box::new(e)),
18713 /// Checks if the given object is currently in the success state
18715 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
18719 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
18720 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
18721 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
18722 fn drop(&mut self) {
18723 if self.result_ok {
18724 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18725 let _ = unsafe { Box::from_raw(self.contents.result) };
18728 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18729 let _ = unsafe { Box::from_raw(self.contents.err) };
18734 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
18735 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
18736 let contents = if o.result_ok {
18737 let result = unsafe { o.contents.result };
18738 unsafe { o.contents.result = core::ptr::null_mut() };
18739 CResult_CommitmentTransactionDecodeErrorZPtr { result }
18741 let err = unsafe { o.contents.err };
18742 unsafe { o.contents.err = core::ptr::null_mut(); }
18743 CResult_CommitmentTransactionDecodeErrorZPtr { err }
18747 result_ok: o.result_ok,
18751 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
18752 fn clone(&self) -> Self {
18753 if self.result_ok {
18754 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
18755 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
18758 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
18759 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18765 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
18766 /// but with all dynamically-allocated buffers duplicated in new buffers.
18767 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
18769 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
18770 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
18771 /// A pointer to the contents in the success state.
18772 /// Reading from this pointer when `result_ok` is not set is undefined.
18773 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
18774 /// Note that this value is always NULL, as there are no contents in the Err variant
18775 pub err: *mut core::ffi::c_void,
18778 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
18779 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
18780 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18781 pub struct CResult_TrustedCommitmentTransactionNoneZ {
18782 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
18783 /// `err` or `result` depending on the state of `result_ok`.
18784 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
18785 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
18786 pub result_ok: bool,
18789 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
18790 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
18791 CResult_TrustedCommitmentTransactionNoneZ {
18792 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
18793 result: Box::into_raw(Box::new(o)),
18799 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
18800 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
18801 CResult_TrustedCommitmentTransactionNoneZ {
18802 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
18803 err: core::ptr::null_mut(),
18808 /// Checks if the given object is currently in the success state
18810 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
18814 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
18815 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
18816 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
18817 fn drop(&mut self) {
18818 if self.result_ok {
18819 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18820 let _ = unsafe { Box::from_raw(self.contents.result) };
18826 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
18827 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
18828 let contents = if o.result_ok {
18829 let result = unsafe { o.contents.result };
18830 unsafe { o.contents.result = core::ptr::null_mut() };
18831 CResult_TrustedCommitmentTransactionNoneZPtr { result }
18833 let _ = unsafe { Box::from_raw(o.contents.err) };
18834 o.contents.err = core::ptr::null_mut();
18835 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
18839 result_ok: o.result_ok,
18844 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
18845 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
18846 /// A pointer to the contents in the success state.
18847 /// Reading from this pointer when `result_ok` is not set is undefined.
18848 pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
18849 /// Note that this value is always NULL, as there are no contents in the Err variant
18850 pub err: *mut core::ffi::c_void,
18853 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
18854 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
18855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18856 pub struct CResult_CVec_ECDSASignatureZNoneZ {
18857 /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
18858 /// `err` or `result` depending on the state of `result_ok`.
18859 pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
18860 /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
18861 pub result_ok: bool,
18864 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
18865 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
18866 CResult_CVec_ECDSASignatureZNoneZ {
18867 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
18868 result: Box::into_raw(Box::new(o)),
18874 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
18875 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
18876 CResult_CVec_ECDSASignatureZNoneZ {
18877 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
18878 err: core::ptr::null_mut(),
18883 /// Checks if the given object is currently in the success state
18885 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
18889 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
18890 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
18891 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
18892 fn drop(&mut self) {
18893 if self.result_ok {
18894 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18895 let _ = unsafe { Box::from_raw(self.contents.result) };
18901 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
18902 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> Self {
18903 let contents = if o.result_ok {
18904 let result = unsafe { o.contents.result };
18905 unsafe { o.contents.result = core::ptr::null_mut() };
18906 CResult_CVec_ECDSASignatureZNoneZPtr { result }
18908 let _ = unsafe { Box::from_raw(o.contents.err) };
18909 o.contents.err = core::ptr::null_mut();
18910 CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
18914 result_ok: o.result_ok,
18918 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
18919 fn clone(&self) -> Self {
18920 if self.result_ok {
18921 Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
18922 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
18925 Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
18926 err: core::ptr::null_mut()
18932 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
18933 /// but with all dynamically-allocated buffers duplicated in new buffers.
18934 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
18937 /// An enum which can either contain a usize or not
18938 pub enum COption_usizeZ {
18939 /// When we're in this state, this COption_usizeZ contains a usize
18941 /// When we're in this state, this COption_usizeZ contains nothing
18944 impl COption_usizeZ {
18945 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18946 if let Self::None = self { false } else { true }
18948 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18951 #[allow(unused)] pub(crate) fn take(mut self) -> usize {
18952 if let Self::Some(v) = self { v } else { unreachable!() }
18956 /// Constructs a new COption_usizeZ containing a usize
18957 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
18958 COption_usizeZ::Some(o)
18961 /// Constructs a new COption_usizeZ containing nothing
18962 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
18963 COption_usizeZ::None
18966 /// Frees any resources associated with the usize, if we are in the Some state
18967 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
18969 /// Creates a new COption_usizeZ which has the same data as `orig`
18970 /// but with all dynamically-allocated buffers duplicated in new buffers.
18971 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
18973 /// The contents of CResult_ShutdownScriptDecodeErrorZ
18974 pub union CResult_ShutdownScriptDecodeErrorZPtr {
18975 /// A pointer to the contents in the success state.
18976 /// Reading from this pointer when `result_ok` is not set is undefined.
18977 pub result: *mut crate::lightning::ln::script::ShutdownScript,
18978 /// A pointer to the contents in the error state.
18979 /// Reading from this pointer when `result_ok` is set is undefined.
18980 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18983 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
18984 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
18985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18986 pub struct CResult_ShutdownScriptDecodeErrorZ {
18987 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
18988 /// `err` or `result` depending on the state of `result_ok`.
18989 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
18990 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
18991 pub result_ok: bool,
18994 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
18995 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
18996 CResult_ShutdownScriptDecodeErrorZ {
18997 contents: CResult_ShutdownScriptDecodeErrorZPtr {
18998 result: Box::into_raw(Box::new(o)),
19004 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
19005 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
19006 CResult_ShutdownScriptDecodeErrorZ {
19007 contents: CResult_ShutdownScriptDecodeErrorZPtr {
19008 err: Box::into_raw(Box::new(e)),
19013 /// Checks if the given object is currently in the success state
19015 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
19019 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
19020 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
19021 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
19022 fn drop(&mut self) {
19023 if self.result_ok {
19024 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19025 let _ = unsafe { Box::from_raw(self.contents.result) };
19028 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19029 let _ = unsafe { Box::from_raw(self.contents.err) };
19034 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
19035 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
19036 let contents = if o.result_ok {
19037 let result = unsafe { o.contents.result };
19038 unsafe { o.contents.result = core::ptr::null_mut() };
19039 CResult_ShutdownScriptDecodeErrorZPtr { result }
19041 let err = unsafe { o.contents.err };
19042 unsafe { o.contents.err = core::ptr::null_mut(); }
19043 CResult_ShutdownScriptDecodeErrorZPtr { err }
19047 result_ok: o.result_ok,
19051 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
19052 fn clone(&self) -> Self {
19053 if self.result_ok {
19054 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
19055 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
19058 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
19059 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19065 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
19066 /// but with all dynamically-allocated buffers duplicated in new buffers.
19067 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
19069 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
19070 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19071 /// A pointer to the contents in the success state.
19072 /// Reading from this pointer when `result_ok` is not set is undefined.
19073 pub result: *mut crate::lightning::ln::script::ShutdownScript,
19074 /// A pointer to the contents in the error state.
19075 /// Reading from this pointer when `result_ok` is set is undefined.
19076 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
19079 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
19080 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
19081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19082 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
19083 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
19084 /// `err` or `result` depending on the state of `result_ok`.
19085 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
19086 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
19087 pub result_ok: bool,
19090 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
19091 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
19092 CResult_ShutdownScriptInvalidShutdownScriptZ {
19093 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19094 result: Box::into_raw(Box::new(o)),
19100 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
19101 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
19102 CResult_ShutdownScriptInvalidShutdownScriptZ {
19103 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19104 err: Box::into_raw(Box::new(e)),
19109 /// Checks if the given object is currently in the success state
19111 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
19115 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
19116 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
19117 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
19118 fn drop(&mut self) {
19119 if self.result_ok {
19120 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19121 let _ = unsafe { Box::from_raw(self.contents.result) };
19124 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19125 let _ = unsafe { Box::from_raw(self.contents.err) };
19130 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
19131 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
19132 let contents = if o.result_ok {
19133 let result = unsafe { o.contents.result };
19134 unsafe { o.contents.result = core::ptr::null_mut() };
19135 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
19137 let err = unsafe { o.contents.err };
19138 unsafe { o.contents.err = core::ptr::null_mut(); }
19139 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
19143 result_ok: o.result_ok,
19147 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
19148 fn clone(&self) -> Self {
19149 if self.result_ok {
19150 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19151 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
19154 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19155 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
19161 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
19162 /// but with all dynamically-allocated buffers duplicated in new buffers.
19163 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
19165 /// The contents of CResult_PaymentPurposeDecodeErrorZ
19166 pub union CResult_PaymentPurposeDecodeErrorZPtr {
19167 /// A pointer to the contents in the success state.
19168 /// Reading from this pointer when `result_ok` is not set is undefined.
19169 pub result: *mut crate::lightning::events::PaymentPurpose,
19170 /// A pointer to the contents in the error state.
19171 /// Reading from this pointer when `result_ok` is set is undefined.
19172 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19175 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
19176 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
19177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19178 pub struct CResult_PaymentPurposeDecodeErrorZ {
19179 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
19180 /// `err` or `result` depending on the state of `result_ok`.
19181 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
19182 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
19183 pub result_ok: bool,
19186 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
19187 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
19188 CResult_PaymentPurposeDecodeErrorZ {
19189 contents: CResult_PaymentPurposeDecodeErrorZPtr {
19190 result: Box::into_raw(Box::new(o)),
19196 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
19197 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
19198 CResult_PaymentPurposeDecodeErrorZ {
19199 contents: CResult_PaymentPurposeDecodeErrorZPtr {
19200 err: Box::into_raw(Box::new(e)),
19205 /// Checks if the given object is currently in the success state
19207 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
19211 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
19212 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
19213 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
19214 fn drop(&mut self) {
19215 if self.result_ok {
19216 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19217 let _ = unsafe { Box::from_raw(self.contents.result) };
19220 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19221 let _ = unsafe { Box::from_raw(self.contents.err) };
19226 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
19227 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
19228 let contents = if o.result_ok {
19229 let result = unsafe { o.contents.result };
19230 unsafe { o.contents.result = core::ptr::null_mut() };
19231 CResult_PaymentPurposeDecodeErrorZPtr { result }
19233 let err = unsafe { o.contents.err };
19234 unsafe { o.contents.err = core::ptr::null_mut(); }
19235 CResult_PaymentPurposeDecodeErrorZPtr { err }
19239 result_ok: o.result_ok,
19243 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
19244 fn clone(&self) -> Self {
19245 if self.result_ok {
19246 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
19247 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
19250 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
19251 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19257 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
19258 /// but with all dynamically-allocated buffers duplicated in new buffers.
19259 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
19261 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
19262 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
19263 /// A pointer to the contents in the success state.
19264 /// Reading from this pointer when `result_ok` is not set is undefined.
19265 pub result: *mut crate::lightning::events::ClaimedHTLC,
19266 /// A pointer to the contents in the error state.
19267 /// Reading from this pointer when `result_ok` is set is undefined.
19268 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19271 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
19272 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
19273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19274 pub struct CResult_ClaimedHTLCDecodeErrorZ {
19275 /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
19276 /// `err` or `result` depending on the state of `result_ok`.
19277 pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
19278 /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
19279 pub result_ok: bool,
19282 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
19283 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
19284 CResult_ClaimedHTLCDecodeErrorZ {
19285 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19286 result: Box::into_raw(Box::new(o)),
19292 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
19293 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
19294 CResult_ClaimedHTLCDecodeErrorZ {
19295 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19296 err: Box::into_raw(Box::new(e)),
19301 /// Checks if the given object is currently in the success state
19303 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
19307 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
19308 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
19309 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
19310 fn drop(&mut self) {
19311 if self.result_ok {
19312 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19313 let _ = unsafe { Box::from_raw(self.contents.result) };
19316 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19317 let _ = unsafe { Box::from_raw(self.contents.err) };
19322 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
19323 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
19324 let contents = if o.result_ok {
19325 let result = unsafe { o.contents.result };
19326 unsafe { o.contents.result = core::ptr::null_mut() };
19327 CResult_ClaimedHTLCDecodeErrorZPtr { result }
19329 let err = unsafe { o.contents.err };
19330 unsafe { o.contents.err = core::ptr::null_mut(); }
19331 CResult_ClaimedHTLCDecodeErrorZPtr { err }
19335 result_ok: o.result_ok,
19339 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
19340 fn clone(&self) -> Self {
19341 if self.result_ok {
19342 Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19343 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
19346 Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19347 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19353 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
19354 /// but with all dynamically-allocated buffers duplicated in new buffers.
19355 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
19358 /// An enum which can either contain a crate::lightning::events::PathFailure or not
19359 pub enum COption_PathFailureZ {
19360 /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
19361 Some(crate::lightning::events::PathFailure),
19362 /// When we're in this state, this COption_PathFailureZ contains nothing
19365 impl COption_PathFailureZ {
19366 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19367 if let Self::None = self { false } else { true }
19369 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19372 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
19373 if let Self::Some(v) = self { v } else { unreachable!() }
19377 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
19378 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
19379 COption_PathFailureZ::Some(o)
19382 /// Constructs a new COption_PathFailureZ containing nothing
19383 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
19384 COption_PathFailureZ::None
19387 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
19388 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
19390 /// Creates a new COption_PathFailureZ which has the same data as `orig`
19391 /// but with all dynamically-allocated buffers duplicated in new buffers.
19392 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
19394 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
19395 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
19396 /// A pointer to the contents in the success state.
19397 /// Reading from this pointer when `result_ok` is not set is undefined.
19398 pub result: *mut crate::c_types::derived::COption_PathFailureZ,
19399 /// A pointer to the contents in the error state.
19400 /// Reading from this pointer when `result_ok` is set is undefined.
19401 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19404 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
19405 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19406 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19407 pub struct CResult_COption_PathFailureZDecodeErrorZ {
19408 /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
19409 /// `err` or `result` depending on the state of `result_ok`.
19410 pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
19411 /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
19412 pub result_ok: bool,
19415 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
19416 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
19417 CResult_COption_PathFailureZDecodeErrorZ {
19418 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19419 result: Box::into_raw(Box::new(o)),
19425 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
19426 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
19427 CResult_COption_PathFailureZDecodeErrorZ {
19428 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19429 err: Box::into_raw(Box::new(e)),
19434 /// Checks if the given object is currently in the success state
19436 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
19440 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
19441 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
19442 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
19443 fn drop(&mut self) {
19444 if self.result_ok {
19445 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19446 let _ = unsafe { Box::from_raw(self.contents.result) };
19449 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19450 let _ = unsafe { Box::from_raw(self.contents.err) };
19455 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
19456 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
19457 let contents = if o.result_ok {
19458 let result = unsafe { o.contents.result };
19459 unsafe { o.contents.result = core::ptr::null_mut() };
19460 CResult_COption_PathFailureZDecodeErrorZPtr { result }
19462 let err = unsafe { o.contents.err };
19463 unsafe { o.contents.err = core::ptr::null_mut(); }
19464 CResult_COption_PathFailureZDecodeErrorZPtr { err }
19468 result_ok: o.result_ok,
19472 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
19473 fn clone(&self) -> Self {
19474 if self.result_ok {
19475 Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19476 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
19479 Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19480 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19486 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
19487 /// but with all dynamically-allocated buffers duplicated in new buffers.
19488 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
19491 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
19492 pub enum COption_ClosureReasonZ {
19493 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
19494 Some(crate::lightning::events::ClosureReason),
19495 /// When we're in this state, this COption_ClosureReasonZ contains nothing
19498 impl COption_ClosureReasonZ {
19499 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19500 if let Self::None = self { false } else { true }
19502 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19505 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
19506 if let Self::Some(v) = self { v } else { unreachable!() }
19510 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
19511 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
19512 COption_ClosureReasonZ::Some(o)
19515 /// Constructs a new COption_ClosureReasonZ containing nothing
19516 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
19517 COption_ClosureReasonZ::None
19520 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
19521 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
19523 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
19524 /// but with all dynamically-allocated buffers duplicated in new buffers.
19525 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
19527 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
19528 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
19529 /// A pointer to the contents in the success state.
19530 /// Reading from this pointer when `result_ok` is not set is undefined.
19531 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
19532 /// A pointer to the contents in the error state.
19533 /// Reading from this pointer when `result_ok` is set is undefined.
19534 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19537 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
19538 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19540 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
19541 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
19542 /// `err` or `result` depending on the state of `result_ok`.
19543 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
19544 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
19545 pub result_ok: bool,
19548 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
19549 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
19550 CResult_COption_ClosureReasonZDecodeErrorZ {
19551 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19552 result: Box::into_raw(Box::new(o)),
19558 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
19559 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
19560 CResult_COption_ClosureReasonZDecodeErrorZ {
19561 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19562 err: Box::into_raw(Box::new(e)),
19567 /// Checks if the given object is currently in the success state
19569 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
19573 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
19574 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
19575 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
19576 fn drop(&mut self) {
19577 if self.result_ok {
19578 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19579 let _ = unsafe { Box::from_raw(self.contents.result) };
19582 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19583 let _ = unsafe { Box::from_raw(self.contents.err) };
19588 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
19589 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
19590 let contents = if o.result_ok {
19591 let result = unsafe { o.contents.result };
19592 unsafe { o.contents.result = core::ptr::null_mut() };
19593 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
19595 let err = unsafe { o.contents.err };
19596 unsafe { o.contents.err = core::ptr::null_mut(); }
19597 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
19601 result_ok: o.result_ok,
19605 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
19606 fn clone(&self) -> Self {
19607 if self.result_ok {
19608 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19609 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
19612 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19613 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19619 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
19620 /// but with all dynamically-allocated buffers duplicated in new buffers.
19621 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
19624 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
19625 pub enum COption_HTLCDestinationZ {
19626 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
19627 Some(crate::lightning::events::HTLCDestination),
19628 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
19631 impl COption_HTLCDestinationZ {
19632 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19633 if let Self::None = self { false } else { true }
19635 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19638 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
19639 if let Self::Some(v) = self { v } else { unreachable!() }
19643 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
19644 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
19645 COption_HTLCDestinationZ::Some(o)
19648 /// Constructs a new COption_HTLCDestinationZ containing nothing
19649 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
19650 COption_HTLCDestinationZ::None
19653 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
19654 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
19656 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
19657 /// but with all dynamically-allocated buffers duplicated in new buffers.
19658 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
19660 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
19661 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19662 /// A pointer to the contents in the success state.
19663 /// Reading from this pointer when `result_ok` is not set is undefined.
19664 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
19665 /// A pointer to the contents in the error state.
19666 /// Reading from this pointer when `result_ok` is set is undefined.
19667 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19670 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
19671 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19672 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19673 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
19674 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
19675 /// `err` or `result` depending on the state of `result_ok`.
19676 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
19677 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
19678 pub result_ok: bool,
19681 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
19682 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
19683 CResult_COption_HTLCDestinationZDecodeErrorZ {
19684 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19685 result: Box::into_raw(Box::new(o)),
19691 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
19692 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
19693 CResult_COption_HTLCDestinationZDecodeErrorZ {
19694 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19695 err: Box::into_raw(Box::new(e)),
19700 /// Checks if the given object is currently in the success state
19702 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
19706 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
19707 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
19708 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
19709 fn drop(&mut self) {
19710 if self.result_ok {
19711 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19712 let _ = unsafe { Box::from_raw(self.contents.result) };
19715 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19716 let _ = unsafe { Box::from_raw(self.contents.err) };
19721 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
19722 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
19723 let contents = if o.result_ok {
19724 let result = unsafe { o.contents.result };
19725 unsafe { o.contents.result = core::ptr::null_mut() };
19726 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
19728 let err = unsafe { o.contents.err };
19729 unsafe { o.contents.err = core::ptr::null_mut(); }
19730 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
19734 result_ok: o.result_ok,
19738 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
19739 fn clone(&self) -> Self {
19740 if self.result_ok {
19741 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19742 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
19745 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19746 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19752 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
19753 /// but with all dynamically-allocated buffers duplicated in new buffers.
19754 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
19756 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
19757 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
19758 /// A pointer to the contents in the success state.
19759 /// Reading from this pointer when `result_ok` is not set is undefined.
19760 pub result: *mut crate::lightning::events::PaymentFailureReason,
19761 /// A pointer to the contents in the error state.
19762 /// Reading from this pointer when `result_ok` is set is undefined.
19763 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19766 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
19767 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
19768 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19769 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
19770 /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
19771 /// `err` or `result` depending on the state of `result_ok`.
19772 pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
19773 /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
19774 pub result_ok: bool,
19777 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
19778 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
19779 CResult_PaymentFailureReasonDecodeErrorZ {
19780 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
19781 result: Box::into_raw(Box::new(o)),
19787 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
19788 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
19789 CResult_PaymentFailureReasonDecodeErrorZ {
19790 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
19791 err: Box::into_raw(Box::new(e)),
19796 /// Checks if the given object is currently in the success state
19798 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
19802 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
19803 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
19804 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
19805 fn drop(&mut self) {
19806 if self.result_ok {
19807 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19808 let _ = unsafe { Box::from_raw(self.contents.result) };
19811 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19812 let _ = unsafe { Box::from_raw(self.contents.err) };
19817 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
19818 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
19819 let contents = if o.result_ok {
19820 let result = unsafe { o.contents.result };
19821 unsafe { o.contents.result = core::ptr::null_mut() };
19822 CResult_PaymentFailureReasonDecodeErrorZPtr { result }
19824 let err = unsafe { o.contents.err };
19825 unsafe { o.contents.err = core::ptr::null_mut(); }
19826 CResult_PaymentFailureReasonDecodeErrorZPtr { err }
19830 result_ok: o.result_ok,
19834 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
19835 fn clone(&self) -> Self {
19836 if self.result_ok {
19837 Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
19838 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
19841 Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
19842 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19848 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
19849 /// but with all dynamically-allocated buffers duplicated in new buffers.
19850 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
19853 /// An enum which can either contain a crate::c_types::U128 or not
19854 pub enum COption_U128Z {
19855 /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
19856 Some(crate::c_types::U128),
19857 /// When we're in this state, this COption_U128Z contains nothing
19860 impl COption_U128Z {
19861 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19862 if let Self::None = self { false } else { true }
19864 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19867 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
19868 if let Self::Some(v) = self { v } else { unreachable!() }
19872 /// Constructs a new COption_U128Z containing a crate::c_types::U128
19873 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
19874 COption_U128Z::Some(o)
19877 /// Constructs a new COption_U128Z containing nothing
19878 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
19879 COption_U128Z::None
19882 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
19883 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
19885 /// Creates a new COption_U128Z which has the same data as `orig`
19886 /// but with all dynamically-allocated buffers duplicated in new buffers.
19887 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
19889 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
19890 /// This corresponds to std::vector in C++
19891 pub struct CVec_ClaimedHTLCZ {
19892 /// The elements in the array.
19893 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
19894 pub data: *mut crate::lightning::events::ClaimedHTLC,
19895 /// The number of elements pointed to by `data`.
19898 impl CVec_ClaimedHTLCZ {
19899 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
19900 if self.datalen == 0 { return Vec::new(); }
19901 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
19902 self.data = core::ptr::null_mut();
19906 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
19907 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
19910 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
19911 fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
19912 let datalen = v.len();
19913 let data = Box::into_raw(v.into_boxed_slice());
19914 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
19918 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
19919 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
19920 impl Drop for CVec_ClaimedHTLCZ {
19921 fn drop(&mut self) {
19922 if self.datalen == 0 { return; }
19923 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
19926 impl Clone for CVec_ClaimedHTLCZ {
19927 fn clone(&self) -> Self {
19928 let mut res = Vec::new();
19929 if self.datalen == 0 { return Self::from(res); }
19930 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
19936 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
19937 pub enum COption_PaymentFailureReasonZ {
19938 /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
19939 Some(crate::lightning::events::PaymentFailureReason),
19940 /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
19943 impl COption_PaymentFailureReasonZ {
19944 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19945 if let Self::None = self { false } else { true }
19947 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19950 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
19951 if let Self::Some(v) = self { v } else { unreachable!() }
19955 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
19956 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
19957 COption_PaymentFailureReasonZ::Some(o)
19960 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
19961 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
19962 COption_PaymentFailureReasonZ::None
19965 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
19966 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
19968 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
19969 /// but with all dynamically-allocated buffers duplicated in new buffers.
19970 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
19973 /// An enum which can either contain a crate::lightning::events::Event or not
19974 pub enum COption_EventZ {
19975 /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
19976 Some(crate::lightning::events::Event),
19977 /// When we're in this state, this COption_EventZ contains nothing
19980 impl COption_EventZ {
19981 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19982 if let Self::None = self { false } else { true }
19984 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19987 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
19988 if let Self::Some(v) = self { v } else { unreachable!() }
19992 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
19993 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
19994 COption_EventZ::Some(o)
19997 /// Constructs a new COption_EventZ containing nothing
19998 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
19999 COption_EventZ::None
20002 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
20003 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
20005 /// Creates a new COption_EventZ which has the same data as `orig`
20006 /// but with all dynamically-allocated buffers duplicated in new buffers.
20007 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
20009 /// The contents of CResult_COption_EventZDecodeErrorZ
20010 pub union CResult_COption_EventZDecodeErrorZPtr {
20011 /// A pointer to the contents in the success state.
20012 /// Reading from this pointer when `result_ok` is not set is undefined.
20013 pub result: *mut crate::c_types::derived::COption_EventZ,
20014 /// A pointer to the contents in the error state.
20015 /// Reading from this pointer when `result_ok` is set is undefined.
20016 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20019 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
20020 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
20021 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20022 pub struct CResult_COption_EventZDecodeErrorZ {
20023 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
20024 /// `err` or `result` depending on the state of `result_ok`.
20025 pub contents: CResult_COption_EventZDecodeErrorZPtr,
20026 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
20027 pub result_ok: bool,
20030 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
20031 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
20032 CResult_COption_EventZDecodeErrorZ {
20033 contents: CResult_COption_EventZDecodeErrorZPtr {
20034 result: Box::into_raw(Box::new(o)),
20040 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
20041 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
20042 CResult_COption_EventZDecodeErrorZ {
20043 contents: CResult_COption_EventZDecodeErrorZPtr {
20044 err: Box::into_raw(Box::new(e)),
20049 /// Checks if the given object is currently in the success state
20051 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
20055 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
20056 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
20057 impl Drop for CResult_COption_EventZDecodeErrorZ {
20058 fn drop(&mut self) {
20059 if self.result_ok {
20060 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20061 let _ = unsafe { Box::from_raw(self.contents.result) };
20064 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20065 let _ = unsafe { Box::from_raw(self.contents.err) };
20070 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
20071 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
20072 let contents = if o.result_ok {
20073 let result = unsafe { o.contents.result };
20074 unsafe { o.contents.result = core::ptr::null_mut() };
20075 CResult_COption_EventZDecodeErrorZPtr { result }
20077 let err = unsafe { o.contents.err };
20078 unsafe { o.contents.err = core::ptr::null_mut(); }
20079 CResult_COption_EventZDecodeErrorZPtr { err }
20083 result_ok: o.result_ok,
20087 impl Clone for CResult_COption_EventZDecodeErrorZ {
20088 fn clone(&self) -> Self {
20089 if self.result_ok {
20090 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
20091 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
20094 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
20095 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20101 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
20102 /// but with all dynamically-allocated buffers duplicated in new buffers.
20103 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
20105 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
20106 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
20107 /// A pointer to the contents in the success state.
20108 /// Reading from this pointer when `result_ok` is not set is undefined.
20109 pub result: *mut crate::lightning_invoice::SiPrefix,
20110 /// A pointer to the contents in the error state.
20111 /// Reading from this pointer when `result_ok` is set is undefined.
20112 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
20115 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
20116 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
20117 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20118 pub struct CResult_SiPrefixBolt11ParseErrorZ {
20119 /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
20120 /// `err` or `result` depending on the state of `result_ok`.
20121 pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
20122 /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
20123 pub result_ok: bool,
20126 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
20127 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
20128 CResult_SiPrefixBolt11ParseErrorZ {
20129 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20130 result: Box::into_raw(Box::new(o)),
20136 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
20137 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
20138 CResult_SiPrefixBolt11ParseErrorZ {
20139 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20140 err: Box::into_raw(Box::new(e)),
20145 /// Checks if the given object is currently in the success state
20147 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
20151 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
20152 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
20153 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
20154 fn drop(&mut self) {
20155 if self.result_ok {
20156 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20157 let _ = unsafe { Box::from_raw(self.contents.result) };
20160 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20161 let _ = unsafe { Box::from_raw(self.contents.err) };
20166 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
20167 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
20168 let contents = if o.result_ok {
20169 let result = unsafe { o.contents.result };
20170 unsafe { o.contents.result = core::ptr::null_mut() };
20171 CResult_SiPrefixBolt11ParseErrorZPtr { result }
20173 let err = unsafe { o.contents.err };
20174 unsafe { o.contents.err = core::ptr::null_mut(); }
20175 CResult_SiPrefixBolt11ParseErrorZPtr { err }
20179 result_ok: o.result_ok,
20183 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
20184 fn clone(&self) -> Self {
20185 if self.result_ok {
20186 Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20187 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
20190 Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20191 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
20197 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
20198 /// but with all dynamically-allocated buffers duplicated in new buffers.
20199 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
20201 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
20202 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20203 /// A pointer to the contents in the success state.
20204 /// Reading from this pointer when `result_ok` is not set is undefined.
20205 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20206 /// A pointer to the contents in the error state.
20207 /// Reading from this pointer when `result_ok` is set is undefined.
20208 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
20211 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
20212 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
20213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20214 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20215 /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
20216 /// `err` or `result` depending on the state of `result_ok`.
20217 pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
20218 /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
20219 pub result_ok: bool,
20222 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
20223 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20224 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20225 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20226 result: Box::into_raw(Box::new(o)),
20232 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
20233 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20234 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20235 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20236 err: Box::into_raw(Box::new(e)),
20241 /// Checks if the given object is currently in the success state
20243 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
20247 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
20248 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
20249 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20250 fn drop(&mut self) {
20251 if self.result_ok {
20252 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20253 let _ = unsafe { Box::from_raw(self.contents.result) };
20256 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20257 let _ = unsafe { Box::from_raw(self.contents.err) };
20262 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20263 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
20264 let contents = if o.result_ok {
20265 let result = unsafe { o.contents.result };
20266 unsafe { o.contents.result = core::ptr::null_mut() };
20267 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
20269 let err = unsafe { o.contents.err };
20270 unsafe { o.contents.err = core::ptr::null_mut(); }
20271 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
20275 result_ok: o.result_ok,
20279 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20280 fn clone(&self) -> Self {
20281 if self.result_ok {
20282 Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20283 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20286 Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20287 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
20293 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
20294 /// but with all dynamically-allocated buffers duplicated in new buffers.
20295 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
20297 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
20298 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20299 /// A pointer to the contents in the success state.
20300 /// Reading from this pointer when `result_ok` is not set is undefined.
20301 pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
20302 /// A pointer to the contents in the error state.
20303 /// Reading from this pointer when `result_ok` is set is undefined.
20304 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
20307 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
20308 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
20309 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20310 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20311 /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
20312 /// `err` or `result` depending on the state of `result_ok`.
20313 pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
20314 /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
20315 pub result_ok: bool,
20318 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
20319 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20320 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20321 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20322 result: Box::into_raw(Box::new(o)),
20328 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
20329 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20330 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20331 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20332 err: Box::into_raw(Box::new(e)),
20337 /// Checks if the given object is currently in the success state
20339 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
20343 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
20344 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
20345 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20346 fn drop(&mut self) {
20347 if self.result_ok {
20348 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20349 let _ = unsafe { Box::from_raw(self.contents.result) };
20352 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20353 let _ = unsafe { Box::from_raw(self.contents.err) };
20358 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20359 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
20360 let contents = if o.result_ok {
20361 let result = unsafe { o.contents.result };
20362 unsafe { o.contents.result = core::ptr::null_mut() };
20363 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
20365 let err = unsafe { o.contents.err };
20366 unsafe { o.contents.err = core::ptr::null_mut(); }
20367 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
20371 result_ok: o.result_ok,
20375 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20376 fn clone(&self) -> Self {
20377 if self.result_ok {
20378 Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20379 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
20382 Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20383 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
20389 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
20390 /// but with all dynamically-allocated buffers duplicated in new buffers.
20391 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
20393 /// A tuple of 3 elements. See the individual fields for the types contained.
20394 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20395 /// The element at position 0
20396 pub a: crate::lightning_invoice::RawBolt11Invoice,
20397 /// The element at position 1
20398 pub b: crate::c_types::ThirtyTwoBytes,
20399 /// The element at position 2
20400 pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
20402 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20403 fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
20411 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20412 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
20413 (self.a, self.b, self.c)
20416 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20417 fn clone(&self) -> Self {
20419 a: Clone::clone(&self.a),
20420 b: Clone::clone(&self.b),
20421 c: Clone::clone(&self.c),
20426 /// Creates a new tuple which has the same data as `orig`
20427 /// but with all dynamically-allocated buffers duplicated in new buffers.
20428 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
20429 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
20431 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 {
20432 C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
20436 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
20437 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
20439 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
20440 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
20441 /// A pointer to the contents in the success state.
20442 /// Reading from this pointer when `result_ok` is not set is undefined.
20443 pub result: *mut crate::lightning_invoice::PayeePubKey,
20444 /// A pointer to the contents in the error state.
20445 /// Reading from this pointer when `result_ok` is set is undefined.
20446 pub err: *mut crate::c_types::Secp256k1Error,
20449 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
20450 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
20451 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20452 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
20453 /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
20454 /// `err` or `result` depending on the state of `result_ok`.
20455 pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
20456 /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
20457 pub result_ok: bool,
20460 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
20461 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
20462 CResult_PayeePubKeySecp256k1ErrorZ {
20463 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20464 result: Box::into_raw(Box::new(o)),
20470 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
20471 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
20472 CResult_PayeePubKeySecp256k1ErrorZ {
20473 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20474 err: Box::into_raw(Box::new(e)),
20479 /// Checks if the given object is currently in the success state
20481 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
20485 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
20486 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
20487 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
20488 fn drop(&mut self) {
20489 if self.result_ok {
20490 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20491 let _ = unsafe { Box::from_raw(self.contents.result) };
20494 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20495 let _ = unsafe { Box::from_raw(self.contents.err) };
20500 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
20501 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> 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_PayeePubKeySecp256k1ErrorZPtr { result }
20507 let err = unsafe { o.contents.err };
20508 unsafe { o.contents.err = core::ptr::null_mut(); }
20509 CResult_PayeePubKeySecp256k1ErrorZPtr { err }
20513 result_ok: o.result_ok,
20517 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
20518 fn clone(&self) -> Self {
20519 if self.result_ok {
20520 Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20521 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
20524 Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20525 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
20531 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
20532 /// but with all dynamically-allocated buffers duplicated in new buffers.
20533 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
20535 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
20536 /// This corresponds to std::vector in C++
20537 pub struct CVec_PrivateRouteZ {
20538 /// The elements in the array.
20539 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20540 pub data: *mut crate::lightning_invoice::PrivateRoute,
20541 /// The number of elements pointed to by `data`.
20544 impl CVec_PrivateRouteZ {
20545 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
20546 if self.datalen == 0 { return Vec::new(); }
20547 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20548 self.data = core::ptr::null_mut();
20552 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
20553 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20556 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
20557 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
20558 let datalen = v.len();
20559 let data = Box::into_raw(v.into_boxed_slice());
20560 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20564 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20565 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
20566 impl Drop for CVec_PrivateRouteZ {
20567 fn drop(&mut self) {
20568 if self.datalen == 0 { return; }
20569 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20572 impl Clone for CVec_PrivateRouteZ {
20573 fn clone(&self) -> Self {
20574 let mut res = Vec::new();
20575 if self.datalen == 0 { return Self::from(res); }
20576 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20581 /// The contents of CResult_PositiveTimestampCreationErrorZ
20582 pub union CResult_PositiveTimestampCreationErrorZPtr {
20583 /// A pointer to the contents in the success state.
20584 /// Reading from this pointer when `result_ok` is not set is undefined.
20585 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
20586 /// A pointer to the contents in the error state.
20587 /// Reading from this pointer when `result_ok` is set is undefined.
20588 pub err: *mut crate::lightning_invoice::CreationError,
20591 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
20592 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
20593 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20594 pub struct CResult_PositiveTimestampCreationErrorZ {
20595 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
20596 /// `err` or `result` depending on the state of `result_ok`.
20597 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
20598 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
20599 pub result_ok: bool,
20602 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
20603 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
20604 CResult_PositiveTimestampCreationErrorZ {
20605 contents: CResult_PositiveTimestampCreationErrorZPtr {
20606 result: Box::into_raw(Box::new(o)),
20612 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
20613 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
20614 CResult_PositiveTimestampCreationErrorZ {
20615 contents: CResult_PositiveTimestampCreationErrorZPtr {
20616 err: Box::into_raw(Box::new(e)),
20621 /// Checks if the given object is currently in the success state
20623 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
20627 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
20628 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
20629 impl Drop for CResult_PositiveTimestampCreationErrorZ {
20630 fn drop(&mut self) {
20631 if self.result_ok {
20632 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20633 let _ = unsafe { Box::from_raw(self.contents.result) };
20636 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20637 let _ = unsafe { Box::from_raw(self.contents.err) };
20642 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
20643 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
20644 let contents = if o.result_ok {
20645 let result = unsafe { o.contents.result };
20646 unsafe { o.contents.result = core::ptr::null_mut() };
20647 CResult_PositiveTimestampCreationErrorZPtr { result }
20649 let err = unsafe { o.contents.err };
20650 unsafe { o.contents.err = core::ptr::null_mut(); }
20651 CResult_PositiveTimestampCreationErrorZPtr { err }
20655 result_ok: o.result_ok,
20659 impl Clone for CResult_PositiveTimestampCreationErrorZ {
20660 fn clone(&self) -> Self {
20661 if self.result_ok {
20662 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
20663 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
20666 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
20667 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
20673 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
20674 /// but with all dynamically-allocated buffers duplicated in new buffers.
20675 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
20677 /// The contents of CResult_NoneBolt11SemanticErrorZ
20678 pub union CResult_NoneBolt11SemanticErrorZPtr {
20679 /// Note that this value is always NULL, as there are no contents in the OK variant
20680 pub result: *mut core::ffi::c_void,
20681 /// A pointer to the contents in the error state.
20682 /// Reading from this pointer when `result_ok` is set is undefined.
20683 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
20686 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
20687 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
20688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20689 pub struct CResult_NoneBolt11SemanticErrorZ {
20690 /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
20691 /// `err` or `result` depending on the state of `result_ok`.
20692 pub contents: CResult_NoneBolt11SemanticErrorZPtr,
20693 /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
20694 pub result_ok: bool,
20697 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
20698 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
20699 CResult_NoneBolt11SemanticErrorZ {
20700 contents: CResult_NoneBolt11SemanticErrorZPtr {
20701 result: core::ptr::null_mut(),
20707 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
20708 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
20709 CResult_NoneBolt11SemanticErrorZ {
20710 contents: CResult_NoneBolt11SemanticErrorZPtr {
20711 err: Box::into_raw(Box::new(e)),
20716 /// Checks if the given object is currently in the success state
20718 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
20722 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
20723 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
20724 impl Drop for CResult_NoneBolt11SemanticErrorZ {
20725 fn drop(&mut self) {
20726 if self.result_ok {
20728 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20729 let _ = unsafe { Box::from_raw(self.contents.err) };
20734 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
20735 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
20736 let contents = if o.result_ok {
20737 let _ = unsafe { Box::from_raw(o.contents.result) };
20738 o.contents.result = core::ptr::null_mut();
20739 CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
20741 let err = unsafe { o.contents.err };
20742 unsafe { o.contents.err = core::ptr::null_mut(); }
20743 CResult_NoneBolt11SemanticErrorZPtr { err }
20747 result_ok: o.result_ok,
20751 impl Clone for CResult_NoneBolt11SemanticErrorZ {
20752 fn clone(&self) -> Self {
20753 if self.result_ok {
20754 Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
20755 result: core::ptr::null_mut()
20758 Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
20759 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
20765 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
20766 /// but with all dynamically-allocated buffers duplicated in new buffers.
20767 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
20769 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
20770 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
20771 /// A pointer to the contents in the success state.
20772 /// Reading from this pointer when `result_ok` is not set is undefined.
20773 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20774 /// A pointer to the contents in the error state.
20775 /// Reading from this pointer when `result_ok` is set is undefined.
20776 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
20779 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
20780 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
20781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20782 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20783 /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
20784 /// `err` or `result` depending on the state of `result_ok`.
20785 pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
20786 /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
20787 pub result_ok: bool,
20790 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
20791 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20792 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20793 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
20794 result: Box::into_raw(Box::new(o)),
20800 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
20801 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20802 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20803 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
20804 err: Box::into_raw(Box::new(e)),
20809 /// Checks if the given object is currently in the success state
20811 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
20815 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
20816 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
20817 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20818 fn drop(&mut self) {
20819 if self.result_ok {
20820 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20821 let _ = unsafe { Box::from_raw(self.contents.result) };
20824 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20825 let _ = unsafe { Box::from_raw(self.contents.err) };
20830 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20831 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
20832 let contents = if o.result_ok {
20833 let result = unsafe { o.contents.result };
20834 unsafe { o.contents.result = core::ptr::null_mut() };
20835 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
20837 let err = unsafe { o.contents.err };
20838 unsafe { o.contents.err = core::ptr::null_mut(); }
20839 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
20843 result_ok: o.result_ok,
20847 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
20848 fn clone(&self) -> Self {
20849 if self.result_ok {
20850 Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
20851 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20854 Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
20855 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
20861 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
20862 /// but with all dynamically-allocated buffers duplicated in new buffers.
20863 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
20865 /// The contents of CResult_DescriptionCreationErrorZ
20866 pub union CResult_DescriptionCreationErrorZPtr {
20867 /// A pointer to the contents in the success state.
20868 /// Reading from this pointer when `result_ok` is not set is undefined.
20869 pub result: *mut crate::lightning_invoice::Description,
20870 /// A pointer to the contents in the error state.
20871 /// Reading from this pointer when `result_ok` is set is undefined.
20872 pub err: *mut crate::lightning_invoice::CreationError,
20875 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
20876 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
20877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20878 pub struct CResult_DescriptionCreationErrorZ {
20879 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
20880 /// `err` or `result` depending on the state of `result_ok`.
20881 pub contents: CResult_DescriptionCreationErrorZPtr,
20882 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
20883 pub result_ok: bool,
20886 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
20887 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
20888 CResult_DescriptionCreationErrorZ {
20889 contents: CResult_DescriptionCreationErrorZPtr {
20890 result: Box::into_raw(Box::new(o)),
20896 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
20897 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
20898 CResult_DescriptionCreationErrorZ {
20899 contents: CResult_DescriptionCreationErrorZPtr {
20900 err: Box::into_raw(Box::new(e)),
20905 /// Checks if the given object is currently in the success state
20907 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
20911 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
20912 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
20913 impl Drop for CResult_DescriptionCreationErrorZ {
20914 fn drop(&mut self) {
20915 if self.result_ok {
20916 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20917 let _ = unsafe { Box::from_raw(self.contents.result) };
20920 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20921 let _ = unsafe { Box::from_raw(self.contents.err) };
20926 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
20927 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
20928 let contents = if o.result_ok {
20929 let result = unsafe { o.contents.result };
20930 unsafe { o.contents.result = core::ptr::null_mut() };
20931 CResult_DescriptionCreationErrorZPtr { result }
20933 let err = unsafe { o.contents.err };
20934 unsafe { o.contents.err = core::ptr::null_mut(); }
20935 CResult_DescriptionCreationErrorZPtr { err }
20939 result_ok: o.result_ok,
20943 impl Clone for CResult_DescriptionCreationErrorZ {
20944 fn clone(&self) -> Self {
20945 if self.result_ok {
20946 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
20947 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
20950 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
20951 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
20957 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
20958 /// but with all dynamically-allocated buffers duplicated in new buffers.
20959 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
20961 /// The contents of CResult_PrivateRouteCreationErrorZ
20962 pub union CResult_PrivateRouteCreationErrorZPtr {
20963 /// A pointer to the contents in the success state.
20964 /// Reading from this pointer when `result_ok` is not set is undefined.
20965 pub result: *mut crate::lightning_invoice::PrivateRoute,
20966 /// A pointer to the contents in the error state.
20967 /// Reading from this pointer when `result_ok` is set is undefined.
20968 pub err: *mut crate::lightning_invoice::CreationError,
20971 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
20972 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
20973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20974 pub struct CResult_PrivateRouteCreationErrorZ {
20975 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
20976 /// `err` or `result` depending on the state of `result_ok`.
20977 pub contents: CResult_PrivateRouteCreationErrorZPtr,
20978 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
20979 pub result_ok: bool,
20982 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
20983 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
20984 CResult_PrivateRouteCreationErrorZ {
20985 contents: CResult_PrivateRouteCreationErrorZPtr {
20986 result: Box::into_raw(Box::new(o)),
20992 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
20993 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
20994 CResult_PrivateRouteCreationErrorZ {
20995 contents: CResult_PrivateRouteCreationErrorZPtr {
20996 err: Box::into_raw(Box::new(e)),
21001 /// Checks if the given object is currently in the success state
21003 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
21007 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
21008 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
21009 impl Drop for CResult_PrivateRouteCreationErrorZ {
21010 fn drop(&mut self) {
21011 if self.result_ok {
21012 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21013 let _ = unsafe { Box::from_raw(self.contents.result) };
21016 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21017 let _ = unsafe { Box::from_raw(self.contents.err) };
21022 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
21023 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
21024 let contents = if o.result_ok {
21025 let result = unsafe { o.contents.result };
21026 unsafe { o.contents.result = core::ptr::null_mut() };
21027 CResult_PrivateRouteCreationErrorZPtr { result }
21029 let err = unsafe { o.contents.err };
21030 unsafe { o.contents.err = core::ptr::null_mut(); }
21031 CResult_PrivateRouteCreationErrorZPtr { err }
21035 result_ok: o.result_ok,
21039 impl Clone for CResult_PrivateRouteCreationErrorZ {
21040 fn clone(&self) -> Self {
21041 if self.result_ok {
21042 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
21043 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
21046 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
21047 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
21053 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
21054 /// but with all dynamically-allocated buffers duplicated in new buffers.
21055 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
21057 /// The contents of CResult_OutPointDecodeErrorZ
21058 pub union CResult_OutPointDecodeErrorZPtr {
21059 /// A pointer to the contents in the success state.
21060 /// Reading from this pointer when `result_ok` is not set is undefined.
21061 pub result: *mut crate::lightning::chain::transaction::OutPoint,
21062 /// A pointer to the contents in the error state.
21063 /// Reading from this pointer when `result_ok` is set is undefined.
21064 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21067 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
21068 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
21069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21070 pub struct CResult_OutPointDecodeErrorZ {
21071 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
21072 /// `err` or `result` depending on the state of `result_ok`.
21073 pub contents: CResult_OutPointDecodeErrorZPtr,
21074 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
21075 pub result_ok: bool,
21078 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
21079 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
21080 CResult_OutPointDecodeErrorZ {
21081 contents: CResult_OutPointDecodeErrorZPtr {
21082 result: Box::into_raw(Box::new(o)),
21088 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
21089 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
21090 CResult_OutPointDecodeErrorZ {
21091 contents: CResult_OutPointDecodeErrorZPtr {
21092 err: Box::into_raw(Box::new(e)),
21097 /// Checks if the given object is currently in the success state
21099 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
21103 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
21104 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
21105 impl Drop for CResult_OutPointDecodeErrorZ {
21106 fn drop(&mut self) {
21107 if self.result_ok {
21108 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21109 let _ = unsafe { Box::from_raw(self.contents.result) };
21112 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21113 let _ = unsafe { Box::from_raw(self.contents.err) };
21118 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
21119 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
21120 let contents = if o.result_ok {
21121 let result = unsafe { o.contents.result };
21122 unsafe { o.contents.result = core::ptr::null_mut() };
21123 CResult_OutPointDecodeErrorZPtr { result }
21125 let err = unsafe { o.contents.err };
21126 unsafe { o.contents.err = core::ptr::null_mut(); }
21127 CResult_OutPointDecodeErrorZPtr { err }
21131 result_ok: o.result_ok,
21135 impl Clone for CResult_OutPointDecodeErrorZ {
21136 fn clone(&self) -> Self {
21137 if self.result_ok {
21138 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
21139 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
21142 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
21143 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21149 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
21150 /// but with all dynamically-allocated buffers duplicated in new buffers.
21151 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
21153 /// The contents of CResult_BigSizeDecodeErrorZ
21154 pub union CResult_BigSizeDecodeErrorZPtr {
21155 /// A pointer to the contents in the success state.
21156 /// Reading from this pointer when `result_ok` is not set is undefined.
21157 pub result: *mut crate::lightning::util::ser::BigSize,
21158 /// A pointer to the contents in the error state.
21159 /// Reading from this pointer when `result_ok` is set is undefined.
21160 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21163 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
21164 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
21165 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21166 pub struct CResult_BigSizeDecodeErrorZ {
21167 /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
21168 /// `err` or `result` depending on the state of `result_ok`.
21169 pub contents: CResult_BigSizeDecodeErrorZPtr,
21170 /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
21171 pub result_ok: bool,
21174 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
21175 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
21176 CResult_BigSizeDecodeErrorZ {
21177 contents: CResult_BigSizeDecodeErrorZPtr {
21178 result: Box::into_raw(Box::new(o)),
21184 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
21185 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
21186 CResult_BigSizeDecodeErrorZ {
21187 contents: CResult_BigSizeDecodeErrorZPtr {
21188 err: Box::into_raw(Box::new(e)),
21193 /// Checks if the given object is currently in the success state
21195 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
21199 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
21200 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
21201 impl Drop for CResult_BigSizeDecodeErrorZ {
21202 fn drop(&mut self) {
21203 if self.result_ok {
21204 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21205 let _ = unsafe { Box::from_raw(self.contents.result) };
21208 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21209 let _ = unsafe { Box::from_raw(self.contents.err) };
21214 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
21215 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
21216 let contents = if o.result_ok {
21217 let result = unsafe { o.contents.result };
21218 unsafe { o.contents.result = core::ptr::null_mut() };
21219 CResult_BigSizeDecodeErrorZPtr { result }
21221 let err = unsafe { o.contents.err };
21222 unsafe { o.contents.err = core::ptr::null_mut(); }
21223 CResult_BigSizeDecodeErrorZPtr { err }
21227 result_ok: o.result_ok,
21231 impl Clone for CResult_BigSizeDecodeErrorZ {
21232 fn clone(&self) -> Self {
21233 if self.result_ok {
21234 Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
21235 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
21238 Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
21239 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21245 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
21246 /// but with all dynamically-allocated buffers duplicated in new buffers.
21247 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
21249 /// The contents of CResult_HostnameDecodeErrorZ
21250 pub union CResult_HostnameDecodeErrorZPtr {
21251 /// A pointer to the contents in the success state.
21252 /// Reading from this pointer when `result_ok` is not set is undefined.
21253 pub result: *mut crate::lightning::util::ser::Hostname,
21254 /// A pointer to the contents in the error state.
21255 /// Reading from this pointer when `result_ok` is set is undefined.
21256 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21259 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
21260 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
21261 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21262 pub struct CResult_HostnameDecodeErrorZ {
21263 /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
21264 /// `err` or `result` depending on the state of `result_ok`.
21265 pub contents: CResult_HostnameDecodeErrorZPtr,
21266 /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
21267 pub result_ok: bool,
21270 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
21271 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
21272 CResult_HostnameDecodeErrorZ {
21273 contents: CResult_HostnameDecodeErrorZPtr {
21274 result: Box::into_raw(Box::new(o)),
21280 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
21281 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
21282 CResult_HostnameDecodeErrorZ {
21283 contents: CResult_HostnameDecodeErrorZPtr {
21284 err: Box::into_raw(Box::new(e)),
21289 /// Checks if the given object is currently in the success state
21291 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
21295 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
21296 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
21297 impl Drop for CResult_HostnameDecodeErrorZ {
21298 fn drop(&mut self) {
21299 if self.result_ok {
21300 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21301 let _ = unsafe { Box::from_raw(self.contents.result) };
21304 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21305 let _ = unsafe { Box::from_raw(self.contents.err) };
21310 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
21311 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
21312 let contents = if o.result_ok {
21313 let result = unsafe { o.contents.result };
21314 unsafe { o.contents.result = core::ptr::null_mut() };
21315 CResult_HostnameDecodeErrorZPtr { result }
21317 let err = unsafe { o.contents.err };
21318 unsafe { o.contents.err = core::ptr::null_mut(); }
21319 CResult_HostnameDecodeErrorZPtr { err }
21323 result_ok: o.result_ok,
21327 impl Clone for CResult_HostnameDecodeErrorZ {
21328 fn clone(&self) -> Self {
21329 if self.result_ok {
21330 Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
21331 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
21334 Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
21335 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21341 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
21342 /// but with all dynamically-allocated buffers duplicated in new buffers.
21343 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
21345 /// The contents of CResult_TransactionU16LenLimitedNoneZ
21346 pub union CResult_TransactionU16LenLimitedNoneZPtr {
21347 /// A pointer to the contents in the success state.
21348 /// Reading from this pointer when `result_ok` is not set is undefined.
21349 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
21350 /// Note that this value is always NULL, as there are no contents in the Err variant
21351 pub err: *mut core::ffi::c_void,
21354 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
21355 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
21356 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21357 pub struct CResult_TransactionU16LenLimitedNoneZ {
21358 /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
21359 /// `err` or `result` depending on the state of `result_ok`.
21360 pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
21361 /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
21362 pub result_ok: bool,
21365 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
21366 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
21367 CResult_TransactionU16LenLimitedNoneZ {
21368 contents: CResult_TransactionU16LenLimitedNoneZPtr {
21369 result: Box::into_raw(Box::new(o)),
21375 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
21376 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
21377 CResult_TransactionU16LenLimitedNoneZ {
21378 contents: CResult_TransactionU16LenLimitedNoneZPtr {
21379 err: core::ptr::null_mut(),
21384 /// Checks if the given object is currently in the success state
21386 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
21390 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
21391 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
21392 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
21393 fn drop(&mut self) {
21394 if self.result_ok {
21395 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21396 let _ = unsafe { Box::from_raw(self.contents.result) };
21402 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
21403 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
21404 let contents = if o.result_ok {
21405 let result = unsafe { o.contents.result };
21406 unsafe { o.contents.result = core::ptr::null_mut() };
21407 CResult_TransactionU16LenLimitedNoneZPtr { result }
21409 let _ = unsafe { Box::from_raw(o.contents.err) };
21410 o.contents.err = core::ptr::null_mut();
21411 CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
21415 result_ok: o.result_ok,
21419 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
21420 fn clone(&self) -> Self {
21421 if self.result_ok {
21422 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
21423 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
21426 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
21427 err: core::ptr::null_mut()
21433 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
21434 /// but with all dynamically-allocated buffers duplicated in new buffers.
21435 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
21437 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
21438 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21439 /// A pointer to the contents in the success state.
21440 /// Reading from this pointer when `result_ok` is not set is undefined.
21441 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
21442 /// A pointer to the contents in the error state.
21443 /// Reading from this pointer when `result_ok` is set is undefined.
21444 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21447 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
21448 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
21449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21450 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
21451 /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
21452 /// `err` or `result` depending on the state of `result_ok`.
21453 pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
21454 /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
21455 pub result_ok: bool,
21458 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
21459 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
21460 CResult_TransactionU16LenLimitedDecodeErrorZ {
21461 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21462 result: Box::into_raw(Box::new(o)),
21468 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
21469 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
21470 CResult_TransactionU16LenLimitedDecodeErrorZ {
21471 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21472 err: Box::into_raw(Box::new(e)),
21477 /// Checks if the given object is currently in the success state
21479 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
21483 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
21484 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
21485 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
21486 fn drop(&mut self) {
21487 if self.result_ok {
21488 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21489 let _ = unsafe { Box::from_raw(self.contents.result) };
21492 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21493 let _ = unsafe { Box::from_raw(self.contents.err) };
21498 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
21499 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
21500 let contents = if o.result_ok {
21501 let result = unsafe { o.contents.result };
21502 unsafe { o.contents.result = core::ptr::null_mut() };
21503 CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
21505 let err = unsafe { o.contents.err };
21506 unsafe { o.contents.err = core::ptr::null_mut(); }
21507 CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
21511 result_ok: o.result_ok,
21515 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
21516 fn clone(&self) -> Self {
21517 if self.result_ok {
21518 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21519 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
21522 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21523 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21529 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
21530 /// but with all dynamically-allocated buffers duplicated in new buffers.
21531 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
21533 /// The contents of CResult_UntrustedStringDecodeErrorZ
21534 pub union CResult_UntrustedStringDecodeErrorZPtr {
21535 /// A pointer to the contents in the success state.
21536 /// Reading from this pointer when `result_ok` is not set is undefined.
21537 pub result: *mut crate::lightning::util::string::UntrustedString,
21538 /// A pointer to the contents in the error state.
21539 /// Reading from this pointer when `result_ok` is set is undefined.
21540 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21543 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
21544 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
21545 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21546 pub struct CResult_UntrustedStringDecodeErrorZ {
21547 /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
21548 /// `err` or `result` depending on the state of `result_ok`.
21549 pub contents: CResult_UntrustedStringDecodeErrorZPtr,
21550 /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
21551 pub result_ok: bool,
21554 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
21555 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
21556 CResult_UntrustedStringDecodeErrorZ {
21557 contents: CResult_UntrustedStringDecodeErrorZPtr {
21558 result: Box::into_raw(Box::new(o)),
21564 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
21565 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
21566 CResult_UntrustedStringDecodeErrorZ {
21567 contents: CResult_UntrustedStringDecodeErrorZPtr {
21568 err: Box::into_raw(Box::new(e)),
21573 /// Checks if the given object is currently in the success state
21575 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
21579 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
21580 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
21581 impl Drop for CResult_UntrustedStringDecodeErrorZ {
21582 fn drop(&mut self) {
21583 if self.result_ok {
21584 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21585 let _ = unsafe { Box::from_raw(self.contents.result) };
21588 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21589 let _ = unsafe { Box::from_raw(self.contents.err) };
21594 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
21595 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
21596 let contents = if o.result_ok {
21597 let result = unsafe { o.contents.result };
21598 unsafe { o.contents.result = core::ptr::null_mut() };
21599 CResult_UntrustedStringDecodeErrorZPtr { result }
21601 let err = unsafe { o.contents.err };
21602 unsafe { o.contents.err = core::ptr::null_mut(); }
21603 CResult_UntrustedStringDecodeErrorZPtr { err }
21607 result_ok: o.result_ok,
21611 impl Clone for CResult_UntrustedStringDecodeErrorZ {
21612 fn clone(&self) -> Self {
21613 if self.result_ok {
21614 Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
21615 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
21618 Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
21619 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21625 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
21626 /// but with all dynamically-allocated buffers duplicated in new buffers.
21627 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
21629 /// The contents of CResult_ReceiveTlvsDecodeErrorZ
21630 pub union CResult_ReceiveTlvsDecodeErrorZPtr {
21631 /// A pointer to the contents in the success state.
21632 /// Reading from this pointer when `result_ok` is not set is undefined.
21633 pub result: *mut crate::lightning::blinded_path::payment::ReceiveTlvs,
21634 /// A pointer to the contents in the error state.
21635 /// Reading from this pointer when `result_ok` is set is undefined.
21636 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21639 /// A CResult_ReceiveTlvsDecodeErrorZ represents the result of a fallible operation,
21640 /// containing a crate::lightning::blinded_path::payment::ReceiveTlvs on success and a crate::lightning::ln::msgs::DecodeError on failure.
21641 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21642 pub struct CResult_ReceiveTlvsDecodeErrorZ {
21643 /// The contents of this CResult_ReceiveTlvsDecodeErrorZ, accessible via either
21644 /// `err` or `result` depending on the state of `result_ok`.
21645 pub contents: CResult_ReceiveTlvsDecodeErrorZPtr,
21646 /// Whether this CResult_ReceiveTlvsDecodeErrorZ represents a success state.
21647 pub result_ok: bool,
21650 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ in the success state.
21651 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::ReceiveTlvs) -> CResult_ReceiveTlvsDecodeErrorZ {
21652 CResult_ReceiveTlvsDecodeErrorZ {
21653 contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21654 result: Box::into_raw(Box::new(o)),
21660 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ in the error state.
21661 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReceiveTlvsDecodeErrorZ {
21662 CResult_ReceiveTlvsDecodeErrorZ {
21663 contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21664 err: Box::into_raw(Box::new(e)),
21669 /// Checks if the given object is currently in the success state
21671 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_is_ok(o: &CResult_ReceiveTlvsDecodeErrorZ) -> bool {
21675 /// Frees any resources used by the CResult_ReceiveTlvsDecodeErrorZ.
21676 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_free(_res: CResult_ReceiveTlvsDecodeErrorZ) { }
21677 impl Drop for CResult_ReceiveTlvsDecodeErrorZ {
21678 fn drop(&mut self) {
21679 if self.result_ok {
21680 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21681 let _ = unsafe { Box::from_raw(self.contents.result) };
21684 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21685 let _ = unsafe { Box::from_raw(self.contents.err) };
21690 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::ReceiveTlvs, crate::lightning::ln::msgs::DecodeError>> for CResult_ReceiveTlvsDecodeErrorZ {
21691 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::ReceiveTlvs, crate::lightning::ln::msgs::DecodeError>) -> Self {
21692 let contents = if o.result_ok {
21693 let result = unsafe { o.contents.result };
21694 unsafe { o.contents.result = core::ptr::null_mut() };
21695 CResult_ReceiveTlvsDecodeErrorZPtr { result }
21697 let err = unsafe { o.contents.err };
21698 unsafe { o.contents.err = core::ptr::null_mut(); }
21699 CResult_ReceiveTlvsDecodeErrorZPtr { err }
21703 result_ok: o.result_ok,
21707 impl Clone for CResult_ReceiveTlvsDecodeErrorZ {
21708 fn clone(&self) -> Self {
21709 if self.result_ok {
21710 Self { result_ok: true, contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21711 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::ReceiveTlvs>::clone(unsafe { &*self.contents.result })))
21714 Self { result_ok: false, contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21715 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21721 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ which has the same data as `orig`
21722 /// but with all dynamically-allocated buffers duplicated in new buffers.
21723 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_clone(orig: &CResult_ReceiveTlvsDecodeErrorZ) -> CResult_ReceiveTlvsDecodeErrorZ { Clone::clone(&orig) }
21725 /// The contents of CResult_PaymentRelayDecodeErrorZ
21726 pub union CResult_PaymentRelayDecodeErrorZPtr {
21727 /// A pointer to the contents in the success state.
21728 /// Reading from this pointer when `result_ok` is not set is undefined.
21729 pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay,
21730 /// A pointer to the contents in the error state.
21731 /// Reading from this pointer when `result_ok` is set is undefined.
21732 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21735 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
21736 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
21737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21738 pub struct CResult_PaymentRelayDecodeErrorZ {
21739 /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
21740 /// `err` or `result` depending on the state of `result_ok`.
21741 pub contents: CResult_PaymentRelayDecodeErrorZPtr,
21742 /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
21743 pub result_ok: bool,
21746 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
21747 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
21748 CResult_PaymentRelayDecodeErrorZ {
21749 contents: CResult_PaymentRelayDecodeErrorZPtr {
21750 result: Box::into_raw(Box::new(o)),
21756 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
21757 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
21758 CResult_PaymentRelayDecodeErrorZ {
21759 contents: CResult_PaymentRelayDecodeErrorZPtr {
21760 err: Box::into_raw(Box::new(e)),
21765 /// Checks if the given object is currently in the success state
21767 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
21771 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
21772 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
21773 impl Drop for CResult_PaymentRelayDecodeErrorZ {
21774 fn drop(&mut self) {
21775 if self.result_ok {
21776 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21777 let _ = unsafe { Box::from_raw(self.contents.result) };
21780 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21781 let _ = unsafe { Box::from_raw(self.contents.err) };
21786 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
21787 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> Self {
21788 let contents = if o.result_ok {
21789 let result = unsafe { o.contents.result };
21790 unsafe { o.contents.result = core::ptr::null_mut() };
21791 CResult_PaymentRelayDecodeErrorZPtr { result }
21793 let err = unsafe { o.contents.err };
21794 unsafe { o.contents.err = core::ptr::null_mut(); }
21795 CResult_PaymentRelayDecodeErrorZPtr { err }
21799 result_ok: o.result_ok,
21803 impl Clone for CResult_PaymentRelayDecodeErrorZ {
21804 fn clone(&self) -> Self {
21805 if self.result_ok {
21806 Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
21807 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
21810 Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
21811 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21817 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
21818 /// but with all dynamically-allocated buffers duplicated in new buffers.
21819 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
21821 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
21822 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
21823 /// A pointer to the contents in the success state.
21824 /// Reading from this pointer when `result_ok` is not set is undefined.
21825 pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
21826 /// A pointer to the contents in the error state.
21827 /// Reading from this pointer when `result_ok` is set is undefined.
21828 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21831 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
21832 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
21833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21834 pub struct CResult_PaymentConstraintsDecodeErrorZ {
21835 /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
21836 /// `err` or `result` depending on the state of `result_ok`.
21837 pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
21838 /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
21839 pub result_ok: bool,
21842 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
21843 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
21844 CResult_PaymentConstraintsDecodeErrorZ {
21845 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
21846 result: Box::into_raw(Box::new(o)),
21852 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
21853 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
21854 CResult_PaymentConstraintsDecodeErrorZ {
21855 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
21856 err: Box::into_raw(Box::new(e)),
21861 /// Checks if the given object is currently in the success state
21863 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
21867 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
21868 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
21869 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
21870 fn drop(&mut self) {
21871 if self.result_ok {
21872 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21873 let _ = unsafe { Box::from_raw(self.contents.result) };
21876 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21877 let _ = unsafe { Box::from_raw(self.contents.err) };
21882 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
21883 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
21884 let contents = if o.result_ok {
21885 let result = unsafe { o.contents.result };
21886 unsafe { o.contents.result = core::ptr::null_mut() };
21887 CResult_PaymentConstraintsDecodeErrorZPtr { result }
21889 let err = unsafe { o.contents.err };
21890 unsafe { o.contents.err = core::ptr::null_mut(); }
21891 CResult_PaymentConstraintsDecodeErrorZPtr { err }
21895 result_ok: o.result_ok,
21899 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
21900 fn clone(&self) -> Self {
21901 if self.result_ok {
21902 Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
21903 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
21906 Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
21907 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21913 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
21914 /// but with all dynamically-allocated buffers duplicated in new buffers.
21915 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
21917 /// The contents of CResult_ThirtyTwoBytesPaymentErrorZ
21918 pub union CResult_ThirtyTwoBytesPaymentErrorZPtr {
21919 /// A pointer to the contents in the success state.
21920 /// Reading from this pointer when `result_ok` is not set is undefined.
21921 pub result: *mut crate::c_types::ThirtyTwoBytes,
21922 /// A pointer to the contents in the error state.
21923 /// Reading from this pointer when `result_ok` is set is undefined.
21924 pub err: *mut crate::lightning_invoice::payment::PaymentError,
21927 /// A CResult_ThirtyTwoBytesPaymentErrorZ represents the result of a fallible operation,
21928 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
21929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21930 pub struct CResult_ThirtyTwoBytesPaymentErrorZ {
21931 /// The contents of this CResult_ThirtyTwoBytesPaymentErrorZ, accessible via either
21932 /// `err` or `result` depending on the state of `result_ok`.
21933 pub contents: CResult_ThirtyTwoBytesPaymentErrorZPtr,
21934 /// Whether this CResult_ThirtyTwoBytesPaymentErrorZ represents a success state.
21935 pub result_ok: bool,
21938 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the success state.
21939 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentErrorZ {
21940 CResult_ThirtyTwoBytesPaymentErrorZ {
21941 contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
21942 result: Box::into_raw(Box::new(o)),
21948 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the error state.
21949 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_ThirtyTwoBytesPaymentErrorZ {
21950 CResult_ThirtyTwoBytesPaymentErrorZ {
21951 contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
21952 err: Box::into_raw(Box::new(e)),
21957 /// Checks if the given object is currently in the success state
21959 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentErrorZ) -> bool {
21963 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentErrorZ.
21964 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_free(_res: CResult_ThirtyTwoBytesPaymentErrorZ) { }
21965 impl Drop for CResult_ThirtyTwoBytesPaymentErrorZ {
21966 fn drop(&mut self) {
21967 if self.result_ok {
21968 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21969 let _ = unsafe { Box::from_raw(self.contents.result) };
21972 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21973 let _ = unsafe { Box::from_raw(self.contents.err) };
21978 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_ThirtyTwoBytesPaymentErrorZ {
21979 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
21980 let contents = if o.result_ok {
21981 let result = unsafe { o.contents.result };
21982 unsafe { o.contents.result = core::ptr::null_mut() };
21983 CResult_ThirtyTwoBytesPaymentErrorZPtr { result }
21985 let err = unsafe { o.contents.err };
21986 unsafe { o.contents.err = core::ptr::null_mut(); }
21987 CResult_ThirtyTwoBytesPaymentErrorZPtr { err }
21991 result_ok: o.result_ok,
21995 impl Clone for CResult_ThirtyTwoBytesPaymentErrorZ {
21996 fn clone(&self) -> Self {
21997 if self.result_ok {
21998 Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
21999 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
22002 Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
22003 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
22009 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ which has the same data as `orig`
22010 /// but with all dynamically-allocated buffers duplicated in new buffers.
22011 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig: &CResult_ThirtyTwoBytesPaymentErrorZ) -> CResult_ThirtyTwoBytesPaymentErrorZ { Clone::clone(&orig) }
22013 /// The contents of CResult_NonePaymentErrorZ
22014 pub union CResult_NonePaymentErrorZPtr {
22015 /// Note that this value is always NULL, as there are no contents in the OK variant
22016 pub result: *mut core::ffi::c_void,
22017 /// A pointer to the contents in the error state.
22018 /// Reading from this pointer when `result_ok` is set is undefined.
22019 pub err: *mut crate::lightning_invoice::payment::PaymentError,
22022 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
22023 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
22024 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22025 pub struct CResult_NonePaymentErrorZ {
22026 /// The contents of this CResult_NonePaymentErrorZ, accessible via either
22027 /// `err` or `result` depending on the state of `result_ok`.
22028 pub contents: CResult_NonePaymentErrorZPtr,
22029 /// Whether this CResult_NonePaymentErrorZ represents a success state.
22030 pub result_ok: bool,
22033 /// Creates a new CResult_NonePaymentErrorZ in the success state.
22034 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
22035 CResult_NonePaymentErrorZ {
22036 contents: CResult_NonePaymentErrorZPtr {
22037 result: core::ptr::null_mut(),
22043 /// Creates a new CResult_NonePaymentErrorZ in the error state.
22044 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
22045 CResult_NonePaymentErrorZ {
22046 contents: CResult_NonePaymentErrorZPtr {
22047 err: Box::into_raw(Box::new(e)),
22052 /// Checks if the given object is currently in the success state
22054 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
22058 /// Frees any resources used by the CResult_NonePaymentErrorZ.
22059 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
22060 impl Drop for CResult_NonePaymentErrorZ {
22061 fn drop(&mut self) {
22062 if self.result_ok {
22064 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22065 let _ = unsafe { Box::from_raw(self.contents.err) };
22070 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
22071 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
22072 let contents = if o.result_ok {
22073 let _ = unsafe { Box::from_raw(o.contents.result) };
22074 o.contents.result = core::ptr::null_mut();
22075 CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
22077 let err = unsafe { o.contents.err };
22078 unsafe { o.contents.err = core::ptr::null_mut(); }
22079 CResult_NonePaymentErrorZPtr { err }
22083 result_ok: o.result_ok,
22087 impl Clone for CResult_NonePaymentErrorZ {
22088 fn clone(&self) -> Self {
22089 if self.result_ok {
22090 Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
22091 result: core::ptr::null_mut()
22094 Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
22095 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
22101 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
22102 /// but with all dynamically-allocated buffers duplicated in new buffers.
22103 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
22105 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ
22106 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22107 /// A pointer to the contents in the success state.
22108 /// Reading from this pointer when `result_ok` is not set is undefined.
22109 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
22110 /// A pointer to the contents in the error state.
22111 /// Reading from this pointer when `result_ok` is set is undefined.
22112 pub err: *mut crate::lightning_invoice::payment::ProbingError,
22115 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents the result of a fallible operation,
22116 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning_invoice::payment::ProbingError on failure.
22117 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22118 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22119 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ, accessible via either
22120 /// `err` or `result` depending on the state of `result_ok`.
22121 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr,
22122 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents a success state.
22123 pub result_ok: bool,
22126 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the success state.
22127 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22128 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22129 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22130 result: Box::into_raw(Box::new(o)),
22136 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the error state.
22137 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e: crate::lightning_invoice::payment::ProbingError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22138 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22139 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22140 err: Box::into_raw(Box::new(e)),
22145 /// Checks if the given object is currently in the success state
22147 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) -> bool {
22151 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.
22152 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) { }
22153 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22154 fn drop(&mut self) {
22155 if self.result_ok {
22156 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22157 let _ = unsafe { Box::from_raw(self.contents.result) };
22160 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22161 let _ = unsafe { Box::from_raw(self.contents.err) };
22166 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning_invoice::payment::ProbingError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22167 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning_invoice::payment::ProbingError>) -> Self {
22168 let contents = if o.result_ok {
22169 let result = unsafe { o.contents.result };
22170 unsafe { o.contents.result = core::ptr::null_mut() };
22171 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { result }
22173 let err = unsafe { o.contents.err };
22174 unsafe { o.contents.err = core::ptr::null_mut(); }
22175 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { err }
22179 result_ok: o.result_ok,
22183 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22184 fn clone(&self) -> Self {
22185 if self.result_ok {
22186 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22187 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
22190 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22191 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::ProbingError>::clone(unsafe { &*self.contents.err })))
22197 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ which has the same data as `orig`
22198 /// but with all dynamically-allocated buffers duplicated in new buffers.
22199 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { Clone::clone(&orig) }
22201 /// The contents of CResult_StrSecp256k1ErrorZ
22202 pub union CResult_StrSecp256k1ErrorZPtr {
22203 /// A pointer to the contents in the success state.
22204 /// Reading from this pointer when `result_ok` is not set is undefined.
22205 pub result: *mut crate::c_types::Str,
22206 /// A pointer to the contents in the error state.
22207 /// Reading from this pointer when `result_ok` is set is undefined.
22208 pub err: *mut crate::c_types::Secp256k1Error,
22211 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
22212 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
22213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22214 pub struct CResult_StrSecp256k1ErrorZ {
22215 /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
22216 /// `err` or `result` depending on the state of `result_ok`.
22217 pub contents: CResult_StrSecp256k1ErrorZPtr,
22218 /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
22219 pub result_ok: bool,
22222 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
22223 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
22224 CResult_StrSecp256k1ErrorZ {
22225 contents: CResult_StrSecp256k1ErrorZPtr {
22226 result: Box::into_raw(Box::new(o)),
22232 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
22233 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
22234 CResult_StrSecp256k1ErrorZ {
22235 contents: CResult_StrSecp256k1ErrorZPtr {
22236 err: Box::into_raw(Box::new(e)),
22241 /// Checks if the given object is currently in the success state
22243 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
22247 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
22248 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
22249 impl Drop for CResult_StrSecp256k1ErrorZ {
22250 fn drop(&mut self) {
22251 if self.result_ok {
22252 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22253 let _ = unsafe { Box::from_raw(self.contents.result) };
22256 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22257 let _ = unsafe { Box::from_raw(self.contents.err) };
22262 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
22263 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
22264 let contents = if o.result_ok {
22265 let result = unsafe { o.contents.result };
22266 unsafe { o.contents.result = core::ptr::null_mut() };
22267 CResult_StrSecp256k1ErrorZPtr { result }
22269 let err = unsafe { o.contents.err };
22270 unsafe { o.contents.err = core::ptr::null_mut(); }
22271 CResult_StrSecp256k1ErrorZPtr { err }
22275 result_ok: o.result_ok,
22279 impl Clone for CResult_StrSecp256k1ErrorZ {
22280 fn clone(&self) -> Self {
22281 if self.result_ok {
22282 Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
22283 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
22286 Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
22287 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
22293 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
22294 /// but with all dynamically-allocated buffers duplicated in new buffers.
22295 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
22297 /// The contents of CResult_TxOutUtxoLookupErrorZ
22298 pub union CResult_TxOutUtxoLookupErrorZPtr {
22299 /// A pointer to the contents in the success state.
22300 /// Reading from this pointer when `result_ok` is not set is undefined.
22301 pub result: *mut crate::c_types::TxOut,
22302 /// A pointer to the contents in the error state.
22303 /// Reading from this pointer when `result_ok` is set is undefined.
22304 pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
22307 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
22308 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
22309 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22310 pub struct CResult_TxOutUtxoLookupErrorZ {
22311 /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
22312 /// `err` or `result` depending on the state of `result_ok`.
22313 pub contents: CResult_TxOutUtxoLookupErrorZPtr,
22314 /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
22315 pub result_ok: bool,
22318 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
22319 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
22320 CResult_TxOutUtxoLookupErrorZ {
22321 contents: CResult_TxOutUtxoLookupErrorZPtr {
22322 result: Box::into_raw(Box::new(o)),
22328 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
22329 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
22330 CResult_TxOutUtxoLookupErrorZ {
22331 contents: CResult_TxOutUtxoLookupErrorZPtr {
22332 err: Box::into_raw(Box::new(e)),
22337 /// Checks if the given object is currently in the success state
22339 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
22343 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
22344 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
22345 impl Drop for CResult_TxOutUtxoLookupErrorZ {
22346 fn drop(&mut self) {
22347 if self.result_ok {
22348 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22349 let _ = unsafe { Box::from_raw(self.contents.result) };
22352 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22353 let _ = unsafe { Box::from_raw(self.contents.err) };
22358 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
22359 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
22360 let contents = if o.result_ok {
22361 let result = unsafe { o.contents.result };
22362 unsafe { o.contents.result = core::ptr::null_mut() };
22363 CResult_TxOutUtxoLookupErrorZPtr { result }
22365 let err = unsafe { o.contents.err };
22366 unsafe { o.contents.err = core::ptr::null_mut(); }
22367 CResult_TxOutUtxoLookupErrorZPtr { err }
22371 result_ok: o.result_ok,
22375 impl Clone for CResult_TxOutUtxoLookupErrorZ {
22376 fn clone(&self) -> Self {
22377 if self.result_ok {
22378 Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
22379 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
22382 Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
22383 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
22389 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
22390 /// but with all dynamically-allocated buffers duplicated in new buffers.
22391 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
22393 /// The contents of CResult_OnionMessagePathNoneZ
22394 pub union CResult_OnionMessagePathNoneZPtr {
22395 /// A pointer to the contents in the success state.
22396 /// Reading from this pointer when `result_ok` is not set is undefined.
22397 pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
22398 /// Note that this value is always NULL, as there are no contents in the Err variant
22399 pub err: *mut core::ffi::c_void,
22402 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
22403 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
22404 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22405 pub struct CResult_OnionMessagePathNoneZ {
22406 /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
22407 /// `err` or `result` depending on the state of `result_ok`.
22408 pub contents: CResult_OnionMessagePathNoneZPtr,
22409 /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
22410 pub result_ok: bool,
22413 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
22414 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
22415 CResult_OnionMessagePathNoneZ {
22416 contents: CResult_OnionMessagePathNoneZPtr {
22417 result: Box::into_raw(Box::new(o)),
22423 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
22424 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
22425 CResult_OnionMessagePathNoneZ {
22426 contents: CResult_OnionMessagePathNoneZPtr {
22427 err: core::ptr::null_mut(),
22432 /// Checks if the given object is currently in the success state
22434 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
22438 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
22439 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
22440 impl Drop for CResult_OnionMessagePathNoneZ {
22441 fn drop(&mut self) {
22442 if self.result_ok {
22443 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22444 let _ = unsafe { Box::from_raw(self.contents.result) };
22450 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
22451 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
22452 let contents = if o.result_ok {
22453 let result = unsafe { o.contents.result };
22454 unsafe { o.contents.result = core::ptr::null_mut() };
22455 CResult_OnionMessagePathNoneZPtr { result }
22457 let _ = unsafe { Box::from_raw(o.contents.err) };
22458 o.contents.err = core::ptr::null_mut();
22459 CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
22463 result_ok: o.result_ok,
22467 impl Clone for CResult_OnionMessagePathNoneZ {
22468 fn clone(&self) -> Self {
22469 if self.result_ok {
22470 Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
22471 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
22474 Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
22475 err: core::ptr::null_mut()
22481 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
22482 /// but with all dynamically-allocated buffers duplicated in new buffers.
22483 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
22485 /// A tuple of 2 elements. See the individual fields for the types contained.
22486 pub struct C2Tuple_PublicKeyOnionMessageZ {
22487 /// The element at position 0
22488 pub a: crate::c_types::PublicKey,
22489 /// The element at position 1
22490 pub b: crate::lightning::ln::msgs::OnionMessage,
22492 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage)> for C2Tuple_PublicKeyOnionMessageZ {
22493 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage)) -> Self {
22500 impl C2Tuple_PublicKeyOnionMessageZ {
22501 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage) {
22505 impl Clone for C2Tuple_PublicKeyOnionMessageZ {
22506 fn clone(&self) -> Self {
22508 a: Clone::clone(&self.a),
22509 b: Clone::clone(&self.b),
22514 /// Creates a new tuple which has the same data as `orig`
22515 /// but with all dynamically-allocated buffers duplicated in new buffers.
22516 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_clone(orig: &C2Tuple_PublicKeyOnionMessageZ) -> C2Tuple_PublicKeyOnionMessageZ { Clone::clone(&orig) }
22517 /// Creates a new C2Tuple_PublicKeyOnionMessageZ from the contained elements.
22519 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::msgs::OnionMessage) -> C2Tuple_PublicKeyOnionMessageZ {
22520 C2Tuple_PublicKeyOnionMessageZ { a, b, }
22524 /// Frees any resources used by the C2Tuple_PublicKeyOnionMessageZ.
22525 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_free(_res: C2Tuple_PublicKeyOnionMessageZ) { }
22527 /// The contents of CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ
22528 pub union CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22529 /// A pointer to the contents in the success state.
22530 /// Reading from this pointer when `result_ok` is not set is undefined.
22531 pub result: *mut crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ,
22532 /// A pointer to the contents in the error state.
22533 /// Reading from this pointer when `result_ok` is set is undefined.
22534 pub err: *mut crate::lightning::onion_message::messenger::SendError,
22537 /// A CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents the result of a fallible operation,
22538 /// containing a crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
22539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22540 pub struct CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22541 /// The contents of this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ, accessible via either
22542 /// `err` or `result` depending on the state of `result_ok`.
22543 pub contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr,
22544 /// Whether this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents a success state.
22545 pub result_ok: bool,
22548 /// Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the success state.
22549 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o: crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ) -> CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22550 CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22551 contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22552 result: Box::into_raw(Box::new(o)),
22558 /// Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the error state.
22559 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22560 CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22561 contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22562 err: Box::into_raw(Box::new(e)),
22567 /// Checks if the given object is currently in the success state
22569 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o: &CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ) -> bool {
22573 /// Frees any resources used by the CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ.
22574 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ) { }
22575 impl Drop for CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22576 fn drop(&mut self) {
22577 if self.result_ok {
22578 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22579 let _ = unsafe { Box::from_raw(self.contents.result) };
22582 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22583 let _ = unsafe { Box::from_raw(self.contents.err) };
22588 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ, crate::lightning::onion_message::messenger::SendError>> for CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22589 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
22590 let contents = if o.result_ok {
22591 let result = unsafe { o.contents.result };
22592 unsafe { o.contents.result = core::ptr::null_mut() };
22593 CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { result }
22595 let err = unsafe { o.contents.err };
22596 unsafe { o.contents.err = core::ptr::null_mut(); }
22597 CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { err }
22601 result_ok: o.result_ok,
22606 /// The contents of CResult_NoneSendErrorZ
22607 pub union CResult_NoneSendErrorZPtr {
22608 /// Note that this value is always NULL, as there are no contents in the OK variant
22609 pub result: *mut core::ffi::c_void,
22610 /// A pointer to the contents in the error state.
22611 /// Reading from this pointer when `result_ok` is set is undefined.
22612 pub err: *mut crate::lightning::onion_message::messenger::SendError,
22615 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
22616 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
22617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22618 pub struct CResult_NoneSendErrorZ {
22619 /// The contents of this CResult_NoneSendErrorZ, accessible via either
22620 /// `err` or `result` depending on the state of `result_ok`.
22621 pub contents: CResult_NoneSendErrorZPtr,
22622 /// Whether this CResult_NoneSendErrorZ represents a success state.
22623 pub result_ok: bool,
22626 /// Creates a new CResult_NoneSendErrorZ in the success state.
22627 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
22628 CResult_NoneSendErrorZ {
22629 contents: CResult_NoneSendErrorZPtr {
22630 result: core::ptr::null_mut(),
22636 /// Creates a new CResult_NoneSendErrorZ in the error state.
22637 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
22638 CResult_NoneSendErrorZ {
22639 contents: CResult_NoneSendErrorZPtr {
22640 err: Box::into_raw(Box::new(e)),
22645 /// Checks if the given object is currently in the success state
22647 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
22651 /// Frees any resources used by the CResult_NoneSendErrorZ.
22652 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
22653 impl Drop for CResult_NoneSendErrorZ {
22654 fn drop(&mut self) {
22655 if self.result_ok {
22657 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22658 let _ = unsafe { Box::from_raw(self.contents.err) };
22663 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
22664 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
22665 let contents = if o.result_ok {
22666 let _ = unsafe { Box::from_raw(o.contents.result) };
22667 o.contents.result = core::ptr::null_mut();
22668 CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
22670 let err = unsafe { o.contents.err };
22671 unsafe { o.contents.err = core::ptr::null_mut(); }
22672 CResult_NoneSendErrorZPtr { err }
22676 result_ok: o.result_ok,
22681 /// The contents of CResult_BlindedPathNoneZ
22682 pub union CResult_BlindedPathNoneZPtr {
22683 /// A pointer to the contents in the success state.
22684 /// Reading from this pointer when `result_ok` is not set is undefined.
22685 pub result: *mut crate::lightning::blinded_path::BlindedPath,
22686 /// Note that this value is always NULL, as there are no contents in the Err variant
22687 pub err: *mut core::ffi::c_void,
22690 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
22691 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
22692 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22693 pub struct CResult_BlindedPathNoneZ {
22694 /// The contents of this CResult_BlindedPathNoneZ, accessible via either
22695 /// `err` or `result` depending on the state of `result_ok`.
22696 pub contents: CResult_BlindedPathNoneZPtr,
22697 /// Whether this CResult_BlindedPathNoneZ represents a success state.
22698 pub result_ok: bool,
22701 /// Creates a new CResult_BlindedPathNoneZ in the success state.
22702 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
22703 CResult_BlindedPathNoneZ {
22704 contents: CResult_BlindedPathNoneZPtr {
22705 result: Box::into_raw(Box::new(o)),
22711 /// Creates a new CResult_BlindedPathNoneZ in the error state.
22712 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
22713 CResult_BlindedPathNoneZ {
22714 contents: CResult_BlindedPathNoneZPtr {
22715 err: core::ptr::null_mut(),
22720 /// Checks if the given object is currently in the success state
22722 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
22726 /// Frees any resources used by the CResult_BlindedPathNoneZ.
22727 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
22728 impl Drop for CResult_BlindedPathNoneZ {
22729 fn drop(&mut self) {
22730 if self.result_ok {
22731 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22732 let _ = unsafe { Box::from_raw(self.contents.result) };
22738 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
22739 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
22740 let contents = if o.result_ok {
22741 let result = unsafe { o.contents.result };
22742 unsafe { o.contents.result = core::ptr::null_mut() };
22743 CResult_BlindedPathNoneZPtr { result }
22745 let _ = unsafe { Box::from_raw(o.contents.err) };
22746 o.contents.err = core::ptr::null_mut();
22747 CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
22751 result_ok: o.result_ok,
22755 impl Clone for CResult_BlindedPathNoneZ {
22756 fn clone(&self) -> Self {
22757 if self.result_ok {
22758 Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
22759 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
22762 Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
22763 err: core::ptr::null_mut()
22769 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
22770 /// but with all dynamically-allocated buffers duplicated in new buffers.
22771 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
22773 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
22774 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
22775 /// A pointer to the contents in the success state.
22776 /// Reading from this pointer when `result_ok` is not set is undefined.
22777 pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
22778 /// Note that this value is always NULL, as there are no contents in the Err variant
22779 pub err: *mut core::ffi::c_void,
22782 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
22783 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
22784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22785 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22786 /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
22787 /// `err` or `result` depending on the state of `result_ok`.
22788 pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
22789 /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
22790 pub result_ok: bool,
22793 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
22794 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22795 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22796 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
22797 result: Box::into_raw(Box::new(o)),
22803 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
22804 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22805 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22806 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
22807 err: core::ptr::null_mut(),
22812 /// Checks if the given object is currently in the success state
22814 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
22818 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
22819 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
22820 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22821 fn drop(&mut self) {
22822 if self.result_ok {
22823 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22824 let _ = unsafe { Box::from_raw(self.contents.result) };
22830 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22831 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
22832 let contents = if o.result_ok {
22833 let result = unsafe { o.contents.result };
22834 unsafe { o.contents.result = core::ptr::null_mut() };
22835 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
22837 let _ = unsafe { Box::from_raw(o.contents.err) };
22838 o.contents.err = core::ptr::null_mut();
22839 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
22843 result_ok: o.result_ok,
22847 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
22848 fn clone(&self) -> Self {
22849 if self.result_ok {
22850 Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
22851 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
22854 Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
22855 err: core::ptr::null_mut()
22861 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
22862 /// but with all dynamically-allocated buffers duplicated in new buffers.
22863 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
22865 /// The contents of CResult_BlindedPathDecodeErrorZ
22866 pub union CResult_BlindedPathDecodeErrorZPtr {
22867 /// A pointer to the contents in the success state.
22868 /// Reading from this pointer when `result_ok` is not set is undefined.
22869 pub result: *mut crate::lightning::blinded_path::BlindedPath,
22870 /// A pointer to the contents in the error state.
22871 /// Reading from this pointer when `result_ok` is set is undefined.
22872 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22875 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
22876 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
22877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22878 pub struct CResult_BlindedPathDecodeErrorZ {
22879 /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
22880 /// `err` or `result` depending on the state of `result_ok`.
22881 pub contents: CResult_BlindedPathDecodeErrorZPtr,
22882 /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
22883 pub result_ok: bool,
22886 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
22887 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
22888 CResult_BlindedPathDecodeErrorZ {
22889 contents: CResult_BlindedPathDecodeErrorZPtr {
22890 result: Box::into_raw(Box::new(o)),
22896 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
22897 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
22898 CResult_BlindedPathDecodeErrorZ {
22899 contents: CResult_BlindedPathDecodeErrorZPtr {
22900 err: Box::into_raw(Box::new(e)),
22905 /// Checks if the given object is currently in the success state
22907 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
22911 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
22912 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
22913 impl Drop for CResult_BlindedPathDecodeErrorZ {
22914 fn drop(&mut self) {
22915 if self.result_ok {
22916 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22917 let _ = unsafe { Box::from_raw(self.contents.result) };
22920 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22921 let _ = unsafe { Box::from_raw(self.contents.err) };
22926 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
22927 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
22928 let contents = if o.result_ok {
22929 let result = unsafe { o.contents.result };
22930 unsafe { o.contents.result = core::ptr::null_mut() };
22931 CResult_BlindedPathDecodeErrorZPtr { result }
22933 let err = unsafe { o.contents.err };
22934 unsafe { o.contents.err = core::ptr::null_mut(); }
22935 CResult_BlindedPathDecodeErrorZPtr { err }
22939 result_ok: o.result_ok,
22943 impl Clone for CResult_BlindedPathDecodeErrorZ {
22944 fn clone(&self) -> Self {
22945 if self.result_ok {
22946 Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
22947 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
22950 Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
22951 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22957 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
22958 /// but with all dynamically-allocated buffers duplicated in new buffers.
22959 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
22961 /// The contents of CResult_BlindedHopDecodeErrorZ
22962 pub union CResult_BlindedHopDecodeErrorZPtr {
22963 /// A pointer to the contents in the success state.
22964 /// Reading from this pointer when `result_ok` is not set is undefined.
22965 pub result: *mut crate::lightning::blinded_path::BlindedHop,
22966 /// A pointer to the contents in the error state.
22967 /// Reading from this pointer when `result_ok` is set is undefined.
22968 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22971 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
22972 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
22973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22974 pub struct CResult_BlindedHopDecodeErrorZ {
22975 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
22976 /// `err` or `result` depending on the state of `result_ok`.
22977 pub contents: CResult_BlindedHopDecodeErrorZPtr,
22978 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
22979 pub result_ok: bool,
22982 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
22983 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
22984 CResult_BlindedHopDecodeErrorZ {
22985 contents: CResult_BlindedHopDecodeErrorZPtr {
22986 result: Box::into_raw(Box::new(o)),
22992 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
22993 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
22994 CResult_BlindedHopDecodeErrorZ {
22995 contents: CResult_BlindedHopDecodeErrorZPtr {
22996 err: Box::into_raw(Box::new(e)),
23001 /// Checks if the given object is currently in the success state
23003 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
23007 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
23008 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
23009 impl Drop for CResult_BlindedHopDecodeErrorZ {
23010 fn drop(&mut self) {
23011 if self.result_ok {
23012 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23013 let _ = unsafe { Box::from_raw(self.contents.result) };
23016 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23017 let _ = unsafe { Box::from_raw(self.contents.err) };
23022 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
23023 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
23024 let contents = if o.result_ok {
23025 let result = unsafe { o.contents.result };
23026 unsafe { o.contents.result = core::ptr::null_mut() };
23027 CResult_BlindedHopDecodeErrorZPtr { result }
23029 let err = unsafe { o.contents.err };
23030 unsafe { o.contents.err = core::ptr::null_mut(); }
23031 CResult_BlindedHopDecodeErrorZPtr { err }
23035 result_ok: o.result_ok,
23039 impl Clone for CResult_BlindedHopDecodeErrorZ {
23040 fn clone(&self) -> Self {
23041 if self.result_ok {
23042 Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
23043 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
23046 Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
23047 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23053 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
23054 /// but with all dynamically-allocated buffers duplicated in new buffers.
23055 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
23057 /// The contents of CResult_InvoiceErrorDecodeErrorZ
23058 pub union CResult_InvoiceErrorDecodeErrorZPtr {
23059 /// A pointer to the contents in the success state.
23060 /// Reading from this pointer when `result_ok` is not set is undefined.
23061 pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
23062 /// A pointer to the contents in the error state.
23063 /// Reading from this pointer when `result_ok` is set is undefined.
23064 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23067 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
23068 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
23069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23070 pub struct CResult_InvoiceErrorDecodeErrorZ {
23071 /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
23072 /// `err` or `result` depending on the state of `result_ok`.
23073 pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
23074 /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
23075 pub result_ok: bool,
23078 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
23079 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
23080 CResult_InvoiceErrorDecodeErrorZ {
23081 contents: CResult_InvoiceErrorDecodeErrorZPtr {
23082 result: Box::into_raw(Box::new(o)),
23088 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
23089 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
23090 CResult_InvoiceErrorDecodeErrorZ {
23091 contents: CResult_InvoiceErrorDecodeErrorZPtr {
23092 err: Box::into_raw(Box::new(e)),
23097 /// Checks if the given object is currently in the success state
23099 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
23103 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
23104 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
23105 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
23106 fn drop(&mut self) {
23107 if self.result_ok {
23108 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23109 let _ = unsafe { Box::from_raw(self.contents.result) };
23112 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23113 let _ = unsafe { Box::from_raw(self.contents.err) };
23118 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
23119 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
23120 let contents = if o.result_ok {
23121 let result = unsafe { o.contents.result };
23122 unsafe { o.contents.result = core::ptr::null_mut() };
23123 CResult_InvoiceErrorDecodeErrorZPtr { result }
23125 let err = unsafe { o.contents.err };
23126 unsafe { o.contents.err = core::ptr::null_mut(); }
23127 CResult_InvoiceErrorDecodeErrorZPtr { err }
23131 result_ok: o.result_ok,
23135 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
23136 fn clone(&self) -> Self {
23137 if self.result_ok {
23138 Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
23139 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
23142 Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
23143 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23149 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
23150 /// but with all dynamically-allocated buffers duplicated in new buffers.
23151 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
23153 /// An enum which can either contain a crate::lightning::chain::Filter or not
23154 pub enum COption_FilterZ {
23155 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
23156 Some(crate::lightning::chain::Filter),
23157 /// When we're in this state, this COption_FilterZ contains nothing
23160 impl COption_FilterZ {
23161 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23162 if let Self::None = self { false } else { true }
23164 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23167 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
23168 if let Self::Some(v) = self { v } else { unreachable!() }
23172 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
23173 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
23174 COption_FilterZ::Some(o)
23177 /// Constructs a new COption_FilterZ containing nothing
23178 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
23179 COption_FilterZ::None
23182 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
23183 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
23185 /// The contents of CResult_LockedChannelMonitorNoneZ
23186 pub union CResult_LockedChannelMonitorNoneZPtr {
23187 /// A pointer to the contents in the success state.
23188 /// Reading from this pointer when `result_ok` is not set is undefined.
23189 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
23190 /// Note that this value is always NULL, as there are no contents in the Err variant
23191 pub err: *mut core::ffi::c_void,
23194 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
23195 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
23196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23197 pub struct CResult_LockedChannelMonitorNoneZ {
23198 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
23199 /// `err` or `result` depending on the state of `result_ok`.
23200 pub contents: CResult_LockedChannelMonitorNoneZPtr,
23201 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
23202 pub result_ok: bool,
23205 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
23206 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
23207 CResult_LockedChannelMonitorNoneZ {
23208 contents: CResult_LockedChannelMonitorNoneZPtr {
23209 result: Box::into_raw(Box::new(o)),
23215 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
23216 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
23217 CResult_LockedChannelMonitorNoneZ {
23218 contents: CResult_LockedChannelMonitorNoneZPtr {
23219 err: core::ptr::null_mut(),
23224 /// Checks if the given object is currently in the success state
23226 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
23230 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
23231 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
23232 impl Drop for CResult_LockedChannelMonitorNoneZ {
23233 fn drop(&mut self) {
23234 if self.result_ok {
23235 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23236 let _ = unsafe { Box::from_raw(self.contents.result) };
23242 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
23243 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
23244 let contents = if o.result_ok {
23245 let result = unsafe { o.contents.result };
23246 unsafe { o.contents.result = core::ptr::null_mut() };
23247 CResult_LockedChannelMonitorNoneZPtr { result }
23249 let _ = unsafe { Box::from_raw(o.contents.err) };
23250 o.contents.err = core::ptr::null_mut();
23251 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
23255 result_ok: o.result_ok,
23260 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
23261 /// This corresponds to std::vector in C++
23262 pub struct CVec_OutPointZ {
23263 /// The elements in the array.
23264 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23265 pub data: *mut crate::lightning::chain::transaction::OutPoint,
23266 /// The number of elements pointed to by `data`.
23269 impl CVec_OutPointZ {
23270 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
23271 if self.datalen == 0 { return Vec::new(); }
23272 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23273 self.data = core::ptr::null_mut();
23277 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
23278 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23281 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
23282 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
23283 let datalen = v.len();
23284 let data = Box::into_raw(v.into_boxed_slice());
23285 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23289 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23290 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
23291 impl Drop for CVec_OutPointZ {
23292 fn drop(&mut self) {
23293 if self.datalen == 0 { return; }
23294 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23297 impl Clone for CVec_OutPointZ {
23298 fn clone(&self) -> Self {
23299 let mut res = Vec::new();
23300 if self.datalen == 0 { return Self::from(res); }
23301 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23306 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
23307 /// This corresponds to std::vector in C++
23308 pub struct CVec_MonitorUpdateIdZ {
23309 /// The elements in the array.
23310 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23311 pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
23312 /// The number of elements pointed to by `data`.
23315 impl CVec_MonitorUpdateIdZ {
23316 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
23317 if self.datalen == 0 { return Vec::new(); }
23318 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23319 self.data = core::ptr::null_mut();
23323 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
23324 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23327 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
23328 fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
23329 let datalen = v.len();
23330 let data = Box::into_raw(v.into_boxed_slice());
23331 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23335 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23336 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
23337 impl Drop for CVec_MonitorUpdateIdZ {
23338 fn drop(&mut self) {
23339 if self.datalen == 0 { return; }
23340 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23343 impl Clone for CVec_MonitorUpdateIdZ {
23344 fn clone(&self) -> Self {
23345 let mut res = Vec::new();
23346 if self.datalen == 0 { return Self::from(res); }
23347 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23352 /// A tuple of 2 elements. See the individual fields for the types contained.
23353 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23354 /// The element at position 0
23355 pub a: crate::lightning::chain::transaction::OutPoint,
23356 /// The element at position 1
23357 pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
23359 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23360 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
23367 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23368 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
23372 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23373 fn clone(&self) -> Self {
23375 a: Clone::clone(&self.a),
23376 b: Clone::clone(&self.b),
23381 /// Creates a new tuple which has the same data as `orig`
23382 /// but with all dynamically-allocated buffers duplicated in new buffers.
23383 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
23384 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
23386 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23387 C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
23391 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
23392 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
23394 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
23395 /// This corresponds to std::vector in C++
23396 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23397 /// The elements in the array.
23398 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23399 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
23400 /// The number of elements pointed to by `data`.
23403 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23404 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
23405 if self.datalen == 0 { return Vec::new(); }
23406 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23407 self.data = core::ptr::null_mut();
23411 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
23412 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23415 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23416 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
23417 let datalen = v.len();
23418 let data = Box::into_raw(v.into_boxed_slice());
23419 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23423 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23424 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
23425 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23426 fn drop(&mut self) {
23427 if self.datalen == 0 { return; }
23428 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23431 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23432 fn clone(&self) -> Self {
23433 let mut res = Vec::new();
23434 if self.datalen == 0 { return Self::from(res); }
23435 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });