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_ChannelDerivationParametersDecodeErrorZ
1690 pub union CResult_ChannelDerivationParametersDecodeErrorZPtr {
1691 /// A pointer to the contents in the success state.
1692 /// Reading from this pointer when `result_ok` is not set is undefined.
1693 pub result: *mut crate::lightning::sign::ChannelDerivationParameters,
1694 /// A pointer to the contents in the error state.
1695 /// Reading from this pointer when `result_ok` is set is undefined.
1696 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1699 /// A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
1700 /// containing a crate::lightning::sign::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1702 pub struct CResult_ChannelDerivationParametersDecodeErrorZ {
1703 /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
1704 /// `err` or `result` depending on the state of `result_ok`.
1705 pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr,
1706 /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
1707 pub result_ok: bool,
1710 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
1711 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::sign::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ {
1712 CResult_ChannelDerivationParametersDecodeErrorZ {
1713 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1714 result: Box::into_raw(Box::new(o)),
1720 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
1721 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ {
1722 CResult_ChannelDerivationParametersDecodeErrorZ {
1723 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1724 err: Box::into_raw(Box::new(e)),
1729 /// Checks if the given object is currently in the success state
1731 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool {
1735 /// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
1736 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { }
1737 impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ {
1738 fn drop(&mut self) {
1740 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1741 let _ = unsafe { Box::from_raw(self.contents.result) };
1744 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1745 let _ = unsafe { Box::from_raw(self.contents.err) };
1750 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDerivationParametersDecodeErrorZ {
1751 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1752 let contents = if o.result_ok {
1753 let result = unsafe { o.contents.result };
1754 unsafe { o.contents.result = core::ptr::null_mut() };
1755 CResult_ChannelDerivationParametersDecodeErrorZPtr { result }
1757 let err = unsafe { o.contents.err };
1758 unsafe { o.contents.err = core::ptr::null_mut(); }
1759 CResult_ChannelDerivationParametersDecodeErrorZPtr { err }
1763 result_ok: o.result_ok,
1767 impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ {
1768 fn clone(&self) -> Self {
1770 Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1771 result: Box::into_raw(Box::new(<crate::lightning::sign::ChannelDerivationParameters>::clone(unsafe { &*self.contents.result })))
1774 Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
1775 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1781 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
1782 /// but with all dynamically-allocated buffers duplicated in new buffers.
1783 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) }
1785 /// The contents of CResult_HTLCDescriptorDecodeErrorZ
1786 pub union CResult_HTLCDescriptorDecodeErrorZPtr {
1787 /// A pointer to the contents in the success state.
1788 /// Reading from this pointer when `result_ok` is not set is undefined.
1789 pub result: *mut crate::lightning::sign::HTLCDescriptor,
1790 /// A pointer to the contents in the error state.
1791 /// Reading from this pointer when `result_ok` is set is undefined.
1792 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1795 /// A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
1796 /// containing a crate::lightning::sign::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1798 pub struct CResult_HTLCDescriptorDecodeErrorZ {
1799 /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
1800 /// `err` or `result` depending on the state of `result_ok`.
1801 pub contents: CResult_HTLCDescriptorDecodeErrorZPtr,
1802 /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
1803 pub result_ok: bool,
1806 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
1807 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ {
1808 CResult_HTLCDescriptorDecodeErrorZ {
1809 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1810 result: Box::into_raw(Box::new(o)),
1816 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
1817 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ {
1818 CResult_HTLCDescriptorDecodeErrorZ {
1819 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1820 err: Box::into_raw(Box::new(e)),
1825 /// Checks if the given object is currently in the success state
1827 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool {
1831 /// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
1832 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { }
1833 impl Drop for CResult_HTLCDescriptorDecodeErrorZ {
1834 fn drop(&mut self) {
1836 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1837 let _ = unsafe { Box::from_raw(self.contents.result) };
1840 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1841 let _ = unsafe { Box::from_raw(self.contents.err) };
1846 impl From<crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCDescriptorDecodeErrorZ {
1847 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1848 let contents = if o.result_ok {
1849 let result = unsafe { o.contents.result };
1850 unsafe { o.contents.result = core::ptr::null_mut() };
1851 CResult_HTLCDescriptorDecodeErrorZPtr { result }
1853 let err = unsafe { o.contents.err };
1854 unsafe { o.contents.err = core::ptr::null_mut(); }
1855 CResult_HTLCDescriptorDecodeErrorZPtr { err }
1859 result_ok: o.result_ok,
1863 impl Clone for CResult_HTLCDescriptorDecodeErrorZ {
1864 fn clone(&self) -> Self {
1866 Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1867 result: Box::into_raw(Box::new(<crate::lightning::sign::HTLCDescriptor>::clone(unsafe { &*self.contents.result })))
1870 Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
1871 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1877 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
1878 /// but with all dynamically-allocated buffers duplicated in new buffers.
1879 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) }
1881 /// The contents of CResult_NoneNoneZ
1882 pub union CResult_NoneNoneZPtr {
1883 /// Note that this value is always NULL, as there are no contents in the OK variant
1884 pub result: *mut core::ffi::c_void,
1885 /// Note that this value is always NULL, as there are no contents in the Err variant
1886 pub err: *mut core::ffi::c_void,
1889 /// A CResult_NoneNoneZ represents the result of a fallible operation,
1890 /// containing a () on success and a () on failure.
1891 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1892 pub struct CResult_NoneNoneZ {
1893 /// The contents of this CResult_NoneNoneZ, accessible via either
1894 /// `err` or `result` depending on the state of `result_ok`.
1895 pub contents: CResult_NoneNoneZPtr,
1896 /// Whether this CResult_NoneNoneZ represents a success state.
1897 pub result_ok: bool,
1900 /// Creates a new CResult_NoneNoneZ in the success state.
1901 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
1903 contents: CResult_NoneNoneZPtr {
1904 result: core::ptr::null_mut(),
1910 /// Creates a new CResult_NoneNoneZ in the error state.
1911 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
1913 contents: CResult_NoneNoneZPtr {
1914 err: core::ptr::null_mut(),
1919 /// Checks if the given object is currently in the success state
1921 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
1925 /// Frees any resources used by the CResult_NoneNoneZ.
1926 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
1927 impl Drop for CResult_NoneNoneZ {
1928 fn drop(&mut self) {
1934 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
1935 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
1936 let contents = if o.result_ok {
1937 let _ = unsafe { Box::from_raw(o.contents.result) };
1938 o.contents.result = core::ptr::null_mut();
1939 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
1941 let _ = unsafe { Box::from_raw(o.contents.err) };
1942 o.contents.err = core::ptr::null_mut();
1943 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
1947 result_ok: o.result_ok,
1951 impl Clone for CResult_NoneNoneZ {
1952 fn clone(&self) -> Self {
1954 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
1955 result: core::ptr::null_mut()
1958 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
1959 err: core::ptr::null_mut()
1965 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
1966 /// but with all dynamically-allocated buffers duplicated in new buffers.
1967 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
1969 /// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size.
1970 /// This corresponds to std::vector in C++
1971 pub struct CVec_ECDSASignatureZ {
1972 /// The elements in the array.
1973 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1974 pub data: *mut crate::c_types::ECDSASignature,
1975 /// The number of elements pointed to by `data`.
1978 impl CVec_ECDSASignatureZ {
1979 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ECDSASignature> {
1980 if self.datalen == 0 { return Vec::new(); }
1981 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1982 self.data = core::ptr::null_mut();
1986 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] {
1987 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1990 impl From<Vec<crate::c_types::ECDSASignature>> for CVec_ECDSASignatureZ {
1991 fn from(v: Vec<crate::c_types::ECDSASignature>) -> Self {
1992 let datalen = v.len();
1993 let data = Box::into_raw(v.into_boxed_slice());
1994 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1998 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1999 pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { }
2000 impl Drop for CVec_ECDSASignatureZ {
2001 fn drop(&mut self) {
2002 if self.datalen == 0 { return; }
2003 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2006 impl Clone for CVec_ECDSASignatureZ {
2007 fn clone(&self) -> Self {
2008 let mut res = Vec::new();
2009 if self.datalen == 0 { return Self::from(res); }
2010 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2015 /// A tuple of 2 elements. See the individual fields for the types contained.
2016 pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2017 /// The element at position 0
2018 pub a: crate::c_types::ECDSASignature,
2019 /// The element at position 1
2020 pub b: crate::c_types::derived::CVec_ECDSASignatureZ,
2022 impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2023 fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self {
2030 impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2031 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) {
2035 impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2036 fn clone(&self) -> Self {
2038 a: Clone::clone(&self.a),
2039 b: Clone::clone(&self.b),
2044 /// Creates a new tuple which has the same data as `orig`
2045 /// but with all dynamically-allocated buffers duplicated in new buffers.
2046 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) }
2047 /// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements.
2049 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
2050 C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, }
2054 /// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ.
2055 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { }
2057 /// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ
2058 pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2059 /// A pointer to the contents in the success state.
2060 /// Reading from this pointer when `result_ok` is not set is undefined.
2061 pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ,
2062 /// Note that this value is always NULL, as there are no contents in the Err variant
2063 pub err: *mut core::ffi::c_void,
2066 /// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation,
2067 /// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure.
2068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2069 pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2070 /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either
2071 /// `err` or `result` depending on the state of `result_ok`.
2072 pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr,
2073 /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state.
2074 pub result_ok: bool,
2077 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state.
2078 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2079 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2080 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2081 result: Box::into_raw(Box::new(o)),
2087 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state.
2088 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2089 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2090 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2091 err: core::ptr::null_mut(),
2096 /// Checks if the given object is currently in the success state
2098 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool {
2102 /// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.
2103 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { }
2104 impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2105 fn drop(&mut self) {
2107 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2108 let _ = unsafe { Box::from_raw(self.contents.result) };
2114 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2115 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>) -> Self {
2116 let contents = if o.result_ok {
2117 let result = unsafe { o.contents.result };
2118 unsafe { o.contents.result = core::ptr::null_mut() };
2119 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result }
2121 let _ = unsafe { Box::from_raw(o.contents.err) };
2122 o.contents.err = core::ptr::null_mut();
2123 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() }
2127 result_ok: o.result_ok,
2131 impl Clone for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
2132 fn clone(&self) -> Self {
2134 Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2135 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ>::clone(unsafe { &*self.contents.result })))
2138 Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
2139 err: core::ptr::null_mut()
2145 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig`
2146 /// but with all dynamically-allocated buffers duplicated in new buffers.
2147 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) }
2149 /// The contents of CResult_ECDSASignatureNoneZ
2150 pub union CResult_ECDSASignatureNoneZPtr {
2151 /// A pointer to the contents in the success state.
2152 /// Reading from this pointer when `result_ok` is not set is undefined.
2153 pub result: *mut crate::c_types::ECDSASignature,
2154 /// Note that this value is always NULL, as there are no contents in the Err variant
2155 pub err: *mut core::ffi::c_void,
2158 /// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation,
2159 /// containing a crate::c_types::ECDSASignature on success and a () on failure.
2160 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2161 pub struct CResult_ECDSASignatureNoneZ {
2162 /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either
2163 /// `err` or `result` depending on the state of `result_ok`.
2164 pub contents: CResult_ECDSASignatureNoneZPtr,
2165 /// Whether this CResult_ECDSASignatureNoneZ represents a success state.
2166 pub result_ok: bool,
2169 /// Creates a new CResult_ECDSASignatureNoneZ in the success state.
2170 pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ {
2171 CResult_ECDSASignatureNoneZ {
2172 contents: CResult_ECDSASignatureNoneZPtr {
2173 result: Box::into_raw(Box::new(o)),
2179 /// Creates a new CResult_ECDSASignatureNoneZ in the error state.
2180 pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ {
2181 CResult_ECDSASignatureNoneZ {
2182 contents: CResult_ECDSASignatureNoneZPtr {
2183 err: core::ptr::null_mut(),
2188 /// Checks if the given object is currently in the success state
2190 pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool {
2194 /// Frees any resources used by the CResult_ECDSASignatureNoneZ.
2195 pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { }
2196 impl Drop for CResult_ECDSASignatureNoneZ {
2197 fn drop(&mut self) {
2199 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2200 let _ = unsafe { Box::from_raw(self.contents.result) };
2206 impl From<crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>> for CResult_ECDSASignatureNoneZ {
2207 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>) -> Self {
2208 let contents = if o.result_ok {
2209 let result = unsafe { o.contents.result };
2210 unsafe { o.contents.result = core::ptr::null_mut() };
2211 CResult_ECDSASignatureNoneZPtr { result }
2213 let _ = unsafe { Box::from_raw(o.contents.err) };
2214 o.contents.err = core::ptr::null_mut();
2215 CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() }
2219 result_ok: o.result_ok,
2223 impl Clone for CResult_ECDSASignatureNoneZ {
2224 fn clone(&self) -> Self {
2226 Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr {
2227 result: Box::into_raw(Box::new(<crate::c_types::ECDSASignature>::clone(unsafe { &*self.contents.result })))
2230 Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr {
2231 err: core::ptr::null_mut()
2237 /// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig`
2238 /// but with all dynamically-allocated buffers duplicated in new buffers.
2239 pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) }
2241 /// The contents of CResult_PublicKeyNoneZ
2242 pub union CResult_PublicKeyNoneZPtr {
2243 /// A pointer to the contents in the success state.
2244 /// Reading from this pointer when `result_ok` is not set is undefined.
2245 pub result: *mut crate::c_types::PublicKey,
2246 /// Note that this value is always NULL, as there are no contents in the Err variant
2247 pub err: *mut core::ffi::c_void,
2250 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
2251 /// containing a crate::c_types::PublicKey on success and a () on failure.
2252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2253 pub struct CResult_PublicKeyNoneZ {
2254 /// The contents of this CResult_PublicKeyNoneZ, accessible via either
2255 /// `err` or `result` depending on the state of `result_ok`.
2256 pub contents: CResult_PublicKeyNoneZPtr,
2257 /// Whether this CResult_PublicKeyNoneZ represents a success state.
2258 pub result_ok: bool,
2261 /// Creates a new CResult_PublicKeyNoneZ in the success state.
2262 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
2263 CResult_PublicKeyNoneZ {
2264 contents: CResult_PublicKeyNoneZPtr {
2265 result: Box::into_raw(Box::new(o)),
2271 /// Creates a new CResult_PublicKeyNoneZ in the error state.
2272 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
2273 CResult_PublicKeyNoneZ {
2274 contents: CResult_PublicKeyNoneZPtr {
2275 err: core::ptr::null_mut(),
2280 /// Checks if the given object is currently in the success state
2282 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
2286 /// Frees any resources used by the CResult_PublicKeyNoneZ.
2287 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
2288 impl Drop for CResult_PublicKeyNoneZ {
2289 fn drop(&mut self) {
2291 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2292 let _ = unsafe { Box::from_raw(self.contents.result) };
2298 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
2299 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
2300 let contents = if o.result_ok {
2301 let result = unsafe { o.contents.result };
2302 unsafe { o.contents.result = core::ptr::null_mut() };
2303 CResult_PublicKeyNoneZPtr { result }
2305 let _ = unsafe { Box::from_raw(o.contents.err) };
2306 o.contents.err = core::ptr::null_mut();
2307 CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
2311 result_ok: o.result_ok,
2315 impl Clone for CResult_PublicKeyNoneZ {
2316 fn clone(&self) -> Self {
2318 Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
2319 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
2322 Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
2323 err: core::ptr::null_mut()
2329 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
2330 /// but with all dynamically-allocated buffers duplicated in new buffers.
2331 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
2334 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
2335 pub enum COption_BigEndianScalarZ {
2336 /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar
2337 Some(crate::c_types::BigEndianScalar),
2338 /// When we're in this state, this COption_BigEndianScalarZ contains nothing
2341 impl COption_BigEndianScalarZ {
2342 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2343 if let Self::None = self { false } else { true }
2345 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2348 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
2349 if let Self::Some(v) = self { v } else { unreachable!() }
2353 /// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar
2354 pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ {
2355 COption_BigEndianScalarZ::Some(o)
2358 /// Constructs a new COption_BigEndianScalarZ containing nothing
2359 pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ {
2360 COption_BigEndianScalarZ::None
2363 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
2364 pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { }
2366 /// Creates a new COption_BigEndianScalarZ which has the same data as `orig`
2367 /// but with all dynamically-allocated buffers duplicated in new buffers.
2368 pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) }
2370 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2371 /// This corresponds to std::vector in C++
2372 pub struct CVec_U5Z {
2373 /// The elements in the array.
2374 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2375 pub data: *mut crate::c_types::U5,
2376 /// The number of elements pointed to by `data`.
2380 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
2381 if self.datalen == 0 { return Vec::new(); }
2382 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2383 self.data = core::ptr::null_mut();
2387 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
2388 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2391 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
2392 fn from(v: Vec<crate::c_types::U5>) -> Self {
2393 let datalen = v.len();
2394 let data = Box::into_raw(v.into_boxed_slice());
2395 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2399 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2400 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
2401 impl Drop for CVec_U5Z {
2402 fn drop(&mut self) {
2403 if self.datalen == 0 { return; }
2404 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2407 impl Clone for CVec_U5Z {
2408 fn clone(&self) -> Self {
2409 let mut res = Vec::new();
2410 if self.datalen == 0 { return Self::from(res); }
2411 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2416 /// The contents of CResult_RecoverableSignatureNoneZ
2417 pub union CResult_RecoverableSignatureNoneZPtr {
2418 /// A pointer to the contents in the success state.
2419 /// Reading from this pointer when `result_ok` is not set is undefined.
2420 pub result: *mut crate::c_types::RecoverableSignature,
2421 /// Note that this value is always NULL, as there are no contents in the Err variant
2422 pub err: *mut core::ffi::c_void,
2425 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2426 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
2427 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2428 pub struct CResult_RecoverableSignatureNoneZ {
2429 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2430 /// `err` or `result` depending on the state of `result_ok`.
2431 pub contents: CResult_RecoverableSignatureNoneZPtr,
2432 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
2433 pub result_ok: bool,
2436 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
2437 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
2438 CResult_RecoverableSignatureNoneZ {
2439 contents: CResult_RecoverableSignatureNoneZPtr {
2440 result: Box::into_raw(Box::new(o)),
2446 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
2447 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
2448 CResult_RecoverableSignatureNoneZ {
2449 contents: CResult_RecoverableSignatureNoneZPtr {
2450 err: core::ptr::null_mut(),
2455 /// Checks if the given object is currently in the success state
2457 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
2461 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
2462 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
2463 impl Drop for CResult_RecoverableSignatureNoneZ {
2464 fn drop(&mut self) {
2466 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2467 let _ = unsafe { Box::from_raw(self.contents.result) };
2473 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2474 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2475 let contents = if o.result_ok {
2476 let result = unsafe { o.contents.result };
2477 unsafe { o.contents.result = core::ptr::null_mut() };
2478 CResult_RecoverableSignatureNoneZPtr { result }
2480 let _ = unsafe { Box::from_raw(o.contents.err) };
2481 o.contents.err = core::ptr::null_mut();
2482 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2486 result_ok: o.result_ok,
2490 impl Clone for CResult_RecoverableSignatureNoneZ {
2491 fn clone(&self) -> Self {
2493 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2494 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2497 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2498 err: core::ptr::null_mut()
2504 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2505 /// but with all dynamically-allocated buffers duplicated in new buffers.
2506 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2508 /// The contents of CResult_SchnorrSignatureNoneZ
2509 pub union CResult_SchnorrSignatureNoneZPtr {
2510 /// A pointer to the contents in the success state.
2511 /// Reading from this pointer when `result_ok` is not set is undefined.
2512 pub result: *mut crate::c_types::SchnorrSignature,
2513 /// Note that this value is always NULL, as there are no contents in the Err variant
2514 pub err: *mut core::ffi::c_void,
2517 /// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation,
2518 /// containing a crate::c_types::SchnorrSignature on success and a () on failure.
2519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2520 pub struct CResult_SchnorrSignatureNoneZ {
2521 /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either
2522 /// `err` or `result` depending on the state of `result_ok`.
2523 pub contents: CResult_SchnorrSignatureNoneZPtr,
2524 /// Whether this CResult_SchnorrSignatureNoneZ represents a success state.
2525 pub result_ok: bool,
2528 /// Creates a new CResult_SchnorrSignatureNoneZ in the success state.
2529 pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ {
2530 CResult_SchnorrSignatureNoneZ {
2531 contents: CResult_SchnorrSignatureNoneZPtr {
2532 result: Box::into_raw(Box::new(o)),
2538 /// Creates a new CResult_SchnorrSignatureNoneZ in the error state.
2539 pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ {
2540 CResult_SchnorrSignatureNoneZ {
2541 contents: CResult_SchnorrSignatureNoneZPtr {
2542 err: core::ptr::null_mut(),
2547 /// Checks if the given object is currently in the success state
2549 pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool {
2553 /// Frees any resources used by the CResult_SchnorrSignatureNoneZ.
2554 pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { }
2555 impl Drop for CResult_SchnorrSignatureNoneZ {
2556 fn drop(&mut self) {
2558 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2559 let _ = unsafe { Box::from_raw(self.contents.result) };
2565 impl From<crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>> for CResult_SchnorrSignatureNoneZ {
2566 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>) -> Self {
2567 let contents = if o.result_ok {
2568 let result = unsafe { o.contents.result };
2569 unsafe { o.contents.result = core::ptr::null_mut() };
2570 CResult_SchnorrSignatureNoneZPtr { result }
2572 let _ = unsafe { Box::from_raw(o.contents.err) };
2573 o.contents.err = core::ptr::null_mut();
2574 CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() }
2578 result_ok: o.result_ok,
2582 impl Clone for CResult_SchnorrSignatureNoneZ {
2583 fn clone(&self) -> Self {
2585 Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr {
2586 result: Box::into_raw(Box::new(<crate::c_types::SchnorrSignature>::clone(unsafe { &*self.contents.result })))
2589 Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr {
2590 err: core::ptr::null_mut()
2596 /// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig`
2597 /// but with all dynamically-allocated buffers duplicated in new buffers.
2598 pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) }
2600 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2601 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2602 /// A pointer to the contents in the success state.
2603 /// Reading from this pointer when `result_ok` is not set is undefined.
2604 pub result: *mut crate::lightning::sign::WriteableEcdsaChannelSigner,
2605 /// A pointer to the contents in the error state.
2606 /// Reading from this pointer when `result_ok` is set is undefined.
2607 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2610 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2611 /// containing a crate::lightning::sign::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2613 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2614 /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2615 /// `err` or `result` depending on the state of `result_ok`.
2616 pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2617 /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2618 pub result_ok: bool,
2621 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2622 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2623 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2624 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2625 result: Box::into_raw(Box::new(o)),
2631 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
2632 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2633 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2634 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2635 err: Box::into_raw(Box::new(e)),
2640 /// Checks if the given object is currently in the success state
2642 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
2646 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
2647 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
2648 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2649 fn drop(&mut self) {
2651 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2652 let _ = unsafe { Box::from_raw(self.contents.result) };
2655 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2656 let _ = unsafe { Box::from_raw(self.contents.err) };
2661 impl From<crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2662 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2663 let contents = if o.result_ok {
2664 let result = unsafe { o.contents.result };
2665 unsafe { o.contents.result = core::ptr::null_mut() };
2666 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
2668 let err = unsafe { o.contents.err };
2669 unsafe { o.contents.err = core::ptr::null_mut(); }
2670 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
2674 result_ok: o.result_ok,
2678 impl Clone for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2679 fn clone(&self) -> Self {
2681 Self { result_ok: true, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2682 result: Box::into_raw(Box::new(<crate::lightning::sign::WriteableEcdsaChannelSigner>::clone(unsafe { &*self.contents.result })))
2685 Self { result_ok: false, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2686 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2692 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig`
2693 /// but with all dynamically-allocated buffers duplicated in new buffers.
2694 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) }
2696 /// The contents of CResult_CVec_u8ZNoneZ
2697 pub union CResult_CVec_u8ZNoneZPtr {
2698 /// A pointer to the contents in the success state.
2699 /// Reading from this pointer when `result_ok` is not set is undefined.
2700 pub result: *mut crate::c_types::derived::CVec_u8Z,
2701 /// Note that this value is always NULL, as there are no contents in the Err variant
2702 pub err: *mut core::ffi::c_void,
2705 /// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation,
2706 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2708 pub struct CResult_CVec_u8ZNoneZ {
2709 /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either
2710 /// `err` or `result` depending on the state of `result_ok`.
2711 pub contents: CResult_CVec_u8ZNoneZPtr,
2712 /// Whether this CResult_CVec_u8ZNoneZ represents a success state.
2713 pub result_ok: bool,
2716 /// Creates a new CResult_CVec_u8ZNoneZ in the success state.
2717 pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ {
2718 CResult_CVec_u8ZNoneZ {
2719 contents: CResult_CVec_u8ZNoneZPtr {
2720 result: Box::into_raw(Box::new(o)),
2726 /// Creates a new CResult_CVec_u8ZNoneZ in the error state.
2727 pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ {
2728 CResult_CVec_u8ZNoneZ {
2729 contents: CResult_CVec_u8ZNoneZPtr {
2730 err: core::ptr::null_mut(),
2735 /// Checks if the given object is currently in the success state
2737 pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool {
2741 /// Frees any resources used by the CResult_CVec_u8ZNoneZ.
2742 pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { }
2743 impl Drop for CResult_CVec_u8ZNoneZ {
2744 fn drop(&mut self) {
2746 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2747 let _ = unsafe { Box::from_raw(self.contents.result) };
2753 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_CVec_u8ZNoneZ {
2754 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
2755 let contents = if o.result_ok {
2756 let result = unsafe { o.contents.result };
2757 unsafe { o.contents.result = core::ptr::null_mut() };
2758 CResult_CVec_u8ZNoneZPtr { result }
2760 let _ = unsafe { Box::from_raw(o.contents.err) };
2761 o.contents.err = core::ptr::null_mut();
2762 CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() }
2766 result_ok: o.result_ok,
2770 impl Clone for CResult_CVec_u8ZNoneZ {
2771 fn clone(&self) -> Self {
2773 Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr {
2774 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
2777 Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr {
2778 err: core::ptr::null_mut()
2784 /// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig`
2785 /// but with all dynamically-allocated buffers duplicated in new buffers.
2786 pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) }
2788 /// The contents of CResult_ShutdownScriptNoneZ
2789 pub union CResult_ShutdownScriptNoneZPtr {
2790 /// A pointer to the contents in the success state.
2791 /// Reading from this pointer when `result_ok` is not set is undefined.
2792 pub result: *mut crate::lightning::ln::script::ShutdownScript,
2793 /// Note that this value is always NULL, as there are no contents in the Err variant
2794 pub err: *mut core::ffi::c_void,
2797 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
2798 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
2799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2800 pub struct CResult_ShutdownScriptNoneZ {
2801 /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
2802 /// `err` or `result` depending on the state of `result_ok`.
2803 pub contents: CResult_ShutdownScriptNoneZPtr,
2804 /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
2805 pub result_ok: bool,
2808 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
2809 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
2810 CResult_ShutdownScriptNoneZ {
2811 contents: CResult_ShutdownScriptNoneZPtr {
2812 result: Box::into_raw(Box::new(o)),
2818 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
2819 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
2820 CResult_ShutdownScriptNoneZ {
2821 contents: CResult_ShutdownScriptNoneZPtr {
2822 err: core::ptr::null_mut(),
2827 /// Checks if the given object is currently in the success state
2829 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
2833 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
2834 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
2835 impl Drop for CResult_ShutdownScriptNoneZ {
2836 fn drop(&mut self) {
2838 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2839 let _ = unsafe { Box::from_raw(self.contents.result) };
2845 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
2846 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
2847 let contents = if o.result_ok {
2848 let result = unsafe { o.contents.result };
2849 unsafe { o.contents.result = core::ptr::null_mut() };
2850 CResult_ShutdownScriptNoneZPtr { result }
2852 let _ = unsafe { Box::from_raw(o.contents.err) };
2853 o.contents.err = core::ptr::null_mut();
2854 CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
2858 result_ok: o.result_ok,
2862 impl Clone for CResult_ShutdownScriptNoneZ {
2863 fn clone(&self) -> Self {
2865 Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
2866 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2869 Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
2870 err: core::ptr::null_mut()
2876 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
2877 /// but with all dynamically-allocated buffers duplicated in new buffers.
2878 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
2881 /// An enum which can either contain a u16 or not
2882 pub enum COption_u16Z {
2883 /// When we're in this state, this COption_u16Z contains a u16
2885 /// When we're in this state, this COption_u16Z contains nothing
2889 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2890 if let Self::None = self { false } else { true }
2892 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2895 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
2896 if let Self::Some(v) = self { v } else { unreachable!() }
2900 /// Constructs a new COption_u16Z containing a u16
2901 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
2902 COption_u16Z::Some(o)
2905 /// Constructs a new COption_u16Z containing nothing
2906 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
2910 /// Frees any resources associated with the u16, if we are in the Some state
2911 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
2913 /// Creates a new COption_u16Z which has the same data as `orig`
2914 /// but with all dynamically-allocated buffers duplicated in new buffers.
2915 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
2918 /// An enum which can either contain a bool or not
2919 pub enum COption_boolZ {
2920 /// When we're in this state, this COption_boolZ contains a bool
2922 /// When we're in this state, this COption_boolZ contains nothing
2925 impl COption_boolZ {
2926 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2927 if let Self::None = self { false } else { true }
2929 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2932 #[allow(unused)] pub(crate) fn take(mut self) -> bool {
2933 if let Self::Some(v) = self { v } else { unreachable!() }
2937 /// Constructs a new COption_boolZ containing a bool
2938 pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ {
2939 COption_boolZ::Some(o)
2942 /// Constructs a new COption_boolZ containing nothing
2943 pub extern "C" fn COption_boolZ_none() -> COption_boolZ {
2947 /// Frees any resources associated with the bool, if we are in the Some state
2948 pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { }
2950 /// Creates a new COption_boolZ which has the same data as `orig`
2951 /// but with all dynamically-allocated buffers duplicated in new buffers.
2952 pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) }
2954 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
2955 /// This corresponds to std::vector in C++
2956 pub struct CVec_CVec_u8ZZ {
2957 /// The elements in the array.
2958 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2959 pub data: *mut crate::c_types::derived::CVec_u8Z,
2960 /// The number of elements pointed to by `data`.
2963 impl CVec_CVec_u8ZZ {
2964 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
2965 if self.datalen == 0 { return Vec::new(); }
2966 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2967 self.data = core::ptr::null_mut();
2971 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
2972 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2975 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
2976 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
2977 let datalen = v.len();
2978 let data = Box::into_raw(v.into_boxed_slice());
2979 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2983 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2984 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
2985 impl Drop for CVec_CVec_u8ZZ {
2986 fn drop(&mut self) {
2987 if self.datalen == 0 { return; }
2988 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2991 impl Clone for CVec_CVec_u8ZZ {
2992 fn clone(&self) -> Self {
2993 let mut res = Vec::new();
2994 if self.datalen == 0 { return Self::from(res); }
2995 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3000 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
3001 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
3002 /// A pointer to the contents in the success state.
3003 /// Reading from this pointer when `result_ok` is not set is undefined.
3004 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
3005 /// Note that this value is always NULL, as there are no contents in the Err variant
3006 pub err: *mut core::ffi::c_void,
3009 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3010 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3011 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3012 pub struct CResult_CVec_CVec_u8ZZNoneZ {
3013 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3014 /// `err` or `result` depending on the state of `result_ok`.
3015 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
3016 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3017 pub result_ok: bool,
3020 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
3021 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
3022 CResult_CVec_CVec_u8ZZNoneZ {
3023 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3024 result: Box::into_raw(Box::new(o)),
3030 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
3031 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
3032 CResult_CVec_CVec_u8ZZNoneZ {
3033 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3034 err: core::ptr::null_mut(),
3039 /// Checks if the given object is currently in the success state
3041 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
3045 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
3046 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
3047 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
3048 fn drop(&mut self) {
3050 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3051 let _ = unsafe { Box::from_raw(self.contents.result) };
3057 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
3058 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
3059 let contents = if o.result_ok {
3060 let result = unsafe { o.contents.result };
3061 unsafe { o.contents.result = core::ptr::null_mut() };
3062 CResult_CVec_CVec_u8ZZNoneZPtr { result }
3064 let _ = unsafe { Box::from_raw(o.contents.err) };
3065 o.contents.err = core::ptr::null_mut();
3066 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
3070 result_ok: o.result_ok,
3074 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
3075 fn clone(&self) -> Self {
3077 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3078 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
3081 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
3082 err: core::ptr::null_mut()
3088 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
3089 /// but with all dynamically-allocated buffers duplicated in new buffers.
3090 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
3092 /// The contents of CResult_InMemorySignerDecodeErrorZ
3093 pub union CResult_InMemorySignerDecodeErrorZPtr {
3094 /// A pointer to the contents in the success state.
3095 /// Reading from this pointer when `result_ok` is not set is undefined.
3096 pub result: *mut crate::lightning::sign::InMemorySigner,
3097 /// A pointer to the contents in the error state.
3098 /// Reading from this pointer when `result_ok` is set is undefined.
3099 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3102 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3103 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3104 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3105 pub struct CResult_InMemorySignerDecodeErrorZ {
3106 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3107 /// `err` or `result` depending on the state of `result_ok`.
3108 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3109 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3110 pub result_ok: bool,
3113 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3114 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3115 CResult_InMemorySignerDecodeErrorZ {
3116 contents: CResult_InMemorySignerDecodeErrorZPtr {
3117 result: Box::into_raw(Box::new(o)),
3123 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3124 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3125 CResult_InMemorySignerDecodeErrorZ {
3126 contents: CResult_InMemorySignerDecodeErrorZPtr {
3127 err: Box::into_raw(Box::new(e)),
3132 /// Checks if the given object is currently in the success state
3134 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
3138 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3139 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3140 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3141 fn drop(&mut self) {
3143 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3144 let _ = unsafe { Box::from_raw(self.contents.result) };
3147 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3148 let _ = unsafe { Box::from_raw(self.contents.err) };
3153 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3154 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3155 let contents = if o.result_ok {
3156 let result = unsafe { o.contents.result };
3157 unsafe { o.contents.result = core::ptr::null_mut() };
3158 CResult_InMemorySignerDecodeErrorZPtr { result }
3160 let err = unsafe { o.contents.err };
3161 unsafe { o.contents.err = core::ptr::null_mut(); }
3162 CResult_InMemorySignerDecodeErrorZPtr { err }
3166 result_ok: o.result_ok,
3170 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3171 fn clone(&self) -> Self {
3173 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3174 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3177 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3178 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3184 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3185 /// but with all dynamically-allocated buffers duplicated in new buffers.
3186 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
3188 /// The contents of CResult_TransactionNoneZ
3189 pub union CResult_TransactionNoneZPtr {
3190 /// A pointer to the contents in the success state.
3191 /// Reading from this pointer when `result_ok` is not set is undefined.
3192 pub result: *mut crate::c_types::Transaction,
3193 /// Note that this value is always NULL, as there are no contents in the Err variant
3194 pub err: *mut core::ffi::c_void,
3197 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
3198 /// containing a crate::c_types::Transaction on success and a () on failure.
3199 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3200 pub struct CResult_TransactionNoneZ {
3201 /// The contents of this CResult_TransactionNoneZ, accessible via either
3202 /// `err` or `result` depending on the state of `result_ok`.
3203 pub contents: CResult_TransactionNoneZPtr,
3204 /// Whether this CResult_TransactionNoneZ represents a success state.
3205 pub result_ok: bool,
3208 /// Creates a new CResult_TransactionNoneZ in the success state.
3209 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
3210 CResult_TransactionNoneZ {
3211 contents: CResult_TransactionNoneZPtr {
3212 result: Box::into_raw(Box::new(o)),
3218 /// Creates a new CResult_TransactionNoneZ in the error state.
3219 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
3220 CResult_TransactionNoneZ {
3221 contents: CResult_TransactionNoneZPtr {
3222 err: core::ptr::null_mut(),
3227 /// Checks if the given object is currently in the success state
3229 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
3233 /// Frees any resources used by the CResult_TransactionNoneZ.
3234 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
3235 impl Drop for CResult_TransactionNoneZ {
3236 fn drop(&mut self) {
3238 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3239 let _ = unsafe { Box::from_raw(self.contents.result) };
3245 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
3246 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
3247 let contents = if o.result_ok {
3248 let result = unsafe { o.contents.result };
3249 unsafe { o.contents.result = core::ptr::null_mut() };
3250 CResult_TransactionNoneZPtr { result }
3252 let _ = unsafe { Box::from_raw(o.contents.err) };
3253 o.contents.err = core::ptr::null_mut();
3254 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
3258 result_ok: o.result_ok,
3262 impl Clone for CResult_TransactionNoneZ {
3263 fn clone(&self) -> Self {
3265 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
3266 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
3269 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
3270 err: core::ptr::null_mut()
3276 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
3277 /// but with all dynamically-allocated buffers duplicated in new buffers.
3278 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
3280 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
3281 pub enum COption_WriteableScoreZ {
3282 /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
3283 Some(crate::lightning::routing::scoring::WriteableScore),
3284 /// When we're in this state, this COption_WriteableScoreZ contains nothing
3287 impl COption_WriteableScoreZ {
3288 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3289 if let Self::None = self { false } else { true }
3291 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3294 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
3295 if let Self::Some(v) = self { v } else { unreachable!() }
3299 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
3300 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
3301 COption_WriteableScoreZ::Some(o)
3304 /// Constructs a new COption_WriteableScoreZ containing nothing
3305 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
3306 COption_WriteableScoreZ::None
3309 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
3310 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
3312 /// The contents of CResult_NoneIOErrorZ
3313 pub union CResult_NoneIOErrorZPtr {
3314 /// Note that this value is always NULL, as there are no contents in the OK variant
3315 pub result: *mut core::ffi::c_void,
3316 /// A pointer to the contents in the error state.
3317 /// Reading from this pointer when `result_ok` is set is undefined.
3318 pub err: *mut crate::c_types::IOError,
3321 /// A CResult_NoneIOErrorZ represents the result of a fallible operation,
3322 /// containing a () on success and a crate::c_types::IOError on failure.
3323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3324 pub struct CResult_NoneIOErrorZ {
3325 /// The contents of this CResult_NoneIOErrorZ, accessible via either
3326 /// `err` or `result` depending on the state of `result_ok`.
3327 pub contents: CResult_NoneIOErrorZPtr,
3328 /// Whether this CResult_NoneIOErrorZ represents a success state.
3329 pub result_ok: bool,
3332 /// Creates a new CResult_NoneIOErrorZ in the success state.
3333 pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ {
3334 CResult_NoneIOErrorZ {
3335 contents: CResult_NoneIOErrorZPtr {
3336 result: core::ptr::null_mut(),
3342 /// Creates a new CResult_NoneIOErrorZ in the error state.
3343 pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ {
3344 CResult_NoneIOErrorZ {
3345 contents: CResult_NoneIOErrorZPtr {
3346 err: Box::into_raw(Box::new(e)),
3351 /// Checks if the given object is currently in the success state
3353 pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool {
3357 /// Frees any resources used by the CResult_NoneIOErrorZ.
3358 pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { }
3359 impl Drop for CResult_NoneIOErrorZ {
3360 fn drop(&mut self) {
3363 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3364 let _ = unsafe { Box::from_raw(self.contents.err) };
3369 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneIOErrorZ {
3370 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
3371 let contents = if o.result_ok {
3372 let _ = unsafe { Box::from_raw(o.contents.result) };
3373 o.contents.result = core::ptr::null_mut();
3374 CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() }
3376 let err = unsafe { o.contents.err };
3377 unsafe { o.contents.err = core::ptr::null_mut(); }
3378 CResult_NoneIOErrorZPtr { err }
3382 result_ok: o.result_ok,
3386 impl Clone for CResult_NoneIOErrorZ {
3387 fn clone(&self) -> Self {
3389 Self { result_ok: true, contents: CResult_NoneIOErrorZPtr {
3390 result: core::ptr::null_mut()
3393 Self { result_ok: false, contents: CResult_NoneIOErrorZPtr {
3394 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
3400 /// Creates a new CResult_NoneIOErrorZ which has the same data as `orig`
3401 /// but with all dynamically-allocated buffers duplicated in new buffers.
3402 pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) }
3404 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3405 /// This corresponds to std::vector in C++
3406 pub struct CVec_ChannelDetailsZ {
3407 /// The elements in the array.
3408 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3409 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3410 /// The number of elements pointed to by `data`.
3413 impl CVec_ChannelDetailsZ {
3414 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3415 if self.datalen == 0 { return Vec::new(); }
3416 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3417 self.data = core::ptr::null_mut();
3421 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3422 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3425 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3426 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3427 let datalen = v.len();
3428 let data = Box::into_raw(v.into_boxed_slice());
3429 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3433 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3434 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3435 impl Drop for CVec_ChannelDetailsZ {
3436 fn drop(&mut self) {
3437 if self.datalen == 0 { return; }
3438 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3441 impl Clone for CVec_ChannelDetailsZ {
3442 fn clone(&self) -> Self {
3443 let mut res = Vec::new();
3444 if self.datalen == 0 { return Self::from(res); }
3445 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3450 /// The contents of CResult_RouteLightningErrorZ
3451 pub union CResult_RouteLightningErrorZPtr {
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::Route,
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::LightningError,
3460 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3461 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3463 pub struct CResult_RouteLightningErrorZ {
3464 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3465 /// `err` or `result` depending on the state of `result_ok`.
3466 pub contents: CResult_RouteLightningErrorZPtr,
3467 /// Whether this CResult_RouteLightningErrorZ represents a success state.
3468 pub result_ok: bool,
3471 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3472 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3473 CResult_RouteLightningErrorZ {
3474 contents: CResult_RouteLightningErrorZPtr {
3475 result: Box::into_raw(Box::new(o)),
3481 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3482 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3483 CResult_RouteLightningErrorZ {
3484 contents: CResult_RouteLightningErrorZPtr {
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_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3496 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3497 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3498 impl Drop for CResult_RouteLightningErrorZ {
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::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3512 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> 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_RouteLightningErrorZPtr { result }
3518 let err = unsafe { o.contents.err };
3519 unsafe { o.contents.err = core::ptr::null_mut(); }
3520 CResult_RouteLightningErrorZPtr { err }
3524 result_ok: o.result_ok,
3528 impl Clone for CResult_RouteLightningErrorZ {
3529 fn clone(&self) -> Self {
3531 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3532 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3535 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3536 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3542 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3543 /// but with all dynamically-allocated buffers duplicated in new buffers.
3544 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3546 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
3547 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
3548 /// A pointer to the contents in the success state.
3549 /// Reading from this pointer when `result_ok` is not set is undefined.
3550 pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
3551 /// A pointer to the contents in the error state.
3552 /// Reading from this pointer when `result_ok` is set is undefined.
3553 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3556 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
3557 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
3558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3559 pub struct CResult_InFlightHtlcsDecodeErrorZ {
3560 /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
3561 /// `err` or `result` depending on the state of `result_ok`.
3562 pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
3563 /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
3564 pub result_ok: bool,
3567 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
3568 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
3569 CResult_InFlightHtlcsDecodeErrorZ {
3570 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3571 result: Box::into_raw(Box::new(o)),
3577 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
3578 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
3579 CResult_InFlightHtlcsDecodeErrorZ {
3580 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3581 err: Box::into_raw(Box::new(e)),
3586 /// Checks if the given object is currently in the success state
3588 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
3592 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
3593 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
3594 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
3595 fn drop(&mut self) {
3597 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3598 let _ = unsafe { Box::from_raw(self.contents.result) };
3601 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3602 let _ = unsafe { Box::from_raw(self.contents.err) };
3607 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
3608 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
3609 let contents = if o.result_ok {
3610 let result = unsafe { o.contents.result };
3611 unsafe { o.contents.result = core::ptr::null_mut() };
3612 CResult_InFlightHtlcsDecodeErrorZPtr { result }
3614 let err = unsafe { o.contents.err };
3615 unsafe { o.contents.err = core::ptr::null_mut(); }
3616 CResult_InFlightHtlcsDecodeErrorZPtr { err }
3620 result_ok: o.result_ok,
3624 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
3625 fn clone(&self) -> Self {
3627 Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3628 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
3631 Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3632 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3638 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
3639 /// but with all dynamically-allocated buffers duplicated in new buffers.
3640 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
3642 /// The contents of CResult_RouteHopDecodeErrorZ
3643 pub union CResult_RouteHopDecodeErrorZPtr {
3644 /// A pointer to the contents in the success state.
3645 /// Reading from this pointer when `result_ok` is not set is undefined.
3646 pub result: *mut crate::lightning::routing::router::RouteHop,
3647 /// A pointer to the contents in the error state.
3648 /// Reading from this pointer when `result_ok` is set is undefined.
3649 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3652 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
3653 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3655 pub struct CResult_RouteHopDecodeErrorZ {
3656 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
3657 /// `err` or `result` depending on the state of `result_ok`.
3658 pub contents: CResult_RouteHopDecodeErrorZPtr,
3659 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
3660 pub result_ok: bool,
3663 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
3664 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
3665 CResult_RouteHopDecodeErrorZ {
3666 contents: CResult_RouteHopDecodeErrorZPtr {
3667 result: Box::into_raw(Box::new(o)),
3673 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
3674 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
3675 CResult_RouteHopDecodeErrorZ {
3676 contents: CResult_RouteHopDecodeErrorZPtr {
3677 err: Box::into_raw(Box::new(e)),
3682 /// Checks if the given object is currently in the success state
3684 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
3688 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
3689 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
3690 impl Drop for CResult_RouteHopDecodeErrorZ {
3691 fn drop(&mut self) {
3693 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3694 let _ = unsafe { Box::from_raw(self.contents.result) };
3697 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3698 let _ = unsafe { Box::from_raw(self.contents.err) };
3703 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
3704 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3705 let contents = if o.result_ok {
3706 let result = unsafe { o.contents.result };
3707 unsafe { o.contents.result = core::ptr::null_mut() };
3708 CResult_RouteHopDecodeErrorZPtr { result }
3710 let err = unsafe { o.contents.err };
3711 unsafe { o.contents.err = core::ptr::null_mut(); }
3712 CResult_RouteHopDecodeErrorZPtr { err }
3716 result_ok: o.result_ok,
3720 impl Clone for CResult_RouteHopDecodeErrorZ {
3721 fn clone(&self) -> Self {
3723 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
3724 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
3727 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
3728 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3734 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
3735 /// but with all dynamically-allocated buffers duplicated in new buffers.
3736 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
3738 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
3739 /// This corresponds to std::vector in C++
3740 pub struct CVec_BlindedHopZ {
3741 /// The elements in the array.
3742 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3743 pub data: *mut crate::lightning::blinded_path::BlindedHop,
3744 /// The number of elements pointed to by `data`.
3747 impl CVec_BlindedHopZ {
3748 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
3749 if self.datalen == 0 { return Vec::new(); }
3750 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3751 self.data = core::ptr::null_mut();
3755 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
3756 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3759 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
3760 fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
3761 let datalen = v.len();
3762 let data = Box::into_raw(v.into_boxed_slice());
3763 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3767 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3768 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
3769 impl Drop for CVec_BlindedHopZ {
3770 fn drop(&mut self) {
3771 if self.datalen == 0 { return; }
3772 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3775 impl Clone for CVec_BlindedHopZ {
3776 fn clone(&self) -> Self {
3777 let mut res = Vec::new();
3778 if self.datalen == 0 { return Self::from(res); }
3779 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3784 /// The contents of CResult_BlindedTailDecodeErrorZ
3785 pub union CResult_BlindedTailDecodeErrorZPtr {
3786 /// A pointer to the contents in the success state.
3787 /// Reading from this pointer when `result_ok` is not set is undefined.
3788 pub result: *mut crate::lightning::routing::router::BlindedTail,
3789 /// A pointer to the contents in the error state.
3790 /// Reading from this pointer when `result_ok` is set is undefined.
3791 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3794 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
3795 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
3796 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3797 pub struct CResult_BlindedTailDecodeErrorZ {
3798 /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
3799 /// `err` or `result` depending on the state of `result_ok`.
3800 pub contents: CResult_BlindedTailDecodeErrorZPtr,
3801 /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
3802 pub result_ok: bool,
3805 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
3806 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
3807 CResult_BlindedTailDecodeErrorZ {
3808 contents: CResult_BlindedTailDecodeErrorZPtr {
3809 result: Box::into_raw(Box::new(o)),
3815 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
3816 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
3817 CResult_BlindedTailDecodeErrorZ {
3818 contents: CResult_BlindedTailDecodeErrorZPtr {
3819 err: Box::into_raw(Box::new(e)),
3824 /// Checks if the given object is currently in the success state
3826 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
3830 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
3831 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
3832 impl Drop for CResult_BlindedTailDecodeErrorZ {
3833 fn drop(&mut self) {
3835 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3836 let _ = unsafe { Box::from_raw(self.contents.result) };
3839 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3840 let _ = unsafe { Box::from_raw(self.contents.err) };
3845 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
3846 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
3847 let contents = if o.result_ok {
3848 let result = unsafe { o.contents.result };
3849 unsafe { o.contents.result = core::ptr::null_mut() };
3850 CResult_BlindedTailDecodeErrorZPtr { result }
3852 let err = unsafe { o.contents.err };
3853 unsafe { o.contents.err = core::ptr::null_mut(); }
3854 CResult_BlindedTailDecodeErrorZPtr { err }
3858 result_ok: o.result_ok,
3862 impl Clone for CResult_BlindedTailDecodeErrorZ {
3863 fn clone(&self) -> Self {
3865 Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
3866 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
3869 Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
3870 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3876 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
3877 /// but with all dynamically-allocated buffers duplicated in new buffers.
3878 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
3880 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3881 /// This corresponds to std::vector in C++
3882 pub struct CVec_RouteHopZ {
3883 /// The elements in the array.
3884 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3885 pub data: *mut crate::lightning::routing::router::RouteHop,
3886 /// The number of elements pointed to by `data`.
3889 impl CVec_RouteHopZ {
3890 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
3891 if self.datalen == 0 { return Vec::new(); }
3892 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3893 self.data = core::ptr::null_mut();
3897 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
3898 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3901 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
3902 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
3903 let datalen = v.len();
3904 let data = Box::into_raw(v.into_boxed_slice());
3905 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3910 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3911 impl Drop for CVec_RouteHopZ {
3912 fn drop(&mut self) {
3913 if self.datalen == 0 { return; }
3914 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3917 impl Clone for CVec_RouteHopZ {
3918 fn clone(&self) -> Self {
3919 let mut res = Vec::new();
3920 if self.datalen == 0 { return Self::from(res); }
3921 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3926 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
3927 /// This corresponds to std::vector in C++
3928 pub struct CVec_PathZ {
3929 /// The elements in the array.
3930 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3931 pub data: *mut crate::lightning::routing::router::Path,
3932 /// The number of elements pointed to by `data`.
3936 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
3937 if self.datalen == 0 { return Vec::new(); }
3938 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3939 self.data = core::ptr::null_mut();
3943 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
3944 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3947 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
3948 fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
3949 let datalen = v.len();
3950 let data = Box::into_raw(v.into_boxed_slice());
3951 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3955 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3956 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
3957 impl Drop for CVec_PathZ {
3958 fn drop(&mut self) {
3959 if self.datalen == 0 { return; }
3960 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3963 impl Clone for CVec_PathZ {
3964 fn clone(&self) -> Self {
3965 let mut res = Vec::new();
3966 if self.datalen == 0 { return Self::from(res); }
3967 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3972 /// The contents of CResult_RouteDecodeErrorZ
3973 pub union CResult_RouteDecodeErrorZPtr {
3974 /// A pointer to the contents in the success state.
3975 /// Reading from this pointer when `result_ok` is not set is undefined.
3976 pub result: *mut crate::lightning::routing::router::Route,
3977 /// A pointer to the contents in the error state.
3978 /// Reading from this pointer when `result_ok` is set is undefined.
3979 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3982 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3983 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3984 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3985 pub struct CResult_RouteDecodeErrorZ {
3986 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
3987 /// `err` or `result` depending on the state of `result_ok`.
3988 pub contents: CResult_RouteDecodeErrorZPtr,
3989 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
3990 pub result_ok: bool,
3993 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
3994 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3995 CResult_RouteDecodeErrorZ {
3996 contents: CResult_RouteDecodeErrorZPtr {
3997 result: Box::into_raw(Box::new(o)),
4003 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
4004 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
4005 CResult_RouteDecodeErrorZ {
4006 contents: CResult_RouteDecodeErrorZPtr {
4007 err: Box::into_raw(Box::new(e)),
4012 /// Checks if the given object is currently in the success state
4014 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
4018 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
4019 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
4020 impl Drop for CResult_RouteDecodeErrorZ {
4021 fn drop(&mut self) {
4023 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4024 let _ = unsafe { Box::from_raw(self.contents.result) };
4027 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4028 let _ = unsafe { Box::from_raw(self.contents.err) };
4033 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
4034 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
4035 let contents = if o.result_ok {
4036 let result = unsafe { o.contents.result };
4037 unsafe { o.contents.result = core::ptr::null_mut() };
4038 CResult_RouteDecodeErrorZPtr { result }
4040 let err = unsafe { o.contents.err };
4041 unsafe { o.contents.err = core::ptr::null_mut(); }
4042 CResult_RouteDecodeErrorZPtr { err }
4046 result_ok: o.result_ok,
4050 impl Clone for CResult_RouteDecodeErrorZ {
4051 fn clone(&self) -> Self {
4053 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
4054 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4057 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
4058 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4064 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
4065 /// but with all dynamically-allocated buffers duplicated in new buffers.
4066 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
4068 /// The contents of CResult_RouteParametersDecodeErrorZ
4069 pub union CResult_RouteParametersDecodeErrorZPtr {
4070 /// A pointer to the contents in the success state.
4071 /// Reading from this pointer when `result_ok` is not set is undefined.
4072 pub result: *mut crate::lightning::routing::router::RouteParameters,
4073 /// A pointer to the contents in the error state.
4074 /// Reading from this pointer when `result_ok` is set is undefined.
4075 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4078 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
4079 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4081 pub struct CResult_RouteParametersDecodeErrorZ {
4082 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
4083 /// `err` or `result` depending on the state of `result_ok`.
4084 pub contents: CResult_RouteParametersDecodeErrorZPtr,
4085 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
4086 pub result_ok: bool,
4089 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
4090 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
4091 CResult_RouteParametersDecodeErrorZ {
4092 contents: CResult_RouteParametersDecodeErrorZPtr {
4093 result: Box::into_raw(Box::new(o)),
4099 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
4100 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
4101 CResult_RouteParametersDecodeErrorZ {
4102 contents: CResult_RouteParametersDecodeErrorZPtr {
4103 err: Box::into_raw(Box::new(e)),
4108 /// Checks if the given object is currently in the success state
4110 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
4114 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
4115 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
4116 impl Drop for CResult_RouteParametersDecodeErrorZ {
4117 fn drop(&mut self) {
4119 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4120 let _ = unsafe { Box::from_raw(self.contents.result) };
4123 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4124 let _ = unsafe { Box::from_raw(self.contents.err) };
4129 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
4130 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4131 let contents = if o.result_ok {
4132 let result = unsafe { o.contents.result };
4133 unsafe { o.contents.result = core::ptr::null_mut() };
4134 CResult_RouteParametersDecodeErrorZPtr { result }
4136 let err = unsafe { o.contents.err };
4137 unsafe { o.contents.err = core::ptr::null_mut(); }
4138 CResult_RouteParametersDecodeErrorZPtr { err }
4142 result_ok: o.result_ok,
4146 impl Clone for CResult_RouteParametersDecodeErrorZ {
4147 fn clone(&self) -> Self {
4149 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
4150 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
4153 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
4154 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4160 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
4161 /// but with all dynamically-allocated buffers duplicated in new buffers.
4162 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
4164 /// A dynamically-allocated array of u64s of arbitrary size.
4165 /// This corresponds to std::vector in C++
4166 pub struct CVec_u64Z {
4167 /// The elements in the array.
4168 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4170 /// The number of elements pointed to by `data`.
4174 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4175 if self.datalen == 0 { return Vec::new(); }
4176 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4177 self.data = core::ptr::null_mut();
4181 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
4182 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4185 impl From<Vec<u64>> for CVec_u64Z {
4186 fn from(v: Vec<u64>) -> Self {
4187 let datalen = v.len();
4188 let data = Box::into_raw(v.into_boxed_slice());
4189 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4193 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4194 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
4195 impl Drop for CVec_u64Z {
4196 fn drop(&mut self) {
4197 if self.datalen == 0 { return; }
4198 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4201 impl Clone for CVec_u64Z {
4202 fn clone(&self) -> Self {
4203 let mut res = Vec::new();
4204 if self.datalen == 0 { return Self::from(res); }
4205 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4210 /// The contents of CResult_PaymentParametersDecodeErrorZ
4211 pub union CResult_PaymentParametersDecodeErrorZPtr {
4212 /// A pointer to the contents in the success state.
4213 /// Reading from this pointer when `result_ok` is not set is undefined.
4214 pub result: *mut crate::lightning::routing::router::PaymentParameters,
4215 /// A pointer to the contents in the error state.
4216 /// Reading from this pointer when `result_ok` is set is undefined.
4217 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4220 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
4221 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4222 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4223 pub struct CResult_PaymentParametersDecodeErrorZ {
4224 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
4225 /// `err` or `result` depending on the state of `result_ok`.
4226 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
4227 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
4228 pub result_ok: bool,
4231 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
4232 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
4233 CResult_PaymentParametersDecodeErrorZ {
4234 contents: CResult_PaymentParametersDecodeErrorZPtr {
4235 result: Box::into_raw(Box::new(o)),
4241 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
4242 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
4243 CResult_PaymentParametersDecodeErrorZ {
4244 contents: CResult_PaymentParametersDecodeErrorZPtr {
4245 err: Box::into_raw(Box::new(e)),
4250 /// Checks if the given object is currently in the success state
4252 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
4256 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
4257 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
4258 impl Drop for CResult_PaymentParametersDecodeErrorZ {
4259 fn drop(&mut self) {
4261 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4262 let _ = unsafe { Box::from_raw(self.contents.result) };
4265 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4266 let _ = unsafe { Box::from_raw(self.contents.err) };
4271 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
4272 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4273 let contents = if o.result_ok {
4274 let result = unsafe { o.contents.result };
4275 unsafe { o.contents.result = core::ptr::null_mut() };
4276 CResult_PaymentParametersDecodeErrorZPtr { result }
4278 let err = unsafe { o.contents.err };
4279 unsafe { o.contents.err = core::ptr::null_mut(); }
4280 CResult_PaymentParametersDecodeErrorZPtr { err }
4284 result_ok: o.result_ok,
4288 impl Clone for CResult_PaymentParametersDecodeErrorZ {
4289 fn clone(&self) -> Self {
4291 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
4292 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
4295 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
4296 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4302 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
4303 /// but with all dynamically-allocated buffers duplicated in new buffers.
4304 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
4306 /// A tuple of 2 elements. See the individual fields for the types contained.
4307 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
4308 /// The element at position 0
4309 pub a: crate::lightning::offers::invoice::BlindedPayInfo,
4310 /// The element at position 1
4311 pub b: crate::lightning::blinded_path::BlindedPath,
4313 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
4314 fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
4321 impl C2Tuple_BlindedPayInfoBlindedPathZ {
4322 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
4326 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
4327 fn clone(&self) -> Self {
4329 a: Clone::clone(&self.a),
4330 b: Clone::clone(&self.b),
4335 /// Creates a new tuple which has the same data as `orig`
4336 /// but with all dynamically-allocated buffers duplicated in new buffers.
4337 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
4338 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
4340 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
4341 C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
4345 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
4346 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
4348 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
4349 /// This corresponds to std::vector in C++
4350 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4351 /// The elements in the array.
4352 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4353 pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
4354 /// The number of elements pointed to by `data`.
4357 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4358 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
4359 if self.datalen == 0 { return Vec::new(); }
4360 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4361 self.data = core::ptr::null_mut();
4365 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
4366 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4369 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4370 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
4371 let datalen = v.len();
4372 let data = Box::into_raw(v.into_boxed_slice());
4373 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4377 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4378 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
4379 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4380 fn drop(&mut self) {
4381 if self.datalen == 0 { return; }
4382 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4385 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4386 fn clone(&self) -> Self {
4387 let mut res = Vec::new();
4388 if self.datalen == 0 { return Self::from(res); }
4389 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4394 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
4395 /// This corresponds to std::vector in C++
4396 pub struct CVec_RouteHintZ {
4397 /// The elements in the array.
4398 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4399 pub data: *mut crate::lightning::routing::router::RouteHint,
4400 /// The number of elements pointed to by `data`.
4403 impl CVec_RouteHintZ {
4404 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
4405 if self.datalen == 0 { return Vec::new(); }
4406 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4407 self.data = core::ptr::null_mut();
4411 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
4412 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4415 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
4416 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
4417 let datalen = v.len();
4418 let data = Box::into_raw(v.into_boxed_slice());
4419 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4423 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4424 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
4425 impl Drop for CVec_RouteHintZ {
4426 fn drop(&mut self) {
4427 if self.datalen == 0 { return; }
4428 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4431 impl Clone for CVec_RouteHintZ {
4432 fn clone(&self) -> Self {
4433 let mut res = Vec::new();
4434 if self.datalen == 0 { return Self::from(res); }
4435 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4440 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
4441 /// This corresponds to std::vector in C++
4442 pub struct CVec_RouteHintHopZ {
4443 /// The elements in the array.
4444 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4445 pub data: *mut crate::lightning::routing::router::RouteHintHop,
4446 /// The number of elements pointed to by `data`.
4449 impl CVec_RouteHintHopZ {
4450 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
4451 if self.datalen == 0 { return Vec::new(); }
4452 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4453 self.data = core::ptr::null_mut();
4457 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
4458 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4461 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
4462 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
4463 let datalen = v.len();
4464 let data = Box::into_raw(v.into_boxed_slice());
4465 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4469 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4470 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
4471 impl Drop for CVec_RouteHintHopZ {
4472 fn drop(&mut self) {
4473 if self.datalen == 0 { return; }
4474 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4477 impl Clone for CVec_RouteHintHopZ {
4478 fn clone(&self) -> Self {
4479 let mut res = Vec::new();
4480 if self.datalen == 0 { return Self::from(res); }
4481 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4486 /// The contents of CResult_RouteHintDecodeErrorZ
4487 pub union CResult_RouteHintDecodeErrorZPtr {
4488 /// A pointer to the contents in the success state.
4489 /// Reading from this pointer when `result_ok` is not set is undefined.
4490 pub result: *mut crate::lightning::routing::router::RouteHint,
4491 /// A pointer to the contents in the error state.
4492 /// Reading from this pointer when `result_ok` is set is undefined.
4493 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4496 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
4497 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4499 pub struct CResult_RouteHintDecodeErrorZ {
4500 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
4501 /// `err` or `result` depending on the state of `result_ok`.
4502 pub contents: CResult_RouteHintDecodeErrorZPtr,
4503 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
4504 pub result_ok: bool,
4507 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
4508 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
4509 CResult_RouteHintDecodeErrorZ {
4510 contents: CResult_RouteHintDecodeErrorZPtr {
4511 result: Box::into_raw(Box::new(o)),
4517 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
4518 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
4519 CResult_RouteHintDecodeErrorZ {
4520 contents: CResult_RouteHintDecodeErrorZPtr {
4521 err: Box::into_raw(Box::new(e)),
4526 /// Checks if the given object is currently in the success state
4528 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
4532 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
4533 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
4534 impl Drop for CResult_RouteHintDecodeErrorZ {
4535 fn drop(&mut self) {
4537 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4538 let _ = unsafe { Box::from_raw(self.contents.result) };
4541 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4542 let _ = unsafe { Box::from_raw(self.contents.err) };
4547 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
4548 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4549 let contents = if o.result_ok {
4550 let result = unsafe { o.contents.result };
4551 unsafe { o.contents.result = core::ptr::null_mut() };
4552 CResult_RouteHintDecodeErrorZPtr { result }
4554 let err = unsafe { o.contents.err };
4555 unsafe { o.contents.err = core::ptr::null_mut(); }
4556 CResult_RouteHintDecodeErrorZPtr { err }
4560 result_ok: o.result_ok,
4564 impl Clone for CResult_RouteHintDecodeErrorZ {
4565 fn clone(&self) -> Self {
4567 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
4568 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
4571 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
4572 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4578 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
4579 /// but with all dynamically-allocated buffers duplicated in new buffers.
4580 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
4582 /// The contents of CResult_RouteHintHopDecodeErrorZ
4583 pub union CResult_RouteHintHopDecodeErrorZPtr {
4584 /// A pointer to the contents in the success state.
4585 /// Reading from this pointer when `result_ok` is not set is undefined.
4586 pub result: *mut crate::lightning::routing::router::RouteHintHop,
4587 /// A pointer to the contents in the error state.
4588 /// Reading from this pointer when `result_ok` is set is undefined.
4589 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4592 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
4593 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4595 pub struct CResult_RouteHintHopDecodeErrorZ {
4596 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
4597 /// `err` or `result` depending on the state of `result_ok`.
4598 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
4599 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
4600 pub result_ok: bool,
4603 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
4604 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
4605 CResult_RouteHintHopDecodeErrorZ {
4606 contents: CResult_RouteHintHopDecodeErrorZPtr {
4607 result: Box::into_raw(Box::new(o)),
4613 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
4614 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
4615 CResult_RouteHintHopDecodeErrorZ {
4616 contents: CResult_RouteHintHopDecodeErrorZPtr {
4617 err: Box::into_raw(Box::new(e)),
4622 /// Checks if the given object is currently in the success state
4624 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
4628 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
4629 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
4630 impl Drop for CResult_RouteHintHopDecodeErrorZ {
4631 fn drop(&mut self) {
4633 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4634 let _ = unsafe { Box::from_raw(self.contents.result) };
4637 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4638 let _ = unsafe { Box::from_raw(self.contents.err) };
4643 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
4644 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4645 let contents = if o.result_ok {
4646 let result = unsafe { o.contents.result };
4647 unsafe { o.contents.result = core::ptr::null_mut() };
4648 CResult_RouteHintHopDecodeErrorZPtr { result }
4650 let err = unsafe { o.contents.err };
4651 unsafe { o.contents.err = core::ptr::null_mut(); }
4652 CResult_RouteHintHopDecodeErrorZPtr { err }
4656 result_ok: o.result_ok,
4660 impl Clone for CResult_RouteHintHopDecodeErrorZ {
4661 fn clone(&self) -> Self {
4663 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
4664 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
4667 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
4668 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4674 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
4675 /// but with all dynamically-allocated buffers duplicated in new buffers.
4676 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
4678 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4679 /// This corresponds to std::vector in C++
4680 pub struct CVec_PublicKeyZ {
4681 /// The elements in the array.
4682 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4683 pub data: *mut crate::c_types::PublicKey,
4684 /// The number of elements pointed to by `data`.
4687 impl CVec_PublicKeyZ {
4688 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4689 if self.datalen == 0 { return Vec::new(); }
4690 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4691 self.data = core::ptr::null_mut();
4695 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4696 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4699 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4700 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4701 let datalen = v.len();
4702 let data = Box::into_raw(v.into_boxed_slice());
4703 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4707 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4708 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4709 impl Drop for CVec_PublicKeyZ {
4710 fn drop(&mut self) {
4711 if self.datalen == 0 { return; }
4712 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4715 impl Clone for CVec_PublicKeyZ {
4716 fn clone(&self) -> Self {
4717 let mut res = Vec::new();
4718 if self.datalen == 0 { return Self::from(res); }
4719 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4724 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4725 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4726 /// A pointer to the contents in the success state.
4727 /// Reading from this pointer when `result_ok` is not set is undefined.
4728 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4729 /// A pointer to the contents in the error state.
4730 /// Reading from this pointer when `result_ok` is set is undefined.
4731 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4734 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4735 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4736 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4737 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4738 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4739 /// `err` or `result` depending on the state of `result_ok`.
4740 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4741 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4742 pub result_ok: bool,
4745 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4746 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4747 CResult_FixedPenaltyScorerDecodeErrorZ {
4748 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4749 result: Box::into_raw(Box::new(o)),
4755 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4756 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4757 CResult_FixedPenaltyScorerDecodeErrorZ {
4758 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4759 err: Box::into_raw(Box::new(e)),
4764 /// Checks if the given object is currently in the success state
4766 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4770 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4771 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4772 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4773 fn drop(&mut self) {
4775 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4776 let _ = unsafe { Box::from_raw(self.contents.result) };
4779 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4780 let _ = unsafe { Box::from_raw(self.contents.err) };
4785 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4786 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4787 let contents = if o.result_ok {
4788 let result = unsafe { o.contents.result };
4789 unsafe { o.contents.result = core::ptr::null_mut() };
4790 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4792 let err = unsafe { o.contents.err };
4793 unsafe { o.contents.err = core::ptr::null_mut(); }
4794 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4798 result_ok: o.result_ok,
4802 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4803 fn clone(&self) -> Self {
4805 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4806 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4809 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4810 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4816 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4817 /// but with all dynamically-allocated buffers duplicated in new buffers.
4818 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4820 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4821 /// This corresponds to std::vector in C++
4822 pub struct CVec_NodeIdZ {
4823 /// The elements in the array.
4824 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4825 pub data: *mut crate::lightning::routing::gossip::NodeId,
4826 /// The number of elements pointed to by `data`.
4830 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4831 if self.datalen == 0 { return Vec::new(); }
4832 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4833 self.data = core::ptr::null_mut();
4837 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4838 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4841 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4842 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4843 let datalen = v.len();
4844 let data = Box::into_raw(v.into_boxed_slice());
4845 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4849 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4850 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4851 impl Drop for CVec_NodeIdZ {
4852 fn drop(&mut self) {
4853 if self.datalen == 0 { return; }
4854 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4857 impl Clone for CVec_NodeIdZ {
4858 fn clone(&self) -> Self {
4859 let mut res = Vec::new();
4860 if self.datalen == 0 { return Self::from(res); }
4861 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4866 /// A tuple of 2 elements. See the individual fields for the types contained.
4867 pub struct C2Tuple_u64u64Z {
4868 /// The element at position 0
4870 /// The element at position 1
4873 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4874 fn from (tup: (u64, u64)) -> Self {
4881 impl C2Tuple_u64u64Z {
4882 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4886 impl Clone for C2Tuple_u64u64Z {
4887 fn clone(&self) -> Self {
4889 a: Clone::clone(&self.a),
4890 b: Clone::clone(&self.b),
4895 /// Creates a new tuple which has the same data as `orig`
4896 /// but with all dynamically-allocated buffers duplicated in new buffers.
4897 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4898 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4900 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4901 C2Tuple_u64u64Z { a, b, }
4905 /// Frees any resources used by the C2Tuple_u64u64Z.
4906 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4909 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4910 pub enum COption_C2Tuple_u64u64ZZ {
4911 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4912 Some(crate::c_types::derived::C2Tuple_u64u64Z),
4913 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4916 impl COption_C2Tuple_u64u64ZZ {
4917 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4918 if let Self::None = self { false } else { true }
4920 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4923 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4924 if let Self::Some(v) = self { v } else { unreachable!() }
4928 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4929 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4930 COption_C2Tuple_u64u64ZZ::Some(o)
4933 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4934 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4935 COption_C2Tuple_u64u64ZZ::None
4938 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4939 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4941 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4942 /// but with all dynamically-allocated buffers duplicated in new buffers.
4943 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4945 /// A tuple of 2 elements. See the individual fields for the types contained.
4946 pub struct C2Tuple_Z {
4947 /// The element at position 0
4948 pub a: crate::c_types::ThirtyTwoU16s,
4949 /// The element at position 1
4950 pub b: crate::c_types::ThirtyTwoU16s,
4952 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z {
4953 fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
4961 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
4965 /// Creates a new C2Tuple_Z from the contained elements.
4967 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z {
4972 /// Frees any resources used by the C2Tuple_Z.
4973 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
4975 /// A tuple of 2 elements. See the individual fields for the types contained.
4976 pub struct C2Tuple__u1632_u1632Z {
4977 /// The element at position 0
4978 pub a: crate::c_types::ThirtyTwoU16s,
4979 /// The element at position 1
4980 pub b: crate::c_types::ThirtyTwoU16s,
4982 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z {
4983 fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
4990 impl C2Tuple__u1632_u1632Z {
4991 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
4995 /// Creates a new C2Tuple__u1632_u1632Z from the contained elements.
4997 pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z {
4998 C2Tuple__u1632_u1632Z { a, b, }
5002 /// Frees any resources used by the C2Tuple__u1632_u1632Z.
5003 pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { }
5005 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not
5006 pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5007 /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z
5008 Some(crate::c_types::derived::C2Tuple__u1632_u1632Z),
5009 /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing
5012 impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5013 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5014 if let Self::None = self { false } else { true }
5016 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5019 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z {
5020 if let Self::Some(v) = self { v } else { unreachable!() }
5024 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z
5025 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5026 COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o)
5029 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing
5030 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5031 COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None
5034 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state
5035 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { }
5038 /// An enum which can either contain a f64 or not
5039 pub enum COption_f64Z {
5040 /// When we're in this state, this COption_f64Z contains a f64
5042 /// When we're in this state, this COption_f64Z contains nothing
5046 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5047 if let Self::None = self { false } else { true }
5049 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5052 #[allow(unused)] pub(crate) fn take(mut self) -> f64 {
5053 if let Self::Some(v) = self { v } else { unreachable!() }
5057 /// Constructs a new COption_f64Z containing a f64
5058 pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z {
5059 COption_f64Z::Some(o)
5062 /// Constructs a new COption_f64Z containing nothing
5063 pub extern "C" fn COption_f64Z_none() -> COption_f64Z {
5067 /// Frees any resources associated with the f64, if we are in the Some state
5068 pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { }
5070 /// Creates a new COption_f64Z which has the same data as `orig`
5071 /// but with all dynamically-allocated buffers duplicated in new buffers.
5072 pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) }
5074 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
5075 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
5076 /// A pointer to the contents in the success state.
5077 /// Reading from this pointer when `result_ok` is not set is undefined.
5078 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
5079 /// A pointer to the contents in the error state.
5080 /// Reading from this pointer when `result_ok` is set is undefined.
5081 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5084 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5085 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5087 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
5088 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5089 /// `err` or `result` depending on the state of `result_ok`.
5090 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
5091 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5092 pub result_ok: bool,
5095 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
5096 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
5097 CResult_ProbabilisticScorerDecodeErrorZ {
5098 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5099 result: Box::into_raw(Box::new(o)),
5105 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
5106 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
5107 CResult_ProbabilisticScorerDecodeErrorZ {
5108 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5109 err: Box::into_raw(Box::new(e)),
5114 /// Checks if the given object is currently in the success state
5116 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
5120 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
5121 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
5122 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
5123 fn drop(&mut self) {
5125 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5126 let _ = unsafe { Box::from_raw(self.contents.result) };
5129 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5130 let _ = unsafe { Box::from_raw(self.contents.err) };
5135 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
5136 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5137 let contents = if o.result_ok {
5138 let result = unsafe { o.contents.result };
5139 unsafe { o.contents.result = core::ptr::null_mut() };
5140 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
5142 let err = unsafe { o.contents.err };
5143 unsafe { o.contents.err = core::ptr::null_mut(); }
5144 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
5148 result_ok: o.result_ok,
5153 /// A tuple of 2 elements. See the individual fields for the types contained.
5154 pub struct C2Tuple_usizeTransactionZ {
5155 /// The element at position 0
5157 /// The element at position 1
5158 pub b: crate::c_types::Transaction,
5160 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
5161 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
5168 impl C2Tuple_usizeTransactionZ {
5169 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
5173 impl Clone for C2Tuple_usizeTransactionZ {
5174 fn clone(&self) -> Self {
5176 a: Clone::clone(&self.a),
5177 b: Clone::clone(&self.b),
5182 /// Creates a new tuple which has the same data as `orig`
5183 /// but with all dynamically-allocated buffers duplicated in new buffers.
5184 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
5185 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
5187 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
5188 C2Tuple_usizeTransactionZ { a, b, }
5192 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
5193 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
5195 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5196 /// This corresponds to std::vector in C++
5197 pub struct CVec_C2Tuple_usizeTransactionZZ {
5198 /// The elements in the array.
5199 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5200 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
5201 /// The number of elements pointed to by `data`.
5204 impl CVec_C2Tuple_usizeTransactionZZ {
5205 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
5206 if self.datalen == 0 { return Vec::new(); }
5207 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5208 self.data = core::ptr::null_mut();
5212 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
5213 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5216 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
5217 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
5218 let datalen = v.len();
5219 let data = Box::into_raw(v.into_boxed_slice());
5220 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5224 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5225 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
5226 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
5227 fn drop(&mut self) {
5228 if self.datalen == 0 { return; }
5229 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5232 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
5233 fn clone(&self) -> Self {
5234 let mut res = Vec::new();
5235 if self.datalen == 0 { return Self::from(res); }
5236 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5241 /// A tuple of 2 elements. See the individual fields for the types contained.
5242 pub struct C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5243 /// The element at position 0
5244 pub a: crate::c_types::ThirtyTwoBytes,
5245 /// The element at position 1
5246 pub b: crate::c_types::derived::COption_ThirtyTwoBytesZ,
5248 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5249 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self {
5256 impl C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5257 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ) {
5261 impl Clone for C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5262 fn clone(&self) -> Self {
5264 a: Clone::clone(&self.a),
5265 b: Clone::clone(&self.b),
5270 /// Creates a new tuple which has the same data as `orig`
5271 /// but with all dynamically-allocated buffers duplicated in new buffers.
5272 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) -> C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { Clone::clone(&orig) }
5273 /// Creates a new C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ from the contained elements.
5275 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ {
5276 C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { a, b, }
5280 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ.
5281 pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res: C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) { }
5283 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZs of arbitrary size.
5284 /// This corresponds to std::vector in C++
5285 pub struct CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5286 /// The elements in the array.
5287 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5288 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ,
5289 /// The number of elements pointed to by `data`.
5292 impl CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5293 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ> {
5294 if self.datalen == 0 { return Vec::new(); }
5295 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5296 self.data = core::ptr::null_mut();
5300 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ] {
5301 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5304 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ>> for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5305 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ>) -> Self {
5306 let datalen = v.len();
5307 let data = Box::into_raw(v.into_boxed_slice());
5308 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5312 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5313 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ) { }
5314 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5315 fn drop(&mut self) {
5316 if self.datalen == 0 { return; }
5317 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5320 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ {
5321 fn clone(&self) -> Self {
5322 let mut res = Vec::new();
5323 if self.datalen == 0 { return Self::from(res); }
5324 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5329 /// The contents of CResult_ChannelMonitorUpdateStatusNoneZ
5330 pub union CResult_ChannelMonitorUpdateStatusNoneZPtr {
5331 /// A pointer to the contents in the success state.
5332 /// Reading from this pointer when `result_ok` is not set is undefined.
5333 pub result: *mut crate::lightning::chain::ChannelMonitorUpdateStatus,
5334 /// Note that this value is always NULL, as there are no contents in the Err variant
5335 pub err: *mut core::ffi::c_void,
5338 /// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation,
5339 /// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure.
5340 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5341 pub struct CResult_ChannelMonitorUpdateStatusNoneZ {
5342 /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either
5343 /// `err` or `result` depending on the state of `result_ok`.
5344 pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr,
5345 /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state.
5346 pub result_ok: bool,
5349 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state.
5350 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ {
5351 CResult_ChannelMonitorUpdateStatusNoneZ {
5352 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5353 result: Box::into_raw(Box::new(o)),
5359 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state.
5360 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ {
5361 CResult_ChannelMonitorUpdateStatusNoneZ {
5362 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5363 err: core::ptr::null_mut(),
5368 /// Checks if the given object is currently in the success state
5370 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool {
5374 /// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ.
5375 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { }
5376 impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ {
5377 fn drop(&mut self) {
5379 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5380 let _ = unsafe { Box::from_raw(self.contents.result) };
5386 impl From<crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>> for CResult_ChannelMonitorUpdateStatusNoneZ {
5387 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>) -> Self {
5388 let contents = if o.result_ok {
5389 let result = unsafe { o.contents.result };
5390 unsafe { o.contents.result = core::ptr::null_mut() };
5391 CResult_ChannelMonitorUpdateStatusNoneZPtr { result }
5393 let _ = unsafe { Box::from_raw(o.contents.err) };
5394 o.contents.err = core::ptr::null_mut();
5395 CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() }
5399 result_ok: o.result_ok,
5403 impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ {
5404 fn clone(&self) -> Self {
5406 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5407 result: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateStatus>::clone(unsafe { &*self.contents.result })))
5410 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
5411 err: core::ptr::null_mut()
5417 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig`
5418 /// but with all dynamically-allocated buffers duplicated in new buffers.
5419 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) }
5421 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
5422 /// This corresponds to std::vector in C++
5423 pub struct CVec_MonitorEventZ {
5424 /// The elements in the array.
5425 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5426 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
5427 /// The number of elements pointed to by `data`.
5430 impl CVec_MonitorEventZ {
5431 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
5432 if self.datalen == 0 { return Vec::new(); }
5433 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5434 self.data = core::ptr::null_mut();
5438 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
5439 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5442 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
5443 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
5444 let datalen = v.len();
5445 let data = Box::into_raw(v.into_boxed_slice());
5446 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5450 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5451 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
5452 impl Drop for CVec_MonitorEventZ {
5453 fn drop(&mut self) {
5454 if self.datalen == 0 { return; }
5455 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5458 impl Clone for CVec_MonitorEventZ {
5459 fn clone(&self) -> Self {
5460 let mut res = Vec::new();
5461 if self.datalen == 0 { return Self::from(res); }
5462 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5467 /// A tuple of 3 elements. See the individual fields for the types contained.
5468 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5469 /// The element at position 0
5470 pub a: crate::lightning::chain::transaction::OutPoint,
5471 /// The element at position 1
5472 pub b: crate::c_types::derived::CVec_MonitorEventZ,
5473 /// The element at position 2
5474 pub c: crate::c_types::PublicKey,
5476 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5477 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
5485 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5486 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
5487 (self.a, self.b, self.c)
5490 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5491 fn clone(&self) -> Self {
5493 a: Clone::clone(&self.a),
5494 b: Clone::clone(&self.b),
5495 c: Clone::clone(&self.c),
5500 /// Creates a new tuple which has the same data as `orig`
5501 /// but with all dynamically-allocated buffers duplicated in new buffers.
5502 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
5503 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
5505 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 {
5506 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
5510 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
5511 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
5513 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
5514 /// This corresponds to std::vector in C++
5515 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5516 /// The elements in the array.
5517 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5518 pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
5519 /// The number of elements pointed to by `data`.
5522 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5523 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
5524 if self.datalen == 0 { return Vec::new(); }
5525 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5526 self.data = core::ptr::null_mut();
5530 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
5531 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5534 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5535 fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
5536 let datalen = v.len();
5537 let data = Box::into_raw(v.into_boxed_slice());
5538 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5542 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5543 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
5544 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5545 fn drop(&mut self) {
5546 if self.datalen == 0 { return; }
5547 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5550 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5551 fn clone(&self) -> Self {
5552 let mut res = Vec::new();
5553 if self.datalen == 0 { return Self::from(res); }
5554 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5559 /// The contents of CResult_InitFeaturesDecodeErrorZ
5560 pub union CResult_InitFeaturesDecodeErrorZPtr {
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::InitFeatures,
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_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5570 /// containing a crate::lightning::ln::features::InitFeatures 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_InitFeaturesDecodeErrorZ {
5573 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5574 /// `err` or `result` depending on the state of `result_ok`.
5575 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
5576 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5577 pub result_ok: bool,
5580 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
5581 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
5582 CResult_InitFeaturesDecodeErrorZ {
5583 contents: CResult_InitFeaturesDecodeErrorZPtr {
5584 result: Box::into_raw(Box::new(o)),
5590 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5591 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5592 CResult_InitFeaturesDecodeErrorZ {
5593 contents: CResult_InitFeaturesDecodeErrorZPtr {
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_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
5605 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5606 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5607 impl Drop for CResult_InitFeaturesDecodeErrorZ {
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::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5621 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, 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_InitFeaturesDecodeErrorZPtr { result }
5627 let err = unsafe { o.contents.err };
5628 unsafe { o.contents.err = core::ptr::null_mut(); }
5629 CResult_InitFeaturesDecodeErrorZPtr { err }
5633 result_ok: o.result_ok,
5637 impl Clone for CResult_InitFeaturesDecodeErrorZ {
5638 fn clone(&self) -> Self {
5640 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
5641 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
5644 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
5645 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5651 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
5652 /// but with all dynamically-allocated buffers duplicated in new buffers.
5653 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
5655 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5656 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
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::ChannelFeatures,
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_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5666 /// containing a crate::lightning::ln::features::ChannelFeatures 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_ChannelFeaturesDecodeErrorZ {
5669 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5670 /// `err` or `result` depending on the state of `result_ok`.
5671 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5672 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5673 pub result_ok: bool,
5676 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5677 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5678 CResult_ChannelFeaturesDecodeErrorZ {
5679 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5680 result: Box::into_raw(Box::new(o)),
5686 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5687 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5688 CResult_ChannelFeaturesDecodeErrorZ {
5689 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
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_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
5701 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5702 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5703 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
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::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5717 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, 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_ChannelFeaturesDecodeErrorZPtr { result }
5723 let err = unsafe { o.contents.err };
5724 unsafe { o.contents.err = core::ptr::null_mut(); }
5725 CResult_ChannelFeaturesDecodeErrorZPtr { err }
5729 result_ok: o.result_ok,
5733 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
5734 fn clone(&self) -> Self {
5736 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5737 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
5740 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5741 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5747 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
5748 /// but with all dynamically-allocated buffers duplicated in new buffers.
5749 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
5751 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5752 pub union CResult_NodeFeaturesDecodeErrorZPtr {
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::NodeFeatures,
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_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5762 /// containing a crate::lightning::ln::features::NodeFeatures 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_NodeFeaturesDecodeErrorZ {
5765 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5766 /// `err` or `result` depending on the state of `result_ok`.
5767 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
5768 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5769 pub result_ok: bool,
5772 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5773 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5774 CResult_NodeFeaturesDecodeErrorZ {
5775 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5776 result: Box::into_raw(Box::new(o)),
5782 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5783 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5784 CResult_NodeFeaturesDecodeErrorZ {
5785 contents: CResult_NodeFeaturesDecodeErrorZPtr {
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_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
5797 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5798 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5799 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
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::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5813 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, 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_NodeFeaturesDecodeErrorZPtr { result }
5819 let err = unsafe { o.contents.err };
5820 unsafe { o.contents.err = core::ptr::null_mut(); }
5821 CResult_NodeFeaturesDecodeErrorZPtr { err }
5825 result_ok: o.result_ok,
5829 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
5830 fn clone(&self) -> Self {
5832 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5833 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
5836 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5837 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5843 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
5844 /// but with all dynamically-allocated buffers duplicated in new buffers.
5845 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5847 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
5848 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
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::Bolt11InvoiceFeatures,
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_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5858 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures 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_Bolt11InvoiceFeaturesDecodeErrorZ {
5861 /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
5862 /// `err` or `result` depending on the state of `result_ok`.
5863 pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
5864 /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
5865 pub result_ok: bool,
5868 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
5869 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5870 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5871 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5872 result: Box::into_raw(Box::new(o)),
5878 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
5879 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5880 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5881 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
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_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
5893 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
5894 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
5895 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
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::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5909 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, 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_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
5915 let err = unsafe { o.contents.err };
5916 unsafe { o.contents.err = core::ptr::null_mut(); }
5917 CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
5921 result_ok: o.result_ok,
5925 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5926 fn clone(&self) -> Self {
5928 Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5929 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5932 Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5933 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5939 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5940 /// but with all dynamically-allocated buffers duplicated in new buffers.
5941 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5943 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
5944 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
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::Bolt12InvoiceFeatures,
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_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5954 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures 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_Bolt12InvoiceFeaturesDecodeErrorZ {
5957 /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
5958 /// `err` or `result` depending on the state of `result_ok`.
5959 pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
5960 /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
5961 pub result_ok: bool,
5964 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
5965 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5966 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5967 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5968 result: Box::into_raw(Box::new(o)),
5974 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
5975 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5976 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5977 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
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_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
5989 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
5990 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
5991 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
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::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6005 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, 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_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
6011 let err = unsafe { o.contents.err };
6012 unsafe { o.contents.err = core::ptr::null_mut(); }
6013 CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
6017 result_ok: o.result_ok,
6021 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6022 fn clone(&self) -> Self {
6024 Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6025 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6028 Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6029 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6035 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6036 /// but with all dynamically-allocated buffers duplicated in new buffers.
6037 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6039 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
6040 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
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::ln::features::BlindedHopFeatures,
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::ln::msgs::DecodeError,
6049 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
6050 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6052 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
6053 /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
6054 /// `err` or `result` depending on the state of `result_ok`.
6055 pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
6056 /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
6057 pub result_ok: bool,
6060 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
6061 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6062 CResult_BlindedHopFeaturesDecodeErrorZ {
6063 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6064 result: Box::into_raw(Box::new(o)),
6070 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
6071 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6072 CResult_BlindedHopFeaturesDecodeErrorZ {
6073 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
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_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
6085 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
6086 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
6087 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
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::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
6101 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> 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_BlindedHopFeaturesDecodeErrorZPtr { result }
6107 let err = unsafe { o.contents.err };
6108 unsafe { o.contents.err = core::ptr::null_mut(); }
6109 CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
6113 result_ok: o.result_ok,
6117 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
6118 fn clone(&self) -> Self {
6120 Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6121 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
6124 Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6125 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6131 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
6132 /// but with all dynamically-allocated buffers duplicated in new buffers.
6133 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
6135 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
6136 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
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::lightning::ln::features::ChannelTypeFeatures,
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::lightning::ln::msgs::DecodeError,
6145 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
6146 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6148 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
6149 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
6150 /// `err` or `result` depending on the state of `result_ok`.
6151 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
6152 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
6153 pub result_ok: bool,
6156 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
6157 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6158 CResult_ChannelTypeFeaturesDecodeErrorZ {
6159 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6160 result: Box::into_raw(Box::new(o)),
6166 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
6167 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6168 CResult_ChannelTypeFeaturesDecodeErrorZ {
6169 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
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_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
6181 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
6182 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
6183 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
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::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
6197 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> 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_ChannelTypeFeaturesDecodeErrorZPtr { result }
6203 let err = unsafe { o.contents.err };
6204 unsafe { o.contents.err = core::ptr::null_mut(); }
6205 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
6209 result_ok: o.result_ok,
6213 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
6214 fn clone(&self) -> Self {
6216 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6217 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
6220 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6221 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6227 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
6228 /// but with all dynamically-allocated buffers duplicated in new buffers.
6229 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6231 /// The contents of CResult_OfferBolt12ParseErrorZ
6232 pub union CResult_OfferBolt12ParseErrorZPtr {
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::offers::offer::Offer,
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::offers::parse::Bolt12ParseError,
6241 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
6242 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
6243 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6244 pub struct CResult_OfferBolt12ParseErrorZ {
6245 /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
6246 /// `err` or `result` depending on the state of `result_ok`.
6247 pub contents: CResult_OfferBolt12ParseErrorZPtr,
6248 /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
6249 pub result_ok: bool,
6252 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
6253 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
6254 CResult_OfferBolt12ParseErrorZ {
6255 contents: CResult_OfferBolt12ParseErrorZPtr {
6256 result: Box::into_raw(Box::new(o)),
6262 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
6263 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
6264 CResult_OfferBolt12ParseErrorZ {
6265 contents: CResult_OfferBolt12ParseErrorZPtr {
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_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
6277 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
6278 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
6279 impl Drop for CResult_OfferBolt12ParseErrorZ {
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::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
6293 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> 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_OfferBolt12ParseErrorZPtr { result }
6299 let err = unsafe { o.contents.err };
6300 unsafe { o.contents.err = core::ptr::null_mut(); }
6301 CResult_OfferBolt12ParseErrorZPtr { err }
6305 result_ok: o.result_ok,
6309 impl Clone for CResult_OfferBolt12ParseErrorZ {
6310 fn clone(&self) -> Self {
6312 Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
6313 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
6316 Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
6317 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
6323 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
6324 /// but with all dynamically-allocated buffers duplicated in new buffers.
6325 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
6327 /// The contents of CResult_PublicKeySecp256k1ErrorZ
6328 pub union CResult_PublicKeySecp256k1ErrorZPtr {
6329 /// A pointer to the contents in the success state.
6330 /// Reading from this pointer when `result_ok` is not set is undefined.
6331 pub result: *mut crate::c_types::PublicKey,
6332 /// A pointer to the contents in the error state.
6333 /// Reading from this pointer when `result_ok` is set is undefined.
6334 pub err: *mut crate::c_types::Secp256k1Error,
6337 /// A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation,
6338 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
6339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6340 pub struct CResult_PublicKeySecp256k1ErrorZ {
6341 /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either
6342 /// `err` or `result` depending on the state of `result_ok`.
6343 pub contents: CResult_PublicKeySecp256k1ErrorZPtr,
6344 /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state.
6345 pub result_ok: bool,
6348 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state.
6349 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ {
6350 CResult_PublicKeySecp256k1ErrorZ {
6351 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6352 result: Box::into_raw(Box::new(o)),
6358 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state.
6359 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ {
6360 CResult_PublicKeySecp256k1ErrorZ {
6361 contents: CResult_PublicKeySecp256k1ErrorZPtr {
6362 err: Box::into_raw(Box::new(e)),
6367 /// Checks if the given object is currently in the success state
6369 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool {
6373 /// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ.
6374 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { }
6375 impl Drop for CResult_PublicKeySecp256k1ErrorZ {
6376 fn drop(&mut self) {
6378 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6379 let _ = unsafe { Box::from_raw(self.contents.result) };
6382 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6383 let _ = unsafe { Box::from_raw(self.contents.err) };
6388 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecp256k1ErrorZ {
6389 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
6390 let contents = if o.result_ok {
6391 let result = unsafe { o.contents.result };
6392 unsafe { o.contents.result = core::ptr::null_mut() };
6393 CResult_PublicKeySecp256k1ErrorZPtr { result }
6395 let err = unsafe { o.contents.err };
6396 unsafe { o.contents.err = core::ptr::null_mut(); }
6397 CResult_PublicKeySecp256k1ErrorZPtr { err }
6401 result_ok: o.result_ok,
6405 impl Clone for CResult_PublicKeySecp256k1ErrorZ {
6406 fn clone(&self) -> Self {
6408 Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6409 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
6412 Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr {
6413 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
6419 /// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig`
6420 /// but with all dynamically-allocated buffers duplicated in new buffers.
6421 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) }
6423 /// The contents of CResult_NodeIdDecodeErrorZ
6424 pub union CResult_NodeIdDecodeErrorZPtr {
6425 /// A pointer to the contents in the success state.
6426 /// Reading from this pointer when `result_ok` is not set is undefined.
6427 pub result: *mut crate::lightning::routing::gossip::NodeId,
6428 /// A pointer to the contents in the error state.
6429 /// Reading from this pointer when `result_ok` is set is undefined.
6430 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6433 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
6434 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
6435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6436 pub struct CResult_NodeIdDecodeErrorZ {
6437 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
6438 /// `err` or `result` depending on the state of `result_ok`.
6439 pub contents: CResult_NodeIdDecodeErrorZPtr,
6440 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
6441 pub result_ok: bool,
6444 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
6445 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
6446 CResult_NodeIdDecodeErrorZ {
6447 contents: CResult_NodeIdDecodeErrorZPtr {
6448 result: Box::into_raw(Box::new(o)),
6454 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
6455 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
6456 CResult_NodeIdDecodeErrorZ {
6457 contents: CResult_NodeIdDecodeErrorZPtr {
6458 err: Box::into_raw(Box::new(e)),
6463 /// Checks if the given object is currently in the success state
6465 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
6469 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
6470 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
6471 impl Drop for CResult_NodeIdDecodeErrorZ {
6472 fn drop(&mut self) {
6474 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6475 let _ = unsafe { Box::from_raw(self.contents.result) };
6478 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6479 let _ = unsafe { Box::from_raw(self.contents.err) };
6484 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
6485 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
6486 let contents = if o.result_ok {
6487 let result = unsafe { o.contents.result };
6488 unsafe { o.contents.result = core::ptr::null_mut() };
6489 CResult_NodeIdDecodeErrorZPtr { result }
6491 let err = unsafe { o.contents.err };
6492 unsafe { o.contents.err = core::ptr::null_mut(); }
6493 CResult_NodeIdDecodeErrorZPtr { err }
6497 result_ok: o.result_ok,
6501 impl Clone for CResult_NodeIdDecodeErrorZ {
6502 fn clone(&self) -> Self {
6504 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
6505 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
6508 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
6509 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6515 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
6516 /// but with all dynamically-allocated buffers duplicated in new buffers.
6517 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
6520 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
6521 pub enum COption_NetworkUpdateZ {
6522 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
6523 Some(crate::lightning::routing::gossip::NetworkUpdate),
6524 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
6527 impl COption_NetworkUpdateZ {
6528 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6529 if let Self::None = self { false } else { true }
6531 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6534 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
6535 if let Self::Some(v) = self { v } else { unreachable!() }
6539 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
6540 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
6541 COption_NetworkUpdateZ::Some(o)
6544 /// Constructs a new COption_NetworkUpdateZ containing nothing
6545 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
6546 COption_NetworkUpdateZ::None
6549 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
6550 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
6552 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
6553 /// but with all dynamically-allocated buffers duplicated in new buffers.
6554 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
6556 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6557 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6558 /// A pointer to the contents in the success state.
6559 /// Reading from this pointer when `result_ok` is not set is undefined.
6560 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
6561 /// A pointer to the contents in the error state.
6562 /// Reading from this pointer when `result_ok` is set is undefined.
6563 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6566 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6567 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6568 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6569 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
6570 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6571 /// `err` or `result` depending on the state of `result_ok`.
6572 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
6573 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6574 pub result_ok: bool,
6577 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
6578 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6579 CResult_COption_NetworkUpdateZDecodeErrorZ {
6580 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6581 result: Box::into_raw(Box::new(o)),
6587 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
6588 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6589 CResult_COption_NetworkUpdateZDecodeErrorZ {
6590 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6591 err: Box::into_raw(Box::new(e)),
6596 /// Checks if the given object is currently in the success state
6598 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
6602 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
6603 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
6604 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
6605 fn drop(&mut self) {
6607 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6608 let _ = unsafe { Box::from_raw(self.contents.result) };
6611 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6612 let _ = unsafe { Box::from_raw(self.contents.err) };
6617 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
6618 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6619 let contents = if o.result_ok {
6620 let result = unsafe { o.contents.result };
6621 unsafe { o.contents.result = core::ptr::null_mut() };
6622 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
6624 let err = unsafe { o.contents.err };
6625 unsafe { o.contents.err = core::ptr::null_mut(); }
6626 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
6630 result_ok: o.result_ok,
6634 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
6635 fn clone(&self) -> Self {
6637 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6638 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
6641 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6642 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6648 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
6649 /// but with all dynamically-allocated buffers duplicated in new buffers.
6650 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
6652 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6653 pub enum COption_UtxoLookupZ {
6654 /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6655 Some(crate::lightning::routing::utxo::UtxoLookup),
6656 /// When we're in this state, this COption_UtxoLookupZ contains nothing
6659 impl COption_UtxoLookupZ {
6660 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6661 if let Self::None = self { false } else { true }
6663 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6666 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
6667 if let Self::Some(v) = self { v } else { unreachable!() }
6671 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
6672 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
6673 COption_UtxoLookupZ::Some(o)
6676 /// Constructs a new COption_UtxoLookupZ containing nothing
6677 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
6678 COption_UtxoLookupZ::None
6681 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
6682 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
6684 /// The contents of CResult_NoneLightningErrorZ
6685 pub union CResult_NoneLightningErrorZPtr {
6686 /// Note that this value is always NULL, as there are no contents in the OK variant
6687 pub result: *mut core::ffi::c_void,
6688 /// A pointer to the contents in the error state.
6689 /// Reading from this pointer when `result_ok` is set is undefined.
6690 pub err: *mut crate::lightning::ln::msgs::LightningError,
6693 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6694 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6696 pub struct CResult_NoneLightningErrorZ {
6697 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6698 /// `err` or `result` depending on the state of `result_ok`.
6699 pub contents: CResult_NoneLightningErrorZPtr,
6700 /// Whether this CResult_NoneLightningErrorZ represents a success state.
6701 pub result_ok: bool,
6704 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6705 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6706 CResult_NoneLightningErrorZ {
6707 contents: CResult_NoneLightningErrorZPtr {
6708 result: core::ptr::null_mut(),
6714 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6715 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6716 CResult_NoneLightningErrorZ {
6717 contents: CResult_NoneLightningErrorZPtr {
6718 err: Box::into_raw(Box::new(e)),
6723 /// Checks if the given object is currently in the success state
6725 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
6729 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6730 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6731 impl Drop for CResult_NoneLightningErrorZ {
6732 fn drop(&mut self) {
6735 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6736 let _ = unsafe { Box::from_raw(self.contents.err) };
6741 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6742 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6743 let contents = if o.result_ok {
6744 let _ = unsafe { Box::from_raw(o.contents.result) };
6745 o.contents.result = core::ptr::null_mut();
6746 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
6748 let err = unsafe { o.contents.err };
6749 unsafe { o.contents.err = core::ptr::null_mut(); }
6750 CResult_NoneLightningErrorZPtr { err }
6754 result_ok: o.result_ok,
6758 impl Clone for CResult_NoneLightningErrorZ {
6759 fn clone(&self) -> Self {
6761 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6762 result: core::ptr::null_mut()
6765 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6766 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6772 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6773 /// but with all dynamically-allocated buffers duplicated in new buffers.
6774 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
6776 /// The contents of CResult_boolLightningErrorZ
6777 pub union CResult_boolLightningErrorZPtr {
6778 /// A pointer to the contents in the success state.
6779 /// Reading from this pointer when `result_ok` is not set is undefined.
6780 pub result: *mut bool,
6781 /// A pointer to the contents in the error state.
6782 /// Reading from this pointer when `result_ok` is set is undefined.
6783 pub err: *mut crate::lightning::ln::msgs::LightningError,
6786 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6787 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6788 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6789 pub struct CResult_boolLightningErrorZ {
6790 /// The contents of this CResult_boolLightningErrorZ, accessible via either
6791 /// `err` or `result` depending on the state of `result_ok`.
6792 pub contents: CResult_boolLightningErrorZPtr,
6793 /// Whether this CResult_boolLightningErrorZ represents a success state.
6794 pub result_ok: bool,
6797 /// Creates a new CResult_boolLightningErrorZ in the success state.
6798 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6799 CResult_boolLightningErrorZ {
6800 contents: CResult_boolLightningErrorZPtr {
6801 result: Box::into_raw(Box::new(o)),
6807 /// Creates a new CResult_boolLightningErrorZ in the error state.
6808 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6809 CResult_boolLightningErrorZ {
6810 contents: CResult_boolLightningErrorZPtr {
6811 err: Box::into_raw(Box::new(e)),
6816 /// Checks if the given object is currently in the success state
6818 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
6822 /// Frees any resources used by the CResult_boolLightningErrorZ.
6823 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6824 impl Drop for CResult_boolLightningErrorZ {
6825 fn drop(&mut self) {
6827 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6828 let _ = unsafe { Box::from_raw(self.contents.result) };
6831 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6832 let _ = unsafe { Box::from_raw(self.contents.err) };
6837 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6838 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6839 let contents = if o.result_ok {
6840 let result = unsafe { o.contents.result };
6841 unsafe { o.contents.result = core::ptr::null_mut() };
6842 CResult_boolLightningErrorZPtr { result }
6844 let err = unsafe { o.contents.err };
6845 unsafe { o.contents.err = core::ptr::null_mut(); }
6846 CResult_boolLightningErrorZPtr { err }
6850 result_ok: o.result_ok,
6854 impl Clone for CResult_boolLightningErrorZ {
6855 fn clone(&self) -> Self {
6857 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6858 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6861 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6862 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6868 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6869 /// but with all dynamically-allocated buffers duplicated in new buffers.
6870 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
6872 /// A tuple of 3 elements. See the individual fields for the types contained.
6873 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6874 /// The element at position 0
6875 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6876 /// The element at position 1
6877 pub b: crate::lightning::ln::msgs::ChannelUpdate,
6878 /// The element at position 2
6879 pub c: crate::lightning::ln::msgs::ChannelUpdate,
6881 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6882 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6890 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6891 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6892 (self.a, self.b, self.c)
6895 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6896 fn clone(&self) -> Self {
6898 a: Clone::clone(&self.a),
6899 b: Clone::clone(&self.b),
6900 c: Clone::clone(&self.c),
6905 /// Creates a new tuple which has the same data as `orig`
6906 /// but with all dynamically-allocated buffers duplicated in new buffers.
6907 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
6908 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6910 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 {
6911 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6915 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6916 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6919 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
6920 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6921 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6922 Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
6923 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
6926 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6927 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6928 if let Self::None = self { false } else { true }
6930 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6933 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6934 if let Self::Some(v) = self { v } else { unreachable!() }
6938 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6939 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6940 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
6943 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
6944 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6945 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
6948 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
6949 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6951 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
6952 /// but with all dynamically-allocated buffers duplicated in new buffers.
6953 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
6955 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
6956 /// This corresponds to std::vector in C++
6957 pub struct CVec_MessageSendEventZ {
6958 /// The elements in the array.
6959 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6960 pub data: *mut crate::lightning::events::MessageSendEvent,
6961 /// The number of elements pointed to by `data`.
6964 impl CVec_MessageSendEventZ {
6965 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
6966 if self.datalen == 0 { return Vec::new(); }
6967 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6968 self.data = core::ptr::null_mut();
6972 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
6973 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6976 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
6977 fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
6978 let datalen = v.len();
6979 let data = Box::into_raw(v.into_boxed_slice());
6980 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6984 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6985 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
6986 impl Drop for CVec_MessageSendEventZ {
6987 fn drop(&mut self) {
6988 if self.datalen == 0 { return; }
6989 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6992 impl Clone for CVec_MessageSendEventZ {
6993 fn clone(&self) -> Self {
6994 let mut res = Vec::new();
6995 if self.datalen == 0 { return Self::from(res); }
6996 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7001 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
7002 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
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::ChannelUpdateInfo,
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_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
7012 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo 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_ChannelUpdateInfoDecodeErrorZ {
7015 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
7016 /// `err` or `result` depending on the state of `result_ok`.
7017 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
7018 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
7019 pub result_ok: bool,
7022 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
7023 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
7024 CResult_ChannelUpdateInfoDecodeErrorZ {
7025 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7026 result: Box::into_raw(Box::new(o)),
7032 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
7033 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
7034 CResult_ChannelUpdateInfoDecodeErrorZ {
7035 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
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_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
7047 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
7048 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
7049 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
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::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
7063 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, 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_ChannelUpdateInfoDecodeErrorZPtr { result }
7069 let err = unsafe { o.contents.err };
7070 unsafe { o.contents.err = core::ptr::null_mut(); }
7071 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
7075 result_ok: o.result_ok,
7079 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
7080 fn clone(&self) -> Self {
7082 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7083 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
7086 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
7087 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7093 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
7094 /// but with all dynamically-allocated buffers duplicated in new buffers.
7095 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
7097 /// The contents of CResult_ChannelInfoDecodeErrorZ
7098 pub union CResult_ChannelInfoDecodeErrorZPtr {
7099 /// A pointer to the contents in the success state.
7100 /// Reading from this pointer when `result_ok` is not set is undefined.
7101 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
7102 /// A pointer to the contents in the error state.
7103 /// Reading from this pointer when `result_ok` is set is undefined.
7104 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7107 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7108 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7110 pub struct CResult_ChannelInfoDecodeErrorZ {
7111 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7112 /// `err` or `result` depending on the state of `result_ok`.
7113 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
7114 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7115 pub result_ok: bool,
7118 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
7119 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
7120 CResult_ChannelInfoDecodeErrorZ {
7121 contents: CResult_ChannelInfoDecodeErrorZPtr {
7122 result: Box::into_raw(Box::new(o)),
7128 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
7129 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
7130 CResult_ChannelInfoDecodeErrorZ {
7131 contents: CResult_ChannelInfoDecodeErrorZPtr {
7132 err: Box::into_raw(Box::new(e)),
7137 /// Checks if the given object is currently in the success state
7139 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
7143 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
7144 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
7145 impl Drop for CResult_ChannelInfoDecodeErrorZ {
7146 fn drop(&mut self) {
7148 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7149 let _ = unsafe { Box::from_raw(self.contents.result) };
7152 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7153 let _ = unsafe { Box::from_raw(self.contents.err) };
7158 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
7159 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7160 let contents = if o.result_ok {
7161 let result = unsafe { o.contents.result };
7162 unsafe { o.contents.result = core::ptr::null_mut() };
7163 CResult_ChannelInfoDecodeErrorZPtr { result }
7165 let err = unsafe { o.contents.err };
7166 unsafe { o.contents.err = core::ptr::null_mut(); }
7167 CResult_ChannelInfoDecodeErrorZPtr { err }
7171 result_ok: o.result_ok,
7175 impl Clone for CResult_ChannelInfoDecodeErrorZ {
7176 fn clone(&self) -> Self {
7178 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
7179 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
7182 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
7183 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7189 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
7190 /// but with all dynamically-allocated buffers duplicated in new buffers.
7191 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
7193 /// The contents of CResult_RoutingFeesDecodeErrorZ
7194 pub union CResult_RoutingFeesDecodeErrorZPtr {
7195 /// A pointer to the contents in the success state.
7196 /// Reading from this pointer when `result_ok` is not set is undefined.
7197 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
7198 /// A pointer to the contents in the error state.
7199 /// Reading from this pointer when `result_ok` is set is undefined.
7200 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7203 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7204 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7206 pub struct CResult_RoutingFeesDecodeErrorZ {
7207 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7208 /// `err` or `result` depending on the state of `result_ok`.
7209 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
7210 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7211 pub result_ok: bool,
7214 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
7215 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
7216 CResult_RoutingFeesDecodeErrorZ {
7217 contents: CResult_RoutingFeesDecodeErrorZPtr {
7218 result: Box::into_raw(Box::new(o)),
7224 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
7225 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
7226 CResult_RoutingFeesDecodeErrorZ {
7227 contents: CResult_RoutingFeesDecodeErrorZPtr {
7228 err: Box::into_raw(Box::new(e)),
7233 /// Checks if the given object is currently in the success state
7235 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
7239 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
7240 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
7241 impl Drop for CResult_RoutingFeesDecodeErrorZ {
7242 fn drop(&mut self) {
7244 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7245 let _ = unsafe { Box::from_raw(self.contents.result) };
7248 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7249 let _ = unsafe { Box::from_raw(self.contents.err) };
7254 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
7255 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
7256 let contents = if o.result_ok {
7257 let result = unsafe { o.contents.result };
7258 unsafe { o.contents.result = core::ptr::null_mut() };
7259 CResult_RoutingFeesDecodeErrorZPtr { result }
7261 let err = unsafe { o.contents.err };
7262 unsafe { o.contents.err = core::ptr::null_mut(); }
7263 CResult_RoutingFeesDecodeErrorZPtr { err }
7267 result_ok: o.result_ok,
7271 impl Clone for CResult_RoutingFeesDecodeErrorZ {
7272 fn clone(&self) -> Self {
7274 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
7275 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
7278 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
7279 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7285 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
7286 /// but with all dynamically-allocated buffers duplicated in new buffers.
7287 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
7289 /// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size.
7290 /// This corresponds to std::vector in C++
7291 pub struct CVec_SocketAddressZ {
7292 /// The elements in the array.
7293 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7294 pub data: *mut crate::lightning::ln::msgs::SocketAddress,
7295 /// The number of elements pointed to by `data`.
7298 impl CVec_SocketAddressZ {
7299 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::SocketAddress> {
7300 if self.datalen == 0 { return Vec::new(); }
7301 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7302 self.data = core::ptr::null_mut();
7306 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] {
7307 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7310 impl From<Vec<crate::lightning::ln::msgs::SocketAddress>> for CVec_SocketAddressZ {
7311 fn from(v: Vec<crate::lightning::ln::msgs::SocketAddress>) -> Self {
7312 let datalen = v.len();
7313 let data = Box::into_raw(v.into_boxed_slice());
7314 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7318 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7319 pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { }
7320 impl Drop for CVec_SocketAddressZ {
7321 fn drop(&mut self) {
7322 if self.datalen == 0 { return; }
7323 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7326 impl Clone for CVec_SocketAddressZ {
7327 fn clone(&self) -> Self {
7328 let mut res = Vec::new();
7329 if self.datalen == 0 { return Self::from(res); }
7330 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7335 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7336 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
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::NodeAnnouncementInfo,
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_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7346 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo 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_NodeAnnouncementInfoDecodeErrorZ {
7349 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7350 /// `err` or `result` depending on the state of `result_ok`.
7351 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
7352 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7353 pub result_ok: bool,
7356 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
7357 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7358 CResult_NodeAnnouncementInfoDecodeErrorZ {
7359 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7360 result: Box::into_raw(Box::new(o)),
7366 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
7367 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
7368 CResult_NodeAnnouncementInfoDecodeErrorZ {
7369 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
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_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
7381 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
7382 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
7383 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
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::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
7397 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, 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_NodeAnnouncementInfoDecodeErrorZPtr { result }
7403 let err = unsafe { o.contents.err };
7404 unsafe { o.contents.err = core::ptr::null_mut(); }
7405 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
7409 result_ok: o.result_ok,
7413 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
7414 fn clone(&self) -> Self {
7416 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7417 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
7420 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
7421 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7427 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
7428 /// but with all dynamically-allocated buffers duplicated in new buffers.
7429 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
7431 /// The contents of CResult_NodeAliasDecodeErrorZ
7432 pub union CResult_NodeAliasDecodeErrorZPtr {
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::NodeAlias,
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_NodeAliasDecodeErrorZ represents the result of a fallible operation,
7442 /// containing a crate::lightning::routing::gossip::NodeAlias 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_NodeAliasDecodeErrorZ {
7445 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
7446 /// `err` or `result` depending on the state of `result_ok`.
7447 pub contents: CResult_NodeAliasDecodeErrorZPtr,
7448 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
7449 pub result_ok: bool,
7452 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
7453 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
7454 CResult_NodeAliasDecodeErrorZ {
7455 contents: CResult_NodeAliasDecodeErrorZPtr {
7456 result: Box::into_raw(Box::new(o)),
7462 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
7463 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
7464 CResult_NodeAliasDecodeErrorZ {
7465 contents: CResult_NodeAliasDecodeErrorZPtr {
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_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
7477 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
7478 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
7479 impl Drop for CResult_NodeAliasDecodeErrorZ {
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::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
7493 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, 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_NodeAliasDecodeErrorZPtr { result }
7499 let err = unsafe { o.contents.err };
7500 unsafe { o.contents.err = core::ptr::null_mut(); }
7501 CResult_NodeAliasDecodeErrorZPtr { err }
7505 result_ok: o.result_ok,
7509 impl Clone for CResult_NodeAliasDecodeErrorZ {
7510 fn clone(&self) -> Self {
7512 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
7513 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
7516 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
7517 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7523 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
7524 /// but with all dynamically-allocated buffers duplicated in new buffers.
7525 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
7527 /// The contents of CResult_NodeInfoDecodeErrorZ
7528 pub union CResult_NodeInfoDecodeErrorZPtr {
7529 /// A pointer to the contents in the success state.
7530 /// Reading from this pointer when `result_ok` is not set is undefined.
7531 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
7532 /// A pointer to the contents in the error state.
7533 /// Reading from this pointer when `result_ok` is set is undefined.
7534 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7537 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7538 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7540 pub struct CResult_NodeInfoDecodeErrorZ {
7541 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7542 /// `err` or `result` depending on the state of `result_ok`.
7543 pub contents: CResult_NodeInfoDecodeErrorZPtr,
7544 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7545 pub result_ok: bool,
7548 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7549 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7550 CResult_NodeInfoDecodeErrorZ {
7551 contents: CResult_NodeInfoDecodeErrorZPtr {
7552 result: Box::into_raw(Box::new(o)),
7558 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7559 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7560 CResult_NodeInfoDecodeErrorZ {
7561 contents: CResult_NodeInfoDecodeErrorZPtr {
7562 err: Box::into_raw(Box::new(e)),
7567 /// Checks if the given object is currently in the success state
7569 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
7573 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7574 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7575 impl Drop for CResult_NodeInfoDecodeErrorZ {
7576 fn drop(&mut self) {
7578 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7579 let _ = unsafe { Box::from_raw(self.contents.result) };
7582 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7583 let _ = unsafe { Box::from_raw(self.contents.err) };
7588 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7589 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7590 let contents = if o.result_ok {
7591 let result = unsafe { o.contents.result };
7592 unsafe { o.contents.result = core::ptr::null_mut() };
7593 CResult_NodeInfoDecodeErrorZPtr { result }
7595 let err = unsafe { o.contents.err };
7596 unsafe { o.contents.err = core::ptr::null_mut(); }
7597 CResult_NodeInfoDecodeErrorZPtr { err }
7601 result_ok: o.result_ok,
7605 impl Clone for CResult_NodeInfoDecodeErrorZ {
7606 fn clone(&self) -> Self {
7608 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7609 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
7612 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7613 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7619 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7620 /// but with all dynamically-allocated buffers duplicated in new buffers.
7621 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
7623 /// The contents of CResult_NetworkGraphDecodeErrorZ
7624 pub union CResult_NetworkGraphDecodeErrorZPtr {
7625 /// A pointer to the contents in the success state.
7626 /// Reading from this pointer when `result_ok` is not set is undefined.
7627 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
7628 /// A pointer to the contents in the error state.
7629 /// Reading from this pointer when `result_ok` is set is undefined.
7630 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7633 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7634 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7635 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7636 pub struct CResult_NetworkGraphDecodeErrorZ {
7637 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7638 /// `err` or `result` depending on the state of `result_ok`.
7639 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7640 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7641 pub result_ok: bool,
7644 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7645 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7646 CResult_NetworkGraphDecodeErrorZ {
7647 contents: CResult_NetworkGraphDecodeErrorZPtr {
7648 result: Box::into_raw(Box::new(o)),
7654 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7655 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7656 CResult_NetworkGraphDecodeErrorZ {
7657 contents: CResult_NetworkGraphDecodeErrorZPtr {
7658 err: Box::into_raw(Box::new(e)),
7663 /// Checks if the given object is currently in the success state
7665 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
7669 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7670 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7671 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7672 fn drop(&mut self) {
7674 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7675 let _ = unsafe { Box::from_raw(self.contents.result) };
7678 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7679 let _ = unsafe { Box::from_raw(self.contents.err) };
7684 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7685 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7686 let contents = if o.result_ok {
7687 let result = unsafe { o.contents.result };
7688 unsafe { o.contents.result = core::ptr::null_mut() };
7689 CResult_NetworkGraphDecodeErrorZPtr { result }
7691 let err = unsafe { o.contents.err };
7692 unsafe { o.contents.err = core::ptr::null_mut(); }
7693 CResult_NetworkGraphDecodeErrorZPtr { err }
7697 result_ok: o.result_ok,
7703 /// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
7704 pub enum COption_CVec_SocketAddressZZ {
7705 /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ
7706 Some(crate::c_types::derived::CVec_SocketAddressZ),
7707 /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing
7710 impl COption_CVec_SocketAddressZZ {
7711 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7712 if let Self::None = self { false } else { true }
7714 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7717 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_SocketAddressZ {
7718 if let Self::Some(v) = self { v } else { unreachable!() }
7722 /// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
7723 pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ {
7724 COption_CVec_SocketAddressZZ::Some(o)
7727 /// Constructs a new COption_CVec_SocketAddressZZ containing nothing
7728 pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ {
7729 COption_CVec_SocketAddressZZ::None
7732 /// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state
7733 pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { }
7735 /// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig`
7736 /// but with all dynamically-allocated buffers duplicated in new buffers.
7737 pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { 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::sign::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::sign::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::sign::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::sign::HTLCDescriptor] {
7803 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7806 impl From<Vec<crate::lightning::sign::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
7807 fn from(v: Vec<crate::lightning::sign::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) });
9139 /// An enum which can either contain a crate::c_types::Str or not
9140 pub enum COption_StrZ {
9141 /// When we're in this state, this COption_StrZ contains a crate::c_types::Str
9142 Some(crate::c_types::Str),
9143 /// When we're in this state, this COption_StrZ contains nothing
9147 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9148 if let Self::None = self { false } else { true }
9150 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9153 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Str {
9154 if let Self::Some(v) = self { v } else { unreachable!() }
9158 /// Constructs a new COption_StrZ containing a crate::c_types::Str
9159 pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ {
9160 COption_StrZ::Some(o)
9163 /// Constructs a new COption_StrZ containing nothing
9164 pub extern "C" fn COption_StrZ_none() -> COption_StrZ {
9168 /// Frees any resources associated with the crate::c_types::Str, if we are in the Some state
9169 pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { }
9171 /// Creates a new COption_StrZ which has the same data as `orig`
9172 /// but with all dynamically-allocated buffers duplicated in new buffers.
9173 pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) }
9175 /// The contents of CResult_NoneBolt12SemanticErrorZ
9176 pub union CResult_NoneBolt12SemanticErrorZPtr {
9177 /// Note that this value is always NULL, as there are no contents in the OK variant
9178 pub result: *mut core::ffi::c_void,
9179 /// A pointer to the contents in the error state.
9180 /// Reading from this pointer when `result_ok` is set is undefined.
9181 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
9184 /// A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation,
9185 /// containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
9186 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9187 pub struct CResult_NoneBolt12SemanticErrorZ {
9188 /// The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either
9189 /// `err` or `result` depending on the state of `result_ok`.
9190 pub contents: CResult_NoneBolt12SemanticErrorZPtr,
9191 /// Whether this CResult_NoneBolt12SemanticErrorZ represents a success state.
9192 pub result_ok: bool,
9195 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the success state.
9196 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_ok() -> CResult_NoneBolt12SemanticErrorZ {
9197 CResult_NoneBolt12SemanticErrorZ {
9198 contents: CResult_NoneBolt12SemanticErrorZPtr {
9199 result: core::ptr::null_mut(),
9205 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the error state.
9206 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_NoneBolt12SemanticErrorZ {
9207 CResult_NoneBolt12SemanticErrorZ {
9208 contents: CResult_NoneBolt12SemanticErrorZPtr {
9209 err: Box::into_raw(Box::new(e)),
9214 /// Checks if the given object is currently in the success state
9216 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_is_ok(o: &CResult_NoneBolt12SemanticErrorZ) -> bool {
9220 /// Frees any resources used by the CResult_NoneBolt12SemanticErrorZ.
9221 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_free(_res: CResult_NoneBolt12SemanticErrorZ) { }
9222 impl Drop for CResult_NoneBolt12SemanticErrorZ {
9223 fn drop(&mut self) {
9226 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9227 let _ = unsafe { Box::from_raw(self.contents.err) };
9232 impl From<crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_NoneBolt12SemanticErrorZ {
9233 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
9234 let contents = if o.result_ok {
9235 let _ = unsafe { Box::from_raw(o.contents.result) };
9236 o.contents.result = core::ptr::null_mut();
9237 CResult_NoneBolt12SemanticErrorZPtr { result: core::ptr::null_mut() }
9239 let err = unsafe { o.contents.err };
9240 unsafe { o.contents.err = core::ptr::null_mut(); }
9241 CResult_NoneBolt12SemanticErrorZPtr { err }
9245 result_ok: o.result_ok,
9249 impl Clone for CResult_NoneBolt12SemanticErrorZ {
9250 fn clone(&self) -> Self {
9252 Self { result_ok: true, contents: CResult_NoneBolt12SemanticErrorZPtr {
9253 result: core::ptr::null_mut()
9256 Self { result_ok: false, contents: CResult_NoneBolt12SemanticErrorZPtr {
9257 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
9263 /// Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig`
9264 /// but with all dynamically-allocated buffers duplicated in new buffers.
9265 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_clone(orig: &CResult_NoneBolt12SemanticErrorZ) -> CResult_NoneBolt12SemanticErrorZ { Clone::clone(&orig) }
9267 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
9268 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9269 /// A pointer to the contents in the success state.
9270 /// Reading from this pointer when `result_ok` is not set is undefined.
9271 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
9272 /// Note that this value is always NULL, as there are no contents in the Err variant
9273 pub err: *mut core::ffi::c_void,
9276 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
9277 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
9278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9279 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9280 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
9281 /// `err` or `result` depending on the state of `result_ok`.
9282 pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
9283 /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
9284 pub result_ok: bool,
9287 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
9288 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9289 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9290 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9291 result: Box::into_raw(Box::new(o)),
9297 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
9298 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9299 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9300 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9301 err: core::ptr::null_mut(),
9306 /// Checks if the given object is currently in the success state
9308 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
9312 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
9313 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
9314 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9315 fn drop(&mut self) {
9317 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9318 let _ = unsafe { Box::from_raw(self.contents.result) };
9324 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9325 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
9326 let contents = if o.result_ok {
9327 let result = unsafe { o.contents.result };
9328 unsafe { o.contents.result = core::ptr::null_mut() };
9329 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
9331 let _ = unsafe { Box::from_raw(o.contents.err) };
9332 o.contents.err = core::ptr::null_mut();
9333 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
9337 result_ok: o.result_ok,
9341 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
9342 fn clone(&self) -> Self {
9344 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9345 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
9348 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
9349 err: core::ptr::null_mut()
9355 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
9356 /// but with all dynamically-allocated buffers duplicated in new buffers.
9357 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
9360 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
9361 pub enum COption_OffersMessageZ {
9362 /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
9363 Some(crate::lightning::onion_message::offers::OffersMessage),
9364 /// When we're in this state, this COption_OffersMessageZ contains nothing
9367 impl COption_OffersMessageZ {
9368 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9369 if let Self::None = self { false } else { true }
9371 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9374 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
9375 if let Self::Some(v) = self { v } else { unreachable!() }
9379 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
9380 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
9381 COption_OffersMessageZ::Some(o)
9384 /// Constructs a new COption_OffersMessageZ containing nothing
9385 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
9386 COption_OffersMessageZ::None
9389 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
9390 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
9392 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
9393 /// but with all dynamically-allocated buffers duplicated in new buffers.
9394 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
9396 /// A tuple of 3 elements. See the individual fields for the types contained.
9397 pub struct C3Tuple_OffersMessageDestinationBlindedPathZ {
9398 /// The element at position 0
9399 pub a: crate::lightning::onion_message::offers::OffersMessage,
9400 /// The element at position 1
9401 pub b: crate::lightning::onion_message::messenger::Destination,
9402 /// The element at position 2
9403 pub c: crate::lightning::blinded_path::BlindedPath,
9405 impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OffersMessageDestinationBlindedPathZ {
9406 fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
9414 impl C3Tuple_OffersMessageDestinationBlindedPathZ {
9415 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
9416 (self.a, self.b, self.c)
9419 impl Clone for C3Tuple_OffersMessageDestinationBlindedPathZ {
9420 fn clone(&self) -> Self {
9422 a: Clone::clone(&self.a),
9423 b: Clone::clone(&self.b),
9424 c: Clone::clone(&self.c),
9429 /// Creates a new tuple which has the same data as `orig`
9430 /// but with all dynamically-allocated buffers duplicated in new buffers.
9431 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig: &C3Tuple_OffersMessageDestinationBlindedPathZ) -> C3Tuple_OffersMessageDestinationBlindedPathZ { Clone::clone(&orig) }
9432 /// Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
9434 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_new(a: crate::lightning::onion_message::offers::OffersMessage, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OffersMessageDestinationBlindedPathZ {
9435 C3Tuple_OffersMessageDestinationBlindedPathZ { a, b, c, }
9439 /// Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
9440 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res: C3Tuple_OffersMessageDestinationBlindedPathZ) { }
9442 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
9443 /// This corresponds to std::vector in C++
9444 pub struct CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9445 /// The elements in the array.
9446 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9447 pub data: *mut crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ,
9448 /// The number of elements pointed to by `data`.
9451 impl CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9452 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ> {
9453 if self.datalen == 0 { return Vec::new(); }
9454 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9455 self.data = core::ptr::null_mut();
9459 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ] {
9460 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9463 impl From<Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>> for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9464 fn from(v: Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>) -> Self {
9465 let datalen = v.len();
9466 let data = Box::into_raw(v.into_boxed_slice());
9467 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9471 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9472 pub extern "C" fn CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ) { }
9473 impl Drop for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9474 fn drop(&mut self) {
9475 if self.datalen == 0 { return; }
9476 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9479 impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
9480 fn clone(&self) -> Self {
9481 let mut res = Vec::new();
9482 if self.datalen == 0 { return Self::from(res); }
9483 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9488 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9489 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9490 /// A pointer to the contents in the success state.
9491 /// Reading from this pointer when `result_ok` is not set is undefined.
9492 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9493 /// A pointer to the contents in the error state.
9494 /// Reading from this pointer when `result_ok` is set is undefined.
9495 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9498 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9499 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9500 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9501 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9502 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9503 /// `err` or `result` depending on the state of `result_ok`.
9504 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9505 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9506 pub result_ok: bool,
9509 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9510 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9511 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9512 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9513 result: Box::into_raw(Box::new(o)),
9519 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9520 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9521 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9522 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9523 err: Box::into_raw(Box::new(e)),
9528 /// Checks if the given object is currently in the success state
9530 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9534 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9535 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9536 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9537 fn drop(&mut self) {
9539 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9540 let _ = unsafe { Box::from_raw(self.contents.result) };
9543 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9544 let _ = unsafe { Box::from_raw(self.contents.err) };
9549 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9550 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9551 let contents = if o.result_ok {
9552 let result = unsafe { o.contents.result };
9553 unsafe { o.contents.result = core::ptr::null_mut() };
9554 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9556 let err = unsafe { o.contents.err };
9557 unsafe { o.contents.err = core::ptr::null_mut(); }
9558 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9562 result_ok: o.result_ok,
9566 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9567 fn clone(&self) -> Self {
9569 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9570 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9573 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9574 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9580 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9581 /// but with all dynamically-allocated buffers duplicated in new buffers.
9582 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9584 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9585 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9586 /// A pointer to the contents in the success state.
9587 /// Reading from this pointer when `result_ok` is not set is undefined.
9588 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9589 /// A pointer to the contents in the error state.
9590 /// Reading from this pointer when `result_ok` is set is undefined.
9591 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9594 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9595 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9596 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9597 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9598 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9599 /// `err` or `result` depending on the state of `result_ok`.
9600 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9601 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9602 pub result_ok: bool,
9605 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9606 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9607 CResult_ChannelCounterpartyDecodeErrorZ {
9608 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9609 result: Box::into_raw(Box::new(o)),
9615 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9616 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9617 CResult_ChannelCounterpartyDecodeErrorZ {
9618 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9619 err: Box::into_raw(Box::new(e)),
9624 /// Checks if the given object is currently in the success state
9626 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9630 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9631 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9632 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9633 fn drop(&mut self) {
9635 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9636 let _ = unsafe { Box::from_raw(self.contents.result) };
9639 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9640 let _ = unsafe { Box::from_raw(self.contents.err) };
9645 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9646 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9647 let contents = if o.result_ok {
9648 let result = unsafe { o.contents.result };
9649 unsafe { o.contents.result = core::ptr::null_mut() };
9650 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9652 let err = unsafe { o.contents.err };
9653 unsafe { o.contents.err = core::ptr::null_mut(); }
9654 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9658 result_ok: o.result_ok,
9662 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9663 fn clone(&self) -> Self {
9665 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9666 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9669 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9670 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9676 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9677 /// but with all dynamically-allocated buffers duplicated in new buffers.
9678 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9680 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9681 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9682 /// A pointer to the contents in the success state.
9683 /// Reading from this pointer when `result_ok` is not set is undefined.
9684 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9685 /// A pointer to the contents in the error state.
9686 /// Reading from this pointer when `result_ok` is set is undefined.
9687 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9690 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9691 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9692 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9693 pub struct CResult_ChannelDetailsDecodeErrorZ {
9694 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9695 /// `err` or `result` depending on the state of `result_ok`.
9696 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9697 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9698 pub result_ok: bool,
9701 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9702 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9703 CResult_ChannelDetailsDecodeErrorZ {
9704 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9705 result: Box::into_raw(Box::new(o)),
9711 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9712 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9713 CResult_ChannelDetailsDecodeErrorZ {
9714 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9715 err: Box::into_raw(Box::new(e)),
9720 /// Checks if the given object is currently in the success state
9722 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9726 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9727 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9728 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9729 fn drop(&mut self) {
9731 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9732 let _ = unsafe { Box::from_raw(self.contents.result) };
9735 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9736 let _ = unsafe { Box::from_raw(self.contents.err) };
9741 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9742 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9743 let contents = if o.result_ok {
9744 let result = unsafe { o.contents.result };
9745 unsafe { o.contents.result = core::ptr::null_mut() };
9746 CResult_ChannelDetailsDecodeErrorZPtr { result }
9748 let err = unsafe { o.contents.err };
9749 unsafe { o.contents.err = core::ptr::null_mut(); }
9750 CResult_ChannelDetailsDecodeErrorZPtr { err }
9754 result_ok: o.result_ok,
9758 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9759 fn clone(&self) -> Self {
9761 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9762 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9765 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9766 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9772 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9773 /// but with all dynamically-allocated buffers duplicated in new buffers.
9774 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9776 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9777 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9778 /// A pointer to the contents in the success state.
9779 /// Reading from this pointer when `result_ok` is not set is undefined.
9780 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9781 /// A pointer to the contents in the error state.
9782 /// Reading from this pointer when `result_ok` is set is undefined.
9783 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9786 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9787 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9788 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9789 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9790 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9791 /// `err` or `result` depending on the state of `result_ok`.
9792 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9793 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9794 pub result_ok: bool,
9797 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9798 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9799 CResult_PhantomRouteHintsDecodeErrorZ {
9800 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9801 result: Box::into_raw(Box::new(o)),
9807 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9808 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9809 CResult_PhantomRouteHintsDecodeErrorZ {
9810 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9811 err: Box::into_raw(Box::new(e)),
9816 /// Checks if the given object is currently in the success state
9818 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9822 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9823 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9824 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9825 fn drop(&mut self) {
9827 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9828 let _ = unsafe { Box::from_raw(self.contents.result) };
9831 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9832 let _ = unsafe { Box::from_raw(self.contents.err) };
9837 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9838 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9839 let contents = if o.result_ok {
9840 let result = unsafe { o.contents.result };
9841 unsafe { o.contents.result = core::ptr::null_mut() };
9842 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9844 let err = unsafe { o.contents.err };
9845 unsafe { o.contents.err = core::ptr::null_mut(); }
9846 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9850 result_ok: o.result_ok,
9854 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9855 fn clone(&self) -> Self {
9857 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9858 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9861 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9862 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9868 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9869 /// but with all dynamically-allocated buffers duplicated in new buffers.
9870 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9872 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
9873 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
9874 /// A pointer to the contents in the success state.
9875 /// Reading from this pointer when `result_ok` is not set is undefined.
9876 pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
9877 /// A pointer to the contents in the error state.
9878 /// Reading from this pointer when `result_ok` is set is undefined.
9879 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9882 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
9883 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
9884 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9885 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
9886 /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
9887 /// `err` or `result` depending on the state of `result_ok`.
9888 pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
9889 /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
9890 pub result_ok: bool,
9893 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
9894 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
9895 CResult_ChannelShutdownStateDecodeErrorZ {
9896 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9897 result: Box::into_raw(Box::new(o)),
9903 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
9904 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
9905 CResult_ChannelShutdownStateDecodeErrorZ {
9906 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9907 err: Box::into_raw(Box::new(e)),
9912 /// Checks if the given object is currently in the success state
9914 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
9918 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
9919 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
9920 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
9921 fn drop(&mut self) {
9923 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9924 let _ = unsafe { Box::from_raw(self.contents.result) };
9927 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9928 let _ = unsafe { Box::from_raw(self.contents.err) };
9933 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
9934 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
9935 let contents = if o.result_ok {
9936 let result = unsafe { o.contents.result };
9937 unsafe { o.contents.result = core::ptr::null_mut() };
9938 CResult_ChannelShutdownStateDecodeErrorZPtr { result }
9940 let err = unsafe { o.contents.err };
9941 unsafe { o.contents.err = core::ptr::null_mut(); }
9942 CResult_ChannelShutdownStateDecodeErrorZPtr { err }
9946 result_ok: o.result_ok,
9950 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
9951 fn clone(&self) -> Self {
9953 Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9954 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
9957 Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9958 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9964 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
9965 /// but with all dynamically-allocated buffers duplicated in new buffers.
9966 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
9968 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9969 /// This corresponds to std::vector in C++
9970 pub struct CVec_ChannelMonitorZ {
9971 /// The elements in the array.
9972 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9973 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9974 /// The number of elements pointed to by `data`.
9977 impl CVec_ChannelMonitorZ {
9978 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9979 if self.datalen == 0 { return Vec::new(); }
9980 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9981 self.data = core::ptr::null_mut();
9985 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9986 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9989 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9990 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9991 let datalen = v.len();
9992 let data = Box::into_raw(v.into_boxed_slice());
9993 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9997 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9998 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9999 impl Drop for CVec_ChannelMonitorZ {
10000 fn drop(&mut self) {
10001 if self.datalen == 0 { return; }
10002 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10005 impl Clone for CVec_ChannelMonitorZ {
10006 fn clone(&self) -> Self {
10007 let mut res = Vec::new();
10008 if self.datalen == 0 { return Self::from(res); }
10009 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10014 /// A tuple of 2 elements. See the individual fields for the types contained.
10015 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
10016 /// The element at position 0
10017 pub a: crate::c_types::ThirtyTwoBytes,
10018 /// The element at position 1
10019 pub b: crate::lightning::ln::channelmanager::ChannelManager,
10021 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
10022 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10029 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
10030 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10034 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
10036 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
10037 C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
10041 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
10042 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
10044 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
10045 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10046 /// A pointer to the contents in the success state.
10047 /// Reading from this pointer when `result_ok` is not set is undefined.
10048 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
10049 /// A pointer to the contents in the error state.
10050 /// Reading from this pointer when `result_ok` is set is undefined.
10051 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10054 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10055 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10057 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10058 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
10059 /// `err` or `result` depending on the state of `result_ok`.
10060 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
10061 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
10062 pub result_ok: bool,
10065 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
10066 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10067 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10068 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10069 result: Box::into_raw(Box::new(o)),
10075 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
10076 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10077 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10078 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
10079 err: Box::into_raw(Box::new(e)),
10084 /// Checks if the given object is currently in the success state
10086 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
10090 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
10091 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
10092 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10093 fn drop(&mut self) {
10094 if self.result_ok {
10095 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10096 let _ = unsafe { Box::from_raw(self.contents.result) };
10099 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10100 let _ = unsafe { Box::from_raw(self.contents.err) };
10105 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
10106 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10107 let contents = if o.result_ok {
10108 let result = unsafe { o.contents.result };
10109 unsafe { o.contents.result = core::ptr::null_mut() };
10110 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
10112 let err = unsafe { o.contents.err };
10113 unsafe { o.contents.err = core::ptr::null_mut(); }
10114 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
10118 result_ok: o.result_ok,
10123 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
10124 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10125 /// A pointer to the contents in the success state.
10126 /// Reading from this pointer when `result_ok` is not set is undefined.
10127 pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
10128 /// A pointer to the contents in the error state.
10129 /// Reading from this pointer when `result_ok` is set is undefined.
10130 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10133 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
10134 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
10135 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10136 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
10137 /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
10138 /// `err` or `result` depending on the state of `result_ok`.
10139 pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
10140 /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
10141 pub result_ok: bool,
10144 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
10145 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
10146 CResult_MaxDustHTLCExposureDecodeErrorZ {
10147 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10148 result: Box::into_raw(Box::new(o)),
10154 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
10155 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
10156 CResult_MaxDustHTLCExposureDecodeErrorZ {
10157 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10158 err: Box::into_raw(Box::new(e)),
10163 /// Checks if the given object is currently in the success state
10165 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
10169 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
10170 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
10171 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
10172 fn drop(&mut self) {
10173 if self.result_ok {
10174 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10175 let _ = unsafe { Box::from_raw(self.contents.result) };
10178 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10179 let _ = unsafe { Box::from_raw(self.contents.err) };
10184 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
10185 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
10186 let contents = if o.result_ok {
10187 let result = unsafe { o.contents.result };
10188 unsafe { o.contents.result = core::ptr::null_mut() };
10189 CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
10191 let err = unsafe { o.contents.err };
10192 unsafe { o.contents.err = core::ptr::null_mut(); }
10193 CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
10197 result_ok: o.result_ok,
10201 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
10202 fn clone(&self) -> Self {
10203 if self.result_ok {
10204 Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10205 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
10208 Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
10209 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10215 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
10216 /// but with all dynamically-allocated buffers duplicated in new buffers.
10217 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
10219 /// The contents of CResult_ChannelConfigDecodeErrorZ
10220 pub union CResult_ChannelConfigDecodeErrorZPtr {
10221 /// A pointer to the contents in the success state.
10222 /// Reading from this pointer when `result_ok` is not set is undefined.
10223 pub result: *mut crate::lightning::util::config::ChannelConfig,
10224 /// A pointer to the contents in the error state.
10225 /// Reading from this pointer when `result_ok` is set is undefined.
10226 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10229 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
10230 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
10231 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10232 pub struct CResult_ChannelConfigDecodeErrorZ {
10233 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
10234 /// `err` or `result` depending on the state of `result_ok`.
10235 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
10236 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
10237 pub result_ok: bool,
10240 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10241 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
10242 CResult_ChannelConfigDecodeErrorZ {
10243 contents: CResult_ChannelConfigDecodeErrorZPtr {
10244 result: Box::into_raw(Box::new(o)),
10250 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10251 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
10252 CResult_ChannelConfigDecodeErrorZ {
10253 contents: CResult_ChannelConfigDecodeErrorZPtr {
10254 err: Box::into_raw(Box::new(e)),
10259 /// Checks if the given object is currently in the success state
10261 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
10265 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10266 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
10267 impl Drop for CResult_ChannelConfigDecodeErrorZ {
10268 fn drop(&mut self) {
10269 if self.result_ok {
10270 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10271 let _ = unsafe { Box::from_raw(self.contents.result) };
10274 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10275 let _ = unsafe { Box::from_raw(self.contents.err) };
10280 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
10281 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
10282 let contents = if o.result_ok {
10283 let result = unsafe { o.contents.result };
10284 unsafe { o.contents.result = core::ptr::null_mut() };
10285 CResult_ChannelConfigDecodeErrorZPtr { result }
10287 let err = unsafe { o.contents.err };
10288 unsafe { o.contents.err = core::ptr::null_mut(); }
10289 CResult_ChannelConfigDecodeErrorZPtr { err }
10293 result_ok: o.result_ok,
10297 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10298 fn clone(&self) -> Self {
10299 if self.result_ok {
10300 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10301 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
10304 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
10305 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10311 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10312 /// but with all dynamically-allocated buffers duplicated in new buffers.
10313 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
10316 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
10317 pub enum COption_MaxDustHTLCExposureZ {
10318 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
10319 Some(crate::lightning::util::config::MaxDustHTLCExposure),
10320 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
10323 impl COption_MaxDustHTLCExposureZ {
10324 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10325 if let Self::None = self { false } else { true }
10327 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10330 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
10331 if let Self::Some(v) = self { v } else { unreachable!() }
10335 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
10336 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
10337 COption_MaxDustHTLCExposureZ::Some(o)
10340 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
10341 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
10342 COption_MaxDustHTLCExposureZ::None
10345 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
10346 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
10348 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
10349 /// but with all dynamically-allocated buffers duplicated in new buffers.
10350 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
10353 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
10354 pub enum COption_APIErrorZ {
10355 /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
10356 Some(crate::lightning::util::errors::APIError),
10357 /// When we're in this state, this COption_APIErrorZ contains nothing
10360 impl COption_APIErrorZ {
10361 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10362 if let Self::None = self { false } else { true }
10364 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10367 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
10368 if let Self::Some(v) = self { v } else { unreachable!() }
10372 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
10373 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
10374 COption_APIErrorZ::Some(o)
10377 /// Constructs a new COption_APIErrorZ containing nothing
10378 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
10379 COption_APIErrorZ::None
10382 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
10383 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
10385 /// Creates a new COption_APIErrorZ which has the same data as `orig`
10386 /// but with all dynamically-allocated buffers duplicated in new buffers.
10387 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
10389 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
10390 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
10391 /// A pointer to the contents in the success state.
10392 /// Reading from this pointer when `result_ok` is not set is undefined.
10393 pub result: *mut crate::c_types::derived::COption_APIErrorZ,
10394 /// A pointer to the contents in the error state.
10395 /// Reading from this pointer when `result_ok` is set is undefined.
10396 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10399 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
10400 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10401 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10402 pub struct CResult_COption_APIErrorZDecodeErrorZ {
10403 /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
10404 /// `err` or `result` depending on the state of `result_ok`.
10405 pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
10406 /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
10407 pub result_ok: bool,
10410 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
10411 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
10412 CResult_COption_APIErrorZDecodeErrorZ {
10413 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10414 result: Box::into_raw(Box::new(o)),
10420 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
10421 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
10422 CResult_COption_APIErrorZDecodeErrorZ {
10423 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10424 err: Box::into_raw(Box::new(e)),
10429 /// Checks if the given object is currently in the success state
10431 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
10435 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
10436 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
10437 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
10438 fn drop(&mut self) {
10439 if self.result_ok {
10440 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10441 let _ = unsafe { Box::from_raw(self.contents.result) };
10444 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10445 let _ = unsafe { Box::from_raw(self.contents.err) };
10450 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
10451 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10452 let contents = if o.result_ok {
10453 let result = unsafe { o.contents.result };
10454 unsafe { o.contents.result = core::ptr::null_mut() };
10455 CResult_COption_APIErrorZDecodeErrorZPtr { result }
10457 let err = unsafe { o.contents.err };
10458 unsafe { o.contents.err = core::ptr::null_mut(); }
10459 CResult_COption_APIErrorZDecodeErrorZPtr { err }
10463 result_ok: o.result_ok,
10467 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
10468 fn clone(&self) -> Self {
10469 if self.result_ok {
10470 Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10471 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
10474 Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10475 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10481 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
10482 /// but with all dynamically-allocated buffers duplicated in new buffers.
10483 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
10485 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10486 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10487 /// A pointer to the contents in the success state.
10488 /// Reading from this pointer when `result_ok` is not set is undefined.
10489 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10490 /// A pointer to the contents in the error state.
10491 /// Reading from this pointer when `result_ok` is set is undefined.
10492 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10495 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10496 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10497 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10498 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10499 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10500 /// `err` or `result` depending on the state of `result_ok`.
10501 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10502 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10503 pub result_ok: bool,
10506 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10507 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10508 CResult_ChannelMonitorUpdateDecodeErrorZ {
10509 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10510 result: Box::into_raw(Box::new(o)),
10516 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10517 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10518 CResult_ChannelMonitorUpdateDecodeErrorZ {
10519 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10520 err: Box::into_raw(Box::new(e)),
10525 /// Checks if the given object is currently in the success state
10527 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10531 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10532 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10533 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10534 fn drop(&mut self) {
10535 if self.result_ok {
10536 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10537 let _ = unsafe { Box::from_raw(self.contents.result) };
10540 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10541 let _ = unsafe { Box::from_raw(self.contents.err) };
10546 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10547 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10548 let contents = if o.result_ok {
10549 let result = unsafe { o.contents.result };
10550 unsafe { o.contents.result = core::ptr::null_mut() };
10551 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10553 let err = unsafe { o.contents.err };
10554 unsafe { o.contents.err = core::ptr::null_mut(); }
10555 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10559 result_ok: o.result_ok,
10563 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10564 fn clone(&self) -> Self {
10565 if self.result_ok {
10566 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10567 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10570 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10571 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10577 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10578 /// but with all dynamically-allocated buffers duplicated in new buffers.
10579 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10582 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10583 pub enum COption_MonitorEventZ {
10584 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10585 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10586 /// When we're in this state, this COption_MonitorEventZ contains nothing
10589 impl COption_MonitorEventZ {
10590 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10591 if let Self::None = self { false } else { true }
10593 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10596 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10597 if let Self::Some(v) = self { v } else { unreachable!() }
10601 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10602 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10603 COption_MonitorEventZ::Some(o)
10606 /// Constructs a new COption_MonitorEventZ containing nothing
10607 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10608 COption_MonitorEventZ::None
10611 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10612 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10614 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10615 /// but with all dynamically-allocated buffers duplicated in new buffers.
10616 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10618 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10619 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10620 /// A pointer to the contents in the success state.
10621 /// Reading from this pointer when `result_ok` is not set is undefined.
10622 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10623 /// A pointer to the contents in the error state.
10624 /// Reading from this pointer when `result_ok` is set is undefined.
10625 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10628 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10629 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10631 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10632 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10633 /// `err` or `result` depending on the state of `result_ok`.
10634 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10635 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10636 pub result_ok: bool,
10639 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10640 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10641 CResult_COption_MonitorEventZDecodeErrorZ {
10642 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10643 result: Box::into_raw(Box::new(o)),
10649 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10650 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10651 CResult_COption_MonitorEventZDecodeErrorZ {
10652 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10653 err: Box::into_raw(Box::new(e)),
10658 /// Checks if the given object is currently in the success state
10660 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10664 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10665 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10666 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10667 fn drop(&mut self) {
10668 if self.result_ok {
10669 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10670 let _ = unsafe { Box::from_raw(self.contents.result) };
10673 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10674 let _ = unsafe { Box::from_raw(self.contents.err) };
10679 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10680 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10681 let contents = if o.result_ok {
10682 let result = unsafe { o.contents.result };
10683 unsafe { o.contents.result = core::ptr::null_mut() };
10684 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10686 let err = unsafe { o.contents.err };
10687 unsafe { o.contents.err = core::ptr::null_mut(); }
10688 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10692 result_ok: o.result_ok,
10696 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10697 fn clone(&self) -> Self {
10698 if self.result_ok {
10699 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10700 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10703 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10704 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10710 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10711 /// but with all dynamically-allocated buffers duplicated in new buffers.
10712 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10714 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10715 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10716 /// A pointer to the contents in the success state.
10717 /// Reading from this pointer when `result_ok` is not set is undefined.
10718 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10719 /// A pointer to the contents in the error state.
10720 /// Reading from this pointer when `result_ok` is set is undefined.
10721 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10724 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10725 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10727 pub struct CResult_HTLCUpdateDecodeErrorZ {
10728 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10729 /// `err` or `result` depending on the state of `result_ok`.
10730 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10731 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10732 pub result_ok: bool,
10735 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10736 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10737 CResult_HTLCUpdateDecodeErrorZ {
10738 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10739 result: Box::into_raw(Box::new(o)),
10745 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10746 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10747 CResult_HTLCUpdateDecodeErrorZ {
10748 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10749 err: Box::into_raw(Box::new(e)),
10754 /// Checks if the given object is currently in the success state
10756 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10760 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10761 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10762 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10763 fn drop(&mut self) {
10764 if self.result_ok {
10765 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10766 let _ = unsafe { Box::from_raw(self.contents.result) };
10769 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10770 let _ = unsafe { Box::from_raw(self.contents.err) };
10775 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10776 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10777 let contents = if o.result_ok {
10778 let result = unsafe { o.contents.result };
10779 unsafe { o.contents.result = core::ptr::null_mut() };
10780 CResult_HTLCUpdateDecodeErrorZPtr { result }
10782 let err = unsafe { o.contents.err };
10783 unsafe { o.contents.err = core::ptr::null_mut(); }
10784 CResult_HTLCUpdateDecodeErrorZPtr { err }
10788 result_ok: o.result_ok,
10792 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10793 fn clone(&self) -> Self {
10794 if self.result_ok {
10795 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10796 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10799 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10800 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10806 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10807 /// but with all dynamically-allocated buffers duplicated in new buffers.
10808 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10810 /// A tuple of 2 elements. See the individual fields for the types contained.
10811 pub struct C2Tuple_OutPointCVec_u8ZZ {
10812 /// The element at position 0
10813 pub a: crate::lightning::chain::transaction::OutPoint,
10814 /// The element at position 1
10815 pub b: crate::c_types::derived::CVec_u8Z,
10817 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
10818 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10825 impl C2Tuple_OutPointCVec_u8ZZ {
10826 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10830 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
10831 fn clone(&self) -> Self {
10833 a: Clone::clone(&self.a),
10834 b: Clone::clone(&self.b),
10839 /// Creates a new tuple which has the same data as `orig`
10840 /// but with all dynamically-allocated buffers duplicated in new buffers.
10841 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
10842 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
10844 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
10845 C2Tuple_OutPointCVec_u8ZZ { a, b, }
10849 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
10850 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
10852 /// A tuple of 2 elements. See the individual fields for the types contained.
10853 pub struct C2Tuple_u32CVec_u8ZZ {
10854 /// The element at position 0
10856 /// The element at position 1
10857 pub b: crate::c_types::derived::CVec_u8Z,
10859 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
10860 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10867 impl C2Tuple_u32CVec_u8ZZ {
10868 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10872 impl Clone for C2Tuple_u32CVec_u8ZZ {
10873 fn clone(&self) -> Self {
10875 a: Clone::clone(&self.a),
10876 b: Clone::clone(&self.b),
10881 /// Creates a new tuple which has the same data as `orig`
10882 /// but with all dynamically-allocated buffers duplicated in new buffers.
10883 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
10884 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
10886 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
10887 C2Tuple_u32CVec_u8ZZ { a, b, }
10891 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
10892 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
10894 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
10895 /// This corresponds to std::vector in C++
10896 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
10897 /// The elements in the array.
10898 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10899 pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
10900 /// The number of elements pointed to by `data`.
10903 impl CVec_C2Tuple_u32CVec_u8ZZZ {
10904 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
10905 if self.datalen == 0 { return Vec::new(); }
10906 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10907 self.data = core::ptr::null_mut();
10911 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
10912 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10915 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
10916 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
10917 let datalen = v.len();
10918 let data = Box::into_raw(v.into_boxed_slice());
10919 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10923 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10924 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
10925 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
10926 fn drop(&mut self) {
10927 if self.datalen == 0 { return; }
10928 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10931 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
10932 fn clone(&self) -> Self {
10933 let mut res = Vec::new();
10934 if self.datalen == 0 { return Self::from(res); }
10935 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10940 /// A tuple of 2 elements. See the individual fields for the types contained.
10941 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10942 /// The element at position 0
10943 pub a: crate::c_types::ThirtyTwoBytes,
10944 /// The element at position 1
10945 pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
10947 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10948 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
10955 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10956 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
10960 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
10961 fn clone(&self) -> Self {
10963 a: Clone::clone(&self.a),
10964 b: Clone::clone(&self.b),
10969 /// Creates a new tuple which has the same data as `orig`
10970 /// but with all dynamically-allocated buffers duplicated in new buffers.
10971 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
10972 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
10974 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 {
10975 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
10979 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
10980 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
10982 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
10983 /// This corresponds to std::vector in C++
10984 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10985 /// The elements in the array.
10986 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10987 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
10988 /// The number of elements pointed to by `data`.
10991 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
10992 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
10993 if self.datalen == 0 { return Vec::new(); }
10994 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10995 self.data = core::ptr::null_mut();
10999 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
11000 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11003 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11004 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
11005 let datalen = v.len();
11006 let data = Box::into_raw(v.into_boxed_slice());
11007 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11011 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11012 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
11013 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11014 fn drop(&mut self) {
11015 if self.datalen == 0 { return; }
11016 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11019 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
11020 fn clone(&self) -> Self {
11021 let mut res = Vec::new();
11022 if self.datalen == 0 { return Self::from(res); }
11023 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11028 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
11029 /// This corresponds to std::vector in C++
11030 pub struct CVec_CommitmentTransactionZ {
11031 /// The elements in the array.
11032 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11033 pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
11034 /// The number of elements pointed to by `data`.
11037 impl CVec_CommitmentTransactionZ {
11038 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
11039 if self.datalen == 0 { return Vec::new(); }
11040 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11041 self.data = core::ptr::null_mut();
11045 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
11046 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11049 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
11050 fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
11051 let datalen = v.len();
11052 let data = Box::into_raw(v.into_boxed_slice());
11053 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11057 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11058 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
11059 impl Drop for CVec_CommitmentTransactionZ {
11060 fn drop(&mut self) {
11061 if self.datalen == 0 { return; }
11062 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11065 impl Clone for CVec_CommitmentTransactionZ {
11066 fn clone(&self) -> Self {
11067 let mut res = Vec::new();
11068 if self.datalen == 0 { return Self::from(res); }
11069 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11074 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11075 /// This corresponds to std::vector in C++
11076 pub struct CVec_TransactionZ {
11077 /// The elements in the array.
11078 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11079 pub data: *mut crate::c_types::Transaction,
11080 /// The number of elements pointed to by `data`.
11083 impl CVec_TransactionZ {
11084 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11085 if self.datalen == 0 { return Vec::new(); }
11086 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11087 self.data = core::ptr::null_mut();
11091 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11092 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11095 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11096 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11097 let datalen = v.len();
11098 let data = Box::into_raw(v.into_boxed_slice());
11099 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11103 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11104 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11105 impl Drop for CVec_TransactionZ {
11106 fn drop(&mut self) {
11107 if self.datalen == 0 { return; }
11108 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11111 impl Clone for CVec_TransactionZ {
11112 fn clone(&self) -> Self {
11113 let mut res = Vec::new();
11114 if self.datalen == 0 { return Self::from(res); }
11115 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11120 /// A tuple of 2 elements. See the individual fields for the types contained.
11121 pub struct C2Tuple_u32TxOutZ {
11122 /// The element at position 0
11124 /// The element at position 1
11125 pub b: crate::c_types::TxOut,
11127 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11128 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11135 impl C2Tuple_u32TxOutZ {
11136 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11140 impl Clone for C2Tuple_u32TxOutZ {
11141 fn clone(&self) -> Self {
11143 a: Clone::clone(&self.a),
11144 b: Clone::clone(&self.b),
11149 /// Creates a new tuple which has the same data as `orig`
11150 /// but with all dynamically-allocated buffers duplicated in new buffers.
11151 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11152 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11154 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11155 C2Tuple_u32TxOutZ { a, b, }
11159 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11160 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11162 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11163 /// This corresponds to std::vector in C++
11164 pub struct CVec_C2Tuple_u32TxOutZZ {
11165 /// The elements in the array.
11166 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11167 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11168 /// The number of elements pointed to by `data`.
11171 impl CVec_C2Tuple_u32TxOutZZ {
11172 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11173 if self.datalen == 0 { return Vec::new(); }
11174 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11175 self.data = core::ptr::null_mut();
11179 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11180 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11183 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11184 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11185 let datalen = v.len();
11186 let data = Box::into_raw(v.into_boxed_slice());
11187 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11191 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11192 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11193 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11194 fn drop(&mut self) {
11195 if self.datalen == 0 { return; }
11196 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11199 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11200 fn clone(&self) -> Self {
11201 let mut res = Vec::new();
11202 if self.datalen == 0 { return Self::from(res); }
11203 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11208 /// A tuple of 2 elements. See the individual fields for the types contained.
11209 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11210 /// The element at position 0
11211 pub a: crate::c_types::ThirtyTwoBytes,
11212 /// The element at position 1
11213 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11215 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11216 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11223 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11224 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11228 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
11229 fn clone(&self) -> Self {
11231 a: Clone::clone(&self.a),
11232 b: Clone::clone(&self.b),
11237 /// Creates a new tuple which has the same data as `orig`
11238 /// but with all dynamically-allocated buffers duplicated in new buffers.
11239 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11240 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11242 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 {
11243 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
11247 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
11248 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
11250 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11251 /// This corresponds to std::vector in C++
11252 pub struct CVec_TransactionOutputsZ {
11253 /// The elements in the array.
11254 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11255 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
11256 /// The number of elements pointed to by `data`.
11259 impl CVec_TransactionOutputsZ {
11260 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
11261 if self.datalen == 0 { return Vec::new(); }
11262 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11263 self.data = core::ptr::null_mut();
11267 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
11268 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11271 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11272 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11273 let datalen = v.len();
11274 let data = Box::into_raw(v.into_boxed_slice());
11275 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11279 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11280 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11281 impl Drop for CVec_TransactionOutputsZ {
11282 fn drop(&mut self) {
11283 if self.datalen == 0 { return; }
11284 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11287 impl Clone for CVec_TransactionOutputsZ {
11288 fn clone(&self) -> Self {
11289 let mut res = Vec::new();
11290 if self.datalen == 0 { return Self::from(res); }
11291 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11296 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11297 /// This corresponds to std::vector in C++
11298 pub struct CVec_BalanceZ {
11299 /// The elements in the array.
11300 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11301 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11302 /// The number of elements pointed to by `data`.
11305 impl CVec_BalanceZ {
11306 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11307 if self.datalen == 0 { return Vec::new(); }
11308 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11309 self.data = core::ptr::null_mut();
11313 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11314 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11317 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11318 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11319 let datalen = v.len();
11320 let data = Box::into_raw(v.into_boxed_slice());
11321 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11325 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11326 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11327 impl Drop for CVec_BalanceZ {
11328 fn drop(&mut self) {
11329 if self.datalen == 0 { return; }
11330 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11333 impl Clone for CVec_BalanceZ {
11334 fn clone(&self) -> Self {
11335 let mut res = Vec::new();
11336 if self.datalen == 0 { return Self::from(res); }
11337 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11342 /// A tuple of 2 elements. See the individual fields for the types contained.
11343 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11344 /// The element at position 0
11345 pub a: crate::c_types::ThirtyTwoBytes,
11346 /// The element at position 1
11347 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
11349 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11350 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
11357 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11358 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
11362 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11363 fn clone(&self) -> Self {
11365 a: Clone::clone(&self.a),
11366 b: Clone::clone(&self.b),
11371 /// Creates a new tuple which has the same data as `orig`
11372 /// but with all dynamically-allocated buffers duplicated in new buffers.
11373 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
11374 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
11376 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
11377 C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
11381 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
11382 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
11384 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
11385 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
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::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11395 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11398 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
11399 /// `err` or `result` depending on the state of `result_ok`.
11400 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
11401 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
11402 pub result_ok: bool,
11405 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
11406 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11407 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11408 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11409 result: Box::into_raw(Box::new(o)),
11415 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
11416 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11417 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11418 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
11430 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
11431 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
11432 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
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::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11446 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
11452 let err = unsafe { o.contents.err };
11453 unsafe { o.contents.err = core::ptr::null_mut(); }
11454 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
11458 result_ok: o.result_ok,
11462 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
11463 fn clone(&self) -> Self {
11464 if self.result_ok {
11465 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11466 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
11469 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
11470 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11476 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
11477 /// but with all dynamically-allocated buffers duplicated in new buffers.
11478 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
11480 /// A tuple of 2 elements. See the individual fields for the types contained.
11481 pub struct C2Tuple_PublicKeyTypeZ {
11482 /// The element at position 0
11483 pub a: crate::c_types::PublicKey,
11484 /// The element at position 1
11485 pub b: crate::lightning::ln::wire::Type,
11487 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11488 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11495 impl C2Tuple_PublicKeyTypeZ {
11496 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11500 impl Clone for C2Tuple_PublicKeyTypeZ {
11501 fn clone(&self) -> Self {
11503 a: Clone::clone(&self.a),
11504 b: Clone::clone(&self.b),
11509 /// Creates a new tuple which has the same data as `orig`
11510 /// but with all dynamically-allocated buffers duplicated in new buffers.
11511 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
11512 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11514 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11515 C2Tuple_PublicKeyTypeZ { a, b, }
11519 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11520 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11522 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11523 /// This corresponds to std::vector in C++
11524 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11525 /// The elements in the array.
11526 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11527 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11528 /// The number of elements pointed to by `data`.
11531 impl CVec_C2Tuple_PublicKeyTypeZZ {
11532 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11533 if self.datalen == 0 { return Vec::new(); }
11534 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11535 self.data = core::ptr::null_mut();
11539 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11540 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11543 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11544 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11545 let datalen = v.len();
11546 let data = Box::into_raw(v.into_boxed_slice());
11547 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11551 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11552 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11553 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11554 fn drop(&mut self) {
11555 if self.datalen == 0 { return; }
11556 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11559 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
11560 fn clone(&self) -> Self {
11561 let mut res = Vec::new();
11562 if self.datalen == 0 { return Self::from(res); }
11563 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11569 /// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
11570 pub enum COption_OnionMessageContentsZ {
11571 /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
11572 Some(crate::lightning::onion_message::packet::OnionMessageContents),
11573 /// When we're in this state, this COption_OnionMessageContentsZ contains nothing
11576 impl COption_OnionMessageContentsZ {
11577 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11578 if let Self::None = self { false } else { true }
11580 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11583 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents {
11584 if let Self::Some(v) = self { v } else { unreachable!() }
11588 /// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
11589 pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ {
11590 COption_OnionMessageContentsZ::Some(o)
11593 /// Constructs a new COption_OnionMessageContentsZ containing nothing
11594 pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ {
11595 COption_OnionMessageContentsZ::None
11598 /// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
11599 pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { }
11601 /// Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
11602 /// but with all dynamically-allocated buffers duplicated in new buffers.
11603 pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) }
11605 /// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
11606 pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
11607 /// A pointer to the contents in the success state.
11608 /// Reading from this pointer when `result_ok` is not set is undefined.
11609 pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ,
11610 /// A pointer to the contents in the error state.
11611 /// Reading from this pointer when `result_ok` is set is undefined.
11612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11615 /// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
11616 /// containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11618 pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ {
11619 /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
11620 /// `err` or `result` depending on the state of `result_ok`.
11621 pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr,
11622 /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
11623 pub result_ok: bool,
11626 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
11627 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
11628 CResult_COption_OnionMessageContentsZDecodeErrorZ {
11629 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
11630 result: Box::into_raw(Box::new(o)),
11636 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
11637 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
11638 CResult_COption_OnionMessageContentsZDecodeErrorZ {
11639 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
11640 err: Box::into_raw(Box::new(e)),
11645 /// Checks if the given object is currently in the success state
11647 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool {
11651 /// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
11652 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { }
11653 impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ {
11654 fn drop(&mut self) {
11655 if self.result_ok {
11656 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11657 let _ = unsafe { Box::from_raw(self.contents.result) };
11660 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11661 let _ = unsafe { Box::from_raw(self.contents.err) };
11666 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OnionMessageContentsZDecodeErrorZ {
11667 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11668 let contents = if o.result_ok {
11669 let result = unsafe { o.contents.result };
11670 unsafe { o.contents.result = core::ptr::null_mut() };
11671 CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result }
11673 let err = unsafe { o.contents.err };
11674 unsafe { o.contents.err = core::ptr::null_mut(); }
11675 CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err }
11679 result_ok: o.result_ok,
11683 impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ {
11684 fn clone(&self) -> Self {
11685 if self.result_ok {
11686 Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
11687 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
11690 Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
11691 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11697 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
11698 /// but with all dynamically-allocated buffers duplicated in new buffers.
11699 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
11701 /// A tuple of 3 elements. See the individual fields for the types contained.
11702 pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
11703 /// The element at position 0
11704 pub a: crate::lightning::onion_message::packet::OnionMessageContents,
11705 /// The element at position 1
11706 pub b: crate::lightning::onion_message::messenger::Destination,
11707 /// The element at position 2
11708 pub c: crate::lightning::blinded_path::BlindedPath,
11710 impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
11711 fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
11719 impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
11720 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
11721 (self.a, self.b, self.c)
11724 impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
11725 fn clone(&self) -> Self {
11727 a: Clone::clone(&self.a),
11728 b: Clone::clone(&self.b),
11729 c: Clone::clone(&self.c),
11734 /// Creates a new tuple which has the same data as `orig`
11735 /// but with all dynamically-allocated buffers duplicated in new buffers.
11736 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) }
11737 /// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
11739 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
11740 C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, }
11744 /// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
11745 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { }
11747 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
11748 /// This corresponds to std::vector in C++
11749 pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
11750 /// The elements in the array.
11751 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11752 pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ,
11753 /// The number of elements pointed to by `data`.
11756 impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
11757 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ> {
11758 if self.datalen == 0 { return Vec::new(); }
11759 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11760 self.data = core::ptr::null_mut();
11764 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] {
11765 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11768 impl From<Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
11769 fn from(v: Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>) -> Self {
11770 let datalen = v.len();
11771 let data = Box::into_raw(v.into_boxed_slice());
11772 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11776 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11777 pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { }
11778 impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
11779 fn drop(&mut self) {
11780 if self.datalen == 0 { return; }
11781 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11784 impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
11785 fn clone(&self) -> Self {
11786 let mut res = Vec::new();
11787 if self.datalen == 0 { return Self::from(res); }
11788 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11794 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
11795 pub enum COption_TypeZ {
11796 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
11797 Some(crate::lightning::ln::wire::Type),
11798 /// When we're in this state, this COption_TypeZ contains nothing
11801 impl COption_TypeZ {
11802 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11803 if let Self::None = self { false } else { true }
11805 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11808 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
11809 if let Self::Some(v) = self { v } else { unreachable!() }
11813 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
11814 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
11815 COption_TypeZ::Some(o)
11818 /// Constructs a new COption_TypeZ containing nothing
11819 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
11820 COption_TypeZ::None
11823 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
11824 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
11826 /// Creates a new COption_TypeZ which has the same data as `orig`
11827 /// but with all dynamically-allocated buffers duplicated in new buffers.
11828 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
11830 /// The contents of CResult_COption_TypeZDecodeErrorZ
11831 pub union CResult_COption_TypeZDecodeErrorZPtr {
11832 /// A pointer to the contents in the success state.
11833 /// Reading from this pointer when `result_ok` is not set is undefined.
11834 pub result: *mut crate::c_types::derived::COption_TypeZ,
11835 /// A pointer to the contents in the error state.
11836 /// Reading from this pointer when `result_ok` is set is undefined.
11837 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11840 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
11841 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11842 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11843 pub struct CResult_COption_TypeZDecodeErrorZ {
11844 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
11845 /// `err` or `result` depending on the state of `result_ok`.
11846 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
11847 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
11848 pub result_ok: bool,
11851 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
11852 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
11853 CResult_COption_TypeZDecodeErrorZ {
11854 contents: CResult_COption_TypeZDecodeErrorZPtr {
11855 result: Box::into_raw(Box::new(o)),
11861 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
11862 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
11863 CResult_COption_TypeZDecodeErrorZ {
11864 contents: CResult_COption_TypeZDecodeErrorZPtr {
11865 err: Box::into_raw(Box::new(e)),
11870 /// Checks if the given object is currently in the success state
11872 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
11876 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
11877 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
11878 impl Drop for CResult_COption_TypeZDecodeErrorZ {
11879 fn drop(&mut self) {
11880 if self.result_ok {
11881 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11882 let _ = unsafe { Box::from_raw(self.contents.result) };
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::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
11892 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11893 let contents = if o.result_ok {
11894 let result = unsafe { o.contents.result };
11895 unsafe { o.contents.result = core::ptr::null_mut() };
11896 CResult_COption_TypeZDecodeErrorZPtr { result }
11898 let err = unsafe { o.contents.err };
11899 unsafe { o.contents.err = core::ptr::null_mut(); }
11900 CResult_COption_TypeZDecodeErrorZPtr { err }
11904 result_ok: o.result_ok,
11908 impl Clone for CResult_COption_TypeZDecodeErrorZ {
11909 fn clone(&self) -> Self {
11910 if self.result_ok {
11911 Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
11912 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
11915 Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
11916 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11922 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
11923 /// but with all dynamically-allocated buffers duplicated in new buffers.
11924 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
11927 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
11928 pub enum COption_SocketAddressZ {
11929 /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
11930 Some(crate::lightning::ln::msgs::SocketAddress),
11931 /// When we're in this state, this COption_SocketAddressZ contains nothing
11934 impl COption_SocketAddressZ {
11935 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11936 if let Self::None = self { false } else { true }
11938 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11941 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
11942 if let Self::Some(v) = self { v } else { unreachable!() }
11946 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
11947 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
11948 COption_SocketAddressZ::Some(o)
11951 /// Constructs a new COption_SocketAddressZ containing nothing
11952 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
11953 COption_SocketAddressZ::None
11956 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
11957 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
11959 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
11960 /// but with all dynamically-allocated buffers duplicated in new buffers.
11961 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
11963 /// A tuple of 2 elements. See the individual fields for the types contained.
11964 pub struct C2Tuple_PublicKeyCOption_SocketAddressZZ {
11965 /// The element at position 0
11966 pub a: crate::c_types::PublicKey,
11967 /// The element at position 1
11968 pub b: crate::c_types::derived::COption_SocketAddressZ,
11970 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)> for C2Tuple_PublicKeyCOption_SocketAddressZZ {
11971 fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)) -> Self {
11978 impl C2Tuple_PublicKeyCOption_SocketAddressZZ {
11979 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ) {
11983 impl Clone for C2Tuple_PublicKeyCOption_SocketAddressZZ {
11984 fn clone(&self) -> Self {
11986 a: Clone::clone(&self.a),
11987 b: Clone::clone(&self.b),
11992 /// Creates a new tuple which has the same data as `orig`
11993 /// but with all dynamically-allocated buffers duplicated in new buffers.
11994 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_SocketAddressZZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ { Clone::clone(&orig) }
11995 /// Creates a new C2Tuple_PublicKeyCOption_SocketAddressZZ from the contained elements.
11997 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_SocketAddressZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ {
11998 C2Tuple_PublicKeyCOption_SocketAddressZZ { a, b, }
12002 /// Frees any resources used by the C2Tuple_PublicKeyCOption_SocketAddressZZ.
12003 pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCOption_SocketAddressZZ) { }
12005 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZs of arbitrary size.
12006 /// This corresponds to std::vector in C++
12007 pub struct CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12008 /// The elements in the array.
12009 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12010 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ,
12011 /// The number of elements pointed to by `data`.
12014 impl CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12015 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ> {
12016 if self.datalen == 0 { return Vec::new(); }
12017 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12018 self.data = core::ptr::null_mut();
12022 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ] {
12023 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12026 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12027 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ>) -> Self {
12028 let datalen = v.len();
12029 let data = Box::into_raw(v.into_boxed_slice());
12030 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12034 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12035 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ) { }
12036 impl Drop for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12037 fn drop(&mut self) {
12038 if self.datalen == 0 { return; }
12039 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12042 impl Clone for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ {
12043 fn clone(&self) -> Self {
12044 let mut res = Vec::new();
12045 if self.datalen == 0 { return Self::from(res); }
12046 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12051 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12052 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12053 /// A pointer to the contents in the success state.
12054 /// Reading from this pointer when `result_ok` is not set is undefined.
12055 pub result: *mut crate::c_types::derived::CVec_u8Z,
12056 /// A pointer to the contents in the error state.
12057 /// Reading from this pointer when `result_ok` is set is undefined.
12058 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12061 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12062 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12063 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12064 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12065 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12066 /// `err` or `result` depending on the state of `result_ok`.
12067 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12068 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12069 pub result_ok: bool,
12072 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12073 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12074 CResult_CVec_u8ZPeerHandleErrorZ {
12075 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12076 result: Box::into_raw(Box::new(o)),
12082 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12083 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12084 CResult_CVec_u8ZPeerHandleErrorZ {
12085 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12086 err: Box::into_raw(Box::new(e)),
12091 /// Checks if the given object is currently in the success state
12093 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12097 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12098 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12099 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12100 fn drop(&mut self) {
12101 if self.result_ok {
12102 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12103 let _ = unsafe { Box::from_raw(self.contents.result) };
12106 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12107 let _ = unsafe { Box::from_raw(self.contents.err) };
12112 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12113 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12114 let contents = if o.result_ok {
12115 let result = unsafe { o.contents.result };
12116 unsafe { o.contents.result = core::ptr::null_mut() };
12117 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12119 let err = unsafe { o.contents.err };
12120 unsafe { o.contents.err = core::ptr::null_mut(); }
12121 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12125 result_ok: o.result_ok,
12129 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12130 fn clone(&self) -> Self {
12131 if self.result_ok {
12132 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12133 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12136 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12137 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12143 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12144 /// but with all dynamically-allocated buffers duplicated in new buffers.
12145 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12147 /// The contents of CResult_NonePeerHandleErrorZ
12148 pub union CResult_NonePeerHandleErrorZPtr {
12149 /// Note that this value is always NULL, as there are no contents in the OK variant
12150 pub result: *mut core::ffi::c_void,
12151 /// A pointer to the contents in the error state.
12152 /// Reading from this pointer when `result_ok` is set is undefined.
12153 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12156 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12157 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12158 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12159 pub struct CResult_NonePeerHandleErrorZ {
12160 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12161 /// `err` or `result` depending on the state of `result_ok`.
12162 pub contents: CResult_NonePeerHandleErrorZPtr,
12163 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12164 pub result_ok: bool,
12167 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12168 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12169 CResult_NonePeerHandleErrorZ {
12170 contents: CResult_NonePeerHandleErrorZPtr {
12171 result: core::ptr::null_mut(),
12177 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12178 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12179 CResult_NonePeerHandleErrorZ {
12180 contents: CResult_NonePeerHandleErrorZPtr {
12181 err: Box::into_raw(Box::new(e)),
12186 /// Checks if the given object is currently in the success state
12188 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12192 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12193 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12194 impl Drop for CResult_NonePeerHandleErrorZ {
12195 fn drop(&mut self) {
12196 if self.result_ok {
12198 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12199 let _ = unsafe { Box::from_raw(self.contents.err) };
12204 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12205 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12206 let contents = if o.result_ok {
12207 let _ = unsafe { Box::from_raw(o.contents.result) };
12208 o.contents.result = core::ptr::null_mut();
12209 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12211 let err = unsafe { o.contents.err };
12212 unsafe { o.contents.err = core::ptr::null_mut(); }
12213 CResult_NonePeerHandleErrorZPtr { err }
12217 result_ok: o.result_ok,
12221 impl Clone for CResult_NonePeerHandleErrorZ {
12222 fn clone(&self) -> Self {
12223 if self.result_ok {
12224 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12225 result: core::ptr::null_mut()
12228 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12229 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12235 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12236 /// but with all dynamically-allocated buffers duplicated in new buffers.
12237 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12239 /// The contents of CResult_boolPeerHandleErrorZ
12240 pub union CResult_boolPeerHandleErrorZPtr {
12241 /// A pointer to the contents in the success state.
12242 /// Reading from this pointer when `result_ok` is not set is undefined.
12243 pub result: *mut bool,
12244 /// A pointer to the contents in the error state.
12245 /// Reading from this pointer when `result_ok` is set is undefined.
12246 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12249 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12250 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12252 pub struct CResult_boolPeerHandleErrorZ {
12253 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12254 /// `err` or `result` depending on the state of `result_ok`.
12255 pub contents: CResult_boolPeerHandleErrorZPtr,
12256 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12257 pub result_ok: bool,
12260 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12261 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12262 CResult_boolPeerHandleErrorZ {
12263 contents: CResult_boolPeerHandleErrorZPtr {
12264 result: Box::into_raw(Box::new(o)),
12270 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12271 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12272 CResult_boolPeerHandleErrorZ {
12273 contents: CResult_boolPeerHandleErrorZPtr {
12274 err: Box::into_raw(Box::new(e)),
12279 /// Checks if the given object is currently in the success state
12281 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12285 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12286 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12287 impl Drop for CResult_boolPeerHandleErrorZ {
12288 fn drop(&mut self) {
12289 if self.result_ok {
12290 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12291 let _ = unsafe { Box::from_raw(self.contents.result) };
12294 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12295 let _ = unsafe { Box::from_raw(self.contents.err) };
12300 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12301 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12302 let contents = if o.result_ok {
12303 let result = unsafe { o.contents.result };
12304 unsafe { o.contents.result = core::ptr::null_mut() };
12305 CResult_boolPeerHandleErrorZPtr { result }
12307 let err = unsafe { o.contents.err };
12308 unsafe { o.contents.err = core::ptr::null_mut(); }
12309 CResult_boolPeerHandleErrorZPtr { err }
12313 result_ok: o.result_ok,
12317 impl Clone for CResult_boolPeerHandleErrorZ {
12318 fn clone(&self) -> Self {
12319 if self.result_ok {
12320 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12321 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12324 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12325 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12331 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12332 /// but with all dynamically-allocated buffers duplicated in new buffers.
12333 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12335 /// The contents of CResult_u32GraphSyncErrorZ
12336 pub union CResult_u32GraphSyncErrorZPtr {
12337 /// A pointer to the contents in the success state.
12338 /// Reading from this pointer when `result_ok` is not set is undefined.
12339 pub result: *mut u32,
12340 /// A pointer to the contents in the error state.
12341 /// Reading from this pointer when `result_ok` is set is undefined.
12342 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12345 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12346 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12348 pub struct CResult_u32GraphSyncErrorZ {
12349 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12350 /// `err` or `result` depending on the state of `result_ok`.
12351 pub contents: CResult_u32GraphSyncErrorZPtr,
12352 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12353 pub result_ok: bool,
12356 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12357 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12358 CResult_u32GraphSyncErrorZ {
12359 contents: CResult_u32GraphSyncErrorZPtr {
12360 result: Box::into_raw(Box::new(o)),
12366 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12367 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12368 CResult_u32GraphSyncErrorZ {
12369 contents: CResult_u32GraphSyncErrorZPtr {
12370 err: Box::into_raw(Box::new(e)),
12375 /// Checks if the given object is currently in the success state
12377 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12381 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12382 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12383 impl Drop for CResult_u32GraphSyncErrorZ {
12384 fn drop(&mut self) {
12385 if self.result_ok {
12386 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12387 let _ = unsafe { Box::from_raw(self.contents.result) };
12390 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12391 let _ = unsafe { Box::from_raw(self.contents.err) };
12396 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12397 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12398 let contents = if o.result_ok {
12399 let result = unsafe { o.contents.result };
12400 unsafe { o.contents.result = core::ptr::null_mut() };
12401 CResult_u32GraphSyncErrorZPtr { result }
12403 let err = unsafe { o.contents.err };
12404 unsafe { o.contents.err = core::ptr::null_mut(); }
12405 CResult_u32GraphSyncErrorZPtr { err }
12409 result_ok: o.result_ok,
12414 /// The contents of CResult_CVec_u8ZIOErrorZ
12415 pub union CResult_CVec_u8ZIOErrorZPtr {
12416 /// A pointer to the contents in the success state.
12417 /// Reading from this pointer when `result_ok` is not set is undefined.
12418 pub result: *mut crate::c_types::derived::CVec_u8Z,
12419 /// A pointer to the contents in the error state.
12420 /// Reading from this pointer when `result_ok` is set is undefined.
12421 pub err: *mut crate::c_types::IOError,
12424 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
12425 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
12426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12427 pub struct CResult_CVec_u8ZIOErrorZ {
12428 /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
12429 /// `err` or `result` depending on the state of `result_ok`.
12430 pub contents: CResult_CVec_u8ZIOErrorZPtr,
12431 /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
12432 pub result_ok: bool,
12435 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
12436 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
12437 CResult_CVec_u8ZIOErrorZ {
12438 contents: CResult_CVec_u8ZIOErrorZPtr {
12439 result: Box::into_raw(Box::new(o)),
12445 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
12446 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
12447 CResult_CVec_u8ZIOErrorZ {
12448 contents: CResult_CVec_u8ZIOErrorZPtr {
12449 err: Box::into_raw(Box::new(e)),
12454 /// Checks if the given object is currently in the success state
12456 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
12460 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
12461 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
12462 impl Drop for CResult_CVec_u8ZIOErrorZ {
12463 fn drop(&mut self) {
12464 if self.result_ok {
12465 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12466 let _ = unsafe { Box::from_raw(self.contents.result) };
12469 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12470 let _ = unsafe { Box::from_raw(self.contents.err) };
12475 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
12476 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
12477 let contents = if o.result_ok {
12478 let result = unsafe { o.contents.result };
12479 unsafe { o.contents.result = core::ptr::null_mut() };
12480 CResult_CVec_u8ZIOErrorZPtr { result }
12482 let err = unsafe { o.contents.err };
12483 unsafe { o.contents.err = core::ptr::null_mut(); }
12484 CResult_CVec_u8ZIOErrorZPtr { err }
12488 result_ok: o.result_ok,
12492 impl Clone for CResult_CVec_u8ZIOErrorZ {
12493 fn clone(&self) -> Self {
12494 if self.result_ok {
12495 Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
12496 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12499 Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
12500 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12506 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
12507 /// but with all dynamically-allocated buffers duplicated in new buffers.
12508 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
12510 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
12511 /// This corresponds to std::vector in C++
12512 pub struct CVec_StrZ {
12513 /// The elements in the array.
12514 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12515 pub data: *mut crate::c_types::Str,
12516 /// The number of elements pointed to by `data`.
12520 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
12521 if self.datalen == 0 { return Vec::new(); }
12522 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12523 self.data = core::ptr::null_mut();
12527 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
12528 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12531 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
12532 fn from(v: Vec<crate::c_types::Str>) -> Self {
12533 let datalen = v.len();
12534 let data = Box::into_raw(v.into_boxed_slice());
12535 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12539 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12540 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
12541 impl Drop for CVec_StrZ {
12542 fn drop(&mut self) {
12543 if self.datalen == 0 { return; }
12544 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12547 impl Clone for CVec_StrZ {
12548 fn clone(&self) -> Self {
12549 let mut res = Vec::new();
12550 if self.datalen == 0 { return Self::from(res); }
12551 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12556 /// The contents of CResult_CVec_StrZIOErrorZ
12557 pub union CResult_CVec_StrZIOErrorZPtr {
12558 /// A pointer to the contents in the success state.
12559 /// Reading from this pointer when `result_ok` is not set is undefined.
12560 pub result: *mut crate::c_types::derived::CVec_StrZ,
12561 /// A pointer to the contents in the error state.
12562 /// Reading from this pointer when `result_ok` is set is undefined.
12563 pub err: *mut crate::c_types::IOError,
12566 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
12567 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
12568 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12569 pub struct CResult_CVec_StrZIOErrorZ {
12570 /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
12571 /// `err` or `result` depending on the state of `result_ok`.
12572 pub contents: CResult_CVec_StrZIOErrorZPtr,
12573 /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
12574 pub result_ok: bool,
12577 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
12578 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
12579 CResult_CVec_StrZIOErrorZ {
12580 contents: CResult_CVec_StrZIOErrorZPtr {
12581 result: Box::into_raw(Box::new(o)),
12587 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
12588 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
12589 CResult_CVec_StrZIOErrorZ {
12590 contents: CResult_CVec_StrZIOErrorZPtr {
12591 err: Box::into_raw(Box::new(e)),
12596 /// Checks if the given object is currently in the success state
12598 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
12602 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
12603 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
12604 impl Drop for CResult_CVec_StrZIOErrorZ {
12605 fn drop(&mut self) {
12606 if self.result_ok {
12607 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12608 let _ = unsafe { Box::from_raw(self.contents.result) };
12611 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12612 let _ = unsafe { Box::from_raw(self.contents.err) };
12617 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
12618 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
12619 let contents = if o.result_ok {
12620 let result = unsafe { o.contents.result };
12621 unsafe { o.contents.result = core::ptr::null_mut() };
12622 CResult_CVec_StrZIOErrorZPtr { result }
12624 let err = unsafe { o.contents.err };
12625 unsafe { o.contents.err = core::ptr::null_mut(); }
12626 CResult_CVec_StrZIOErrorZPtr { err }
12630 result_ok: o.result_ok,
12634 impl Clone for CResult_CVec_StrZIOErrorZ {
12635 fn clone(&self) -> Self {
12636 if self.result_ok {
12637 Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
12638 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
12641 Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
12642 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12648 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
12649 /// but with all dynamically-allocated buffers duplicated in new buffers.
12650 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
12652 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
12653 /// This corresponds to std::vector in C++
12654 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12655 /// The elements in the array.
12656 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12657 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12658 /// The number of elements pointed to by `data`.
12661 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12662 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
12663 if self.datalen == 0 { return Vec::new(); }
12664 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12665 self.data = core::ptr::null_mut();
12669 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
12670 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12673 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12674 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
12675 let datalen = v.len();
12676 let data = Box::into_raw(v.into_boxed_slice());
12677 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12681 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12682 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
12683 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12684 fn drop(&mut self) {
12685 if self.datalen == 0 { return; }
12686 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12689 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
12690 fn clone(&self) -> Self {
12691 let mut res = Vec::new();
12692 if self.datalen == 0 { return Self::from(res); }
12693 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12698 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
12699 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12700 /// A pointer to the contents in the success state.
12701 /// Reading from this pointer when `result_ok` is not set is undefined.
12702 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
12703 /// A pointer to the contents in the error state.
12704 /// Reading from this pointer when `result_ok` is set is undefined.
12705 pub err: *mut crate::c_types::IOError,
12708 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
12709 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
12710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12711 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12712 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
12713 /// `err` or `result` depending on the state of `result_ok`.
12714 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
12715 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
12716 pub result_ok: bool,
12719 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
12720 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12721 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12722 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12723 result: Box::into_raw(Box::new(o)),
12729 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
12730 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12731 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12732 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12733 err: Box::into_raw(Box::new(e)),
12738 /// Checks if the given object is currently in the success state
12740 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
12744 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
12745 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
12746 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12747 fn drop(&mut self) {
12748 if self.result_ok {
12749 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12750 let _ = unsafe { Box::from_raw(self.contents.result) };
12753 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12754 let _ = unsafe { Box::from_raw(self.contents.err) };
12759 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12760 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> Self {
12761 let contents = if o.result_ok {
12762 let result = unsafe { o.contents.result };
12763 unsafe { o.contents.result = core::ptr::null_mut() };
12764 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
12766 let err = unsafe { o.contents.err };
12767 unsafe { o.contents.err = core::ptr::null_mut(); }
12768 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
12772 result_ok: o.result_ok,
12776 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
12777 fn clone(&self) -> Self {
12778 if self.result_ok {
12779 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12780 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
12783 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
12784 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12790 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
12791 /// but with all dynamically-allocated buffers duplicated in new buffers.
12792 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
12794 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
12795 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12796 /// A pointer to the contents in the success state.
12797 /// Reading from this pointer when `result_ok` is not set is undefined.
12798 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12799 /// A pointer to the contents in the error state.
12800 /// Reading from this pointer when `result_ok` is set is undefined.
12801 pub err: *mut crate::c_types::IOError,
12804 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
12805 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
12806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12807 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12808 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
12809 /// `err` or `result` depending on the state of `result_ok`.
12810 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
12811 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
12812 pub result_ok: bool,
12815 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
12816 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12817 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12818 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12819 result: Box::into_raw(Box::new(o)),
12825 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
12826 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12827 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12828 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12829 err: Box::into_raw(Box::new(e)),
12834 /// Checks if the given object is currently in the success state
12836 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
12840 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
12841 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
12842 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12843 fn drop(&mut self) {
12844 if self.result_ok {
12845 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12846 let _ = unsafe { Box::from_raw(self.contents.result) };
12849 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12850 let _ = unsafe { Box::from_raw(self.contents.err) };
12855 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12856 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
12857 let contents = if o.result_ok {
12858 let result = unsafe { o.contents.result };
12859 unsafe { o.contents.result = core::ptr::null_mut() };
12860 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
12862 let err = unsafe { o.contents.err };
12863 unsafe { o.contents.err = core::ptr::null_mut(); }
12864 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
12868 result_ok: o.result_ok,
12872 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
12873 fn clone(&self) -> Self {
12874 if self.result_ok {
12875 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12876 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
12879 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
12880 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
12886 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
12887 /// but with all dynamically-allocated buffers duplicated in new buffers.
12888 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
12891 /// An enum which can either contain a crate::c_types::SecretKey or not
12892 pub enum COption_SecretKeyZ {
12893 /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
12894 Some(crate::c_types::SecretKey),
12895 /// When we're in this state, this COption_SecretKeyZ contains nothing
12898 impl COption_SecretKeyZ {
12899 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12900 if let Self::None = self { false } else { true }
12902 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12905 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
12906 if let Self::Some(v) = self { v } else { unreachable!() }
12910 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
12911 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
12912 COption_SecretKeyZ::Some(o)
12915 /// Constructs a new COption_SecretKeyZ containing nothing
12916 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
12917 COption_SecretKeyZ::None
12920 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
12921 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
12923 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
12924 /// but with all dynamically-allocated buffers duplicated in new buffers.
12925 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
12927 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
12928 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
12929 /// A pointer to the contents in the success state.
12930 /// Reading from this pointer when `result_ok` is not set is undefined.
12931 pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
12932 /// Note that this value is always NULL, as there are no contents in the Err variant
12933 pub err: *mut core::ffi::c_void,
12936 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
12937 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
12938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12939 pub struct CResult_VerifiedInvoiceRequestNoneZ {
12940 /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
12941 /// `err` or `result` depending on the state of `result_ok`.
12942 pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
12943 /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
12944 pub result_ok: bool,
12947 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
12948 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
12949 CResult_VerifiedInvoiceRequestNoneZ {
12950 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12951 result: Box::into_raw(Box::new(o)),
12957 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
12958 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
12959 CResult_VerifiedInvoiceRequestNoneZ {
12960 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
12961 err: core::ptr::null_mut(),
12966 /// Checks if the given object is currently in the success state
12968 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
12972 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
12973 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
12974 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
12975 fn drop(&mut self) {
12976 if self.result_ok {
12977 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12978 let _ = unsafe { Box::from_raw(self.contents.result) };
12984 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
12985 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
12986 let contents = if o.result_ok {
12987 let result = unsafe { o.contents.result };
12988 unsafe { o.contents.result = core::ptr::null_mut() };
12989 CResult_VerifiedInvoiceRequestNoneZPtr { result }
12991 let _ = unsafe { Box::from_raw(o.contents.err) };
12992 o.contents.err = core::ptr::null_mut();
12993 CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
12997 result_ok: o.result_ok,
13001 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
13002 fn clone(&self) -> Self {
13003 if self.result_ok {
13004 Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13005 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
13008 Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
13009 err: core::ptr::null_mut()
13015 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
13016 /// but with all dynamically-allocated buffers duplicated in new buffers.
13017 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
13019 /// An enum which can either contain a or not
13020 pub enum COption_NoneZ {
13021 /// When we're in this state, this COption_NoneZ contains a
13023 /// When we're in this state, this COption_NoneZ contains nothing
13026 impl COption_NoneZ {
13027 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13028 if let Self::None = self { false } else { true }
13030 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13035 /// Constructs a new COption_NoneZ containing a
13036 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
13037 COption_NoneZ::Some
13040 /// Constructs a new COption_NoneZ containing nothing
13041 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
13042 COption_NoneZ::None
13045 /// Frees any resources associated with the , if we are in the Some state
13046 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
13048 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
13049 /// This corresponds to std::vector in C++
13050 pub struct CVec_WitnessZ {
13051 /// The elements in the array.
13052 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13053 pub data: *mut crate::c_types::Witness,
13054 /// The number of elements pointed to by `data`.
13057 impl CVec_WitnessZ {
13058 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
13059 if self.datalen == 0 { return Vec::new(); }
13060 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13061 self.data = core::ptr::null_mut();
13065 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
13066 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13069 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
13070 fn from(v: Vec<crate::c_types::Witness>) -> Self {
13071 let datalen = v.len();
13072 let data = Box::into_raw(v.into_boxed_slice());
13073 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13077 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13078 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
13079 impl Drop for CVec_WitnessZ {
13080 fn drop(&mut self) {
13081 if self.datalen == 0 { return; }
13082 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13085 impl Clone for CVec_WitnessZ {
13086 fn clone(&self) -> Self {
13087 let mut res = Vec::new();
13088 if self.datalen == 0 { return Self::from(res); }
13089 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13095 /// An enum which can either contain a i64 or not
13096 pub enum COption_i64Z {
13097 /// When we're in this state, this COption_i64Z contains a i64
13099 /// When we're in this state, this COption_i64Z contains nothing
13102 impl COption_i64Z {
13103 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13104 if let Self::None = self { false } else { true }
13106 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13109 #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
13110 if let Self::Some(v) = self { v } else { unreachable!() }
13114 /// Constructs a new COption_i64Z containing a i64
13115 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
13116 COption_i64Z::Some(o)
13119 /// Constructs a new COption_i64Z containing nothing
13120 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
13124 /// Frees any resources associated with the i64, if we are in the Some state
13125 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
13127 /// Creates a new COption_i64Z which has the same data as `orig`
13128 /// but with all dynamically-allocated buffers duplicated in new buffers.
13129 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
13131 /// The contents of CResult_SocketAddressDecodeErrorZ
13132 pub union CResult_SocketAddressDecodeErrorZPtr {
13133 /// A pointer to the contents in the success state.
13134 /// Reading from this pointer when `result_ok` is not set is undefined.
13135 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
13136 /// A pointer to the contents in the error state.
13137 /// Reading from this pointer when `result_ok` is set is undefined.
13138 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13141 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
13142 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
13143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13144 pub struct CResult_SocketAddressDecodeErrorZ {
13145 /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
13146 /// `err` or `result` depending on the state of `result_ok`.
13147 pub contents: CResult_SocketAddressDecodeErrorZPtr,
13148 /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
13149 pub result_ok: bool,
13152 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
13153 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
13154 CResult_SocketAddressDecodeErrorZ {
13155 contents: CResult_SocketAddressDecodeErrorZPtr {
13156 result: Box::into_raw(Box::new(o)),
13162 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
13163 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
13164 CResult_SocketAddressDecodeErrorZ {
13165 contents: CResult_SocketAddressDecodeErrorZPtr {
13166 err: Box::into_raw(Box::new(e)),
13171 /// Checks if the given object is currently in the success state
13173 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
13177 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
13178 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
13179 impl Drop for CResult_SocketAddressDecodeErrorZ {
13180 fn drop(&mut self) {
13181 if self.result_ok {
13182 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13183 let _ = unsafe { Box::from_raw(self.contents.result) };
13186 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13187 let _ = unsafe { Box::from_raw(self.contents.err) };
13192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
13193 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
13194 let contents = if o.result_ok {
13195 let result = unsafe { o.contents.result };
13196 unsafe { o.contents.result = core::ptr::null_mut() };
13197 CResult_SocketAddressDecodeErrorZPtr { result }
13199 let err = unsafe { o.contents.err };
13200 unsafe { o.contents.err = core::ptr::null_mut(); }
13201 CResult_SocketAddressDecodeErrorZPtr { err }
13205 result_ok: o.result_ok,
13209 impl Clone for CResult_SocketAddressDecodeErrorZ {
13210 fn clone(&self) -> Self {
13211 if self.result_ok {
13212 Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
13213 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
13216 Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
13217 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13223 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
13224 /// but with all dynamically-allocated buffers duplicated in new buffers.
13225 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
13227 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
13228 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
13229 /// A pointer to the contents in the success state.
13230 /// Reading from this pointer when `result_ok` is not set is undefined.
13231 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
13232 /// A pointer to the contents in the error state.
13233 /// Reading from this pointer when `result_ok` is set is undefined.
13234 pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
13237 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
13238 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
13239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13240 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
13241 /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
13242 /// `err` or `result` depending on the state of `result_ok`.
13243 pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
13244 /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
13245 pub result_ok: bool,
13248 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
13249 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
13250 CResult_SocketAddressSocketAddressParseErrorZ {
13251 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
13252 result: Box::into_raw(Box::new(o)),
13258 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
13259 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
13260 CResult_SocketAddressSocketAddressParseErrorZ {
13261 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
13262 err: Box::into_raw(Box::new(e)),
13267 /// Checks if the given object is currently in the success state
13269 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
13273 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
13274 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
13275 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
13276 fn drop(&mut self) {
13277 if self.result_ok {
13278 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13279 let _ = unsafe { Box::from_raw(self.contents.result) };
13282 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13283 let _ = unsafe { Box::from_raw(self.contents.err) };
13288 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
13289 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
13290 let contents = if o.result_ok {
13291 let result = unsafe { o.contents.result };
13292 unsafe { o.contents.result = core::ptr::null_mut() };
13293 CResult_SocketAddressSocketAddressParseErrorZPtr { result }
13295 let err = unsafe { o.contents.err };
13296 unsafe { o.contents.err = core::ptr::null_mut(); }
13297 CResult_SocketAddressSocketAddressParseErrorZPtr { err }
13301 result_ok: o.result_ok,
13305 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
13306 fn clone(&self) -> Self {
13307 if self.result_ok {
13308 Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
13309 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
13312 Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
13313 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
13319 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
13320 /// but with all dynamically-allocated buffers duplicated in new buffers.
13321 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
13323 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
13324 /// This corresponds to std::vector in C++
13325 pub struct CVec_UpdateAddHTLCZ {
13326 /// The elements in the array.
13327 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13328 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13329 /// The number of elements pointed to by `data`.
13332 impl CVec_UpdateAddHTLCZ {
13333 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
13334 if self.datalen == 0 { return Vec::new(); }
13335 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13336 self.data = core::ptr::null_mut();
13340 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
13341 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13344 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
13345 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
13346 let datalen = v.len();
13347 let data = Box::into_raw(v.into_boxed_slice());
13348 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13352 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13353 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
13354 impl Drop for CVec_UpdateAddHTLCZ {
13355 fn drop(&mut self) {
13356 if self.datalen == 0 { return; }
13357 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13360 impl Clone for CVec_UpdateAddHTLCZ {
13361 fn clone(&self) -> Self {
13362 let mut res = Vec::new();
13363 if self.datalen == 0 { return Self::from(res); }
13364 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13369 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
13370 /// This corresponds to std::vector in C++
13371 pub struct CVec_UpdateFulfillHTLCZ {
13372 /// The elements in the array.
13373 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13374 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13375 /// The number of elements pointed to by `data`.
13378 impl CVec_UpdateFulfillHTLCZ {
13379 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
13380 if self.datalen == 0 { return Vec::new(); }
13381 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13382 self.data = core::ptr::null_mut();
13386 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
13387 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13390 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
13391 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
13392 let datalen = v.len();
13393 let data = Box::into_raw(v.into_boxed_slice());
13394 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13398 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13399 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
13400 impl Drop for CVec_UpdateFulfillHTLCZ {
13401 fn drop(&mut self) {
13402 if self.datalen == 0 { return; }
13403 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13406 impl Clone for CVec_UpdateFulfillHTLCZ {
13407 fn clone(&self) -> Self {
13408 let mut res = Vec::new();
13409 if self.datalen == 0 { return Self::from(res); }
13410 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13415 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
13416 /// This corresponds to std::vector in C++
13417 pub struct CVec_UpdateFailHTLCZ {
13418 /// The elements in the array.
13419 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13420 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13421 /// The number of elements pointed to by `data`.
13424 impl CVec_UpdateFailHTLCZ {
13425 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
13426 if self.datalen == 0 { return Vec::new(); }
13427 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13428 self.data = core::ptr::null_mut();
13432 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
13433 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13436 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
13437 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
13438 let datalen = v.len();
13439 let data = Box::into_raw(v.into_boxed_slice());
13440 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13444 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13445 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
13446 impl Drop for CVec_UpdateFailHTLCZ {
13447 fn drop(&mut self) {
13448 if self.datalen == 0 { return; }
13449 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13452 impl Clone for CVec_UpdateFailHTLCZ {
13453 fn clone(&self) -> Self {
13454 let mut res = Vec::new();
13455 if self.datalen == 0 { return Self::from(res); }
13456 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13461 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
13462 /// This corresponds to std::vector in C++
13463 pub struct CVec_UpdateFailMalformedHTLCZ {
13464 /// The elements in the array.
13465 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13466 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13467 /// The number of elements pointed to by `data`.
13470 impl CVec_UpdateFailMalformedHTLCZ {
13471 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
13472 if self.datalen == 0 { return Vec::new(); }
13473 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13474 self.data = core::ptr::null_mut();
13478 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
13479 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13482 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
13483 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
13484 let datalen = v.len();
13485 let data = Box::into_raw(v.into_boxed_slice());
13486 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13490 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13491 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
13492 impl Drop for CVec_UpdateFailMalformedHTLCZ {
13493 fn drop(&mut self) {
13494 if self.datalen == 0 { return; }
13495 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13498 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13499 fn clone(&self) -> Self {
13500 let mut res = Vec::new();
13501 if self.datalen == 0 { return Self::from(res); }
13502 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13507 /// The contents of CResult_AcceptChannelDecodeErrorZ
13508 pub union CResult_AcceptChannelDecodeErrorZPtr {
13509 /// A pointer to the contents in the success state.
13510 /// Reading from this pointer when `result_ok` is not set is undefined.
13511 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13512 /// A pointer to the contents in the error state.
13513 /// Reading from this pointer when `result_ok` is set is undefined.
13514 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13517 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13518 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13520 pub struct CResult_AcceptChannelDecodeErrorZ {
13521 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13522 /// `err` or `result` depending on the state of `result_ok`.
13523 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13524 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13525 pub result_ok: bool,
13528 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13529 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13530 CResult_AcceptChannelDecodeErrorZ {
13531 contents: CResult_AcceptChannelDecodeErrorZPtr {
13532 result: Box::into_raw(Box::new(o)),
13538 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13539 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13540 CResult_AcceptChannelDecodeErrorZ {
13541 contents: CResult_AcceptChannelDecodeErrorZPtr {
13542 err: Box::into_raw(Box::new(e)),
13547 /// Checks if the given object is currently in the success state
13549 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13553 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13554 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13555 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13556 fn drop(&mut self) {
13557 if self.result_ok {
13558 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13559 let _ = unsafe { Box::from_raw(self.contents.result) };
13562 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13563 let _ = unsafe { Box::from_raw(self.contents.err) };
13568 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13569 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13570 let contents = if o.result_ok {
13571 let result = unsafe { o.contents.result };
13572 unsafe { o.contents.result = core::ptr::null_mut() };
13573 CResult_AcceptChannelDecodeErrorZPtr { result }
13575 let err = unsafe { o.contents.err };
13576 unsafe { o.contents.err = core::ptr::null_mut(); }
13577 CResult_AcceptChannelDecodeErrorZPtr { err }
13581 result_ok: o.result_ok,
13585 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13586 fn clone(&self) -> Self {
13587 if self.result_ok {
13588 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13589 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13592 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13593 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13599 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13600 /// but with all dynamically-allocated buffers duplicated in new buffers.
13601 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13603 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
13604 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
13605 /// A pointer to the contents in the success state.
13606 /// Reading from this pointer when `result_ok` is not set is undefined.
13607 pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
13608 /// A pointer to the contents in the error state.
13609 /// Reading from this pointer when `result_ok` is set is undefined.
13610 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13613 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
13614 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
13615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13616 pub struct CResult_AcceptChannelV2DecodeErrorZ {
13617 /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
13618 /// `err` or `result` depending on the state of `result_ok`.
13619 pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
13620 /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
13621 pub result_ok: bool,
13624 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
13625 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
13626 CResult_AcceptChannelV2DecodeErrorZ {
13627 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13628 result: Box::into_raw(Box::new(o)),
13634 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
13635 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
13636 CResult_AcceptChannelV2DecodeErrorZ {
13637 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13638 err: Box::into_raw(Box::new(e)),
13643 /// Checks if the given object is currently in the success state
13645 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
13649 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
13650 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
13651 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
13652 fn drop(&mut self) {
13653 if self.result_ok {
13654 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13655 let _ = unsafe { Box::from_raw(self.contents.result) };
13658 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13659 let _ = unsafe { Box::from_raw(self.contents.err) };
13664 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
13665 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
13666 let contents = if o.result_ok {
13667 let result = unsafe { o.contents.result };
13668 unsafe { o.contents.result = core::ptr::null_mut() };
13669 CResult_AcceptChannelV2DecodeErrorZPtr { result }
13671 let err = unsafe { o.contents.err };
13672 unsafe { o.contents.err = core::ptr::null_mut(); }
13673 CResult_AcceptChannelV2DecodeErrorZPtr { err }
13677 result_ok: o.result_ok,
13681 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
13682 fn clone(&self) -> Self {
13683 if self.result_ok {
13684 Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13685 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
13688 Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
13689 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13695 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
13696 /// but with all dynamically-allocated buffers duplicated in new buffers.
13697 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
13699 /// The contents of CResult_TxAddInputDecodeErrorZ
13700 pub union CResult_TxAddInputDecodeErrorZPtr {
13701 /// A pointer to the contents in the success state.
13702 /// Reading from this pointer when `result_ok` is not set is undefined.
13703 pub result: *mut crate::lightning::ln::msgs::TxAddInput,
13704 /// A pointer to the contents in the error state.
13705 /// Reading from this pointer when `result_ok` is set is undefined.
13706 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13709 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
13710 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13711 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13712 pub struct CResult_TxAddInputDecodeErrorZ {
13713 /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
13714 /// `err` or `result` depending on the state of `result_ok`.
13715 pub contents: CResult_TxAddInputDecodeErrorZPtr,
13716 /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
13717 pub result_ok: bool,
13720 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
13721 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
13722 CResult_TxAddInputDecodeErrorZ {
13723 contents: CResult_TxAddInputDecodeErrorZPtr {
13724 result: Box::into_raw(Box::new(o)),
13730 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
13731 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
13732 CResult_TxAddInputDecodeErrorZ {
13733 contents: CResult_TxAddInputDecodeErrorZPtr {
13734 err: Box::into_raw(Box::new(e)),
13739 /// Checks if the given object is currently in the success state
13741 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
13745 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
13746 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
13747 impl Drop for CResult_TxAddInputDecodeErrorZ {
13748 fn drop(&mut self) {
13749 if self.result_ok {
13750 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13751 let _ = unsafe { Box::from_raw(self.contents.result) };
13754 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13755 let _ = unsafe { Box::from_raw(self.contents.err) };
13760 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
13761 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13762 let contents = if o.result_ok {
13763 let result = unsafe { o.contents.result };
13764 unsafe { o.contents.result = core::ptr::null_mut() };
13765 CResult_TxAddInputDecodeErrorZPtr { result }
13767 let err = unsafe { o.contents.err };
13768 unsafe { o.contents.err = core::ptr::null_mut(); }
13769 CResult_TxAddInputDecodeErrorZPtr { err }
13773 result_ok: o.result_ok,
13777 impl Clone for CResult_TxAddInputDecodeErrorZ {
13778 fn clone(&self) -> Self {
13779 if self.result_ok {
13780 Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
13781 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
13784 Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
13785 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13791 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
13792 /// but with all dynamically-allocated buffers duplicated in new buffers.
13793 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
13795 /// The contents of CResult_TxAddOutputDecodeErrorZ
13796 pub union CResult_TxAddOutputDecodeErrorZPtr {
13797 /// A pointer to the contents in the success state.
13798 /// Reading from this pointer when `result_ok` is not set is undefined.
13799 pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
13800 /// A pointer to the contents in the error state.
13801 /// Reading from this pointer when `result_ok` is set is undefined.
13802 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13805 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
13806 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13807 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13808 pub struct CResult_TxAddOutputDecodeErrorZ {
13809 /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
13810 /// `err` or `result` depending on the state of `result_ok`.
13811 pub contents: CResult_TxAddOutputDecodeErrorZPtr,
13812 /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
13813 pub result_ok: bool,
13816 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
13817 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
13818 CResult_TxAddOutputDecodeErrorZ {
13819 contents: CResult_TxAddOutputDecodeErrorZPtr {
13820 result: Box::into_raw(Box::new(o)),
13826 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
13827 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
13828 CResult_TxAddOutputDecodeErrorZ {
13829 contents: CResult_TxAddOutputDecodeErrorZPtr {
13830 err: Box::into_raw(Box::new(e)),
13835 /// Checks if the given object is currently in the success state
13837 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
13841 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
13842 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
13843 impl Drop for CResult_TxAddOutputDecodeErrorZ {
13844 fn drop(&mut self) {
13845 if self.result_ok {
13846 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13847 let _ = unsafe { Box::from_raw(self.contents.result) };
13850 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13851 let _ = unsafe { Box::from_raw(self.contents.err) };
13856 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
13857 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13858 let contents = if o.result_ok {
13859 let result = unsafe { o.contents.result };
13860 unsafe { o.contents.result = core::ptr::null_mut() };
13861 CResult_TxAddOutputDecodeErrorZPtr { result }
13863 let err = unsafe { o.contents.err };
13864 unsafe { o.contents.err = core::ptr::null_mut(); }
13865 CResult_TxAddOutputDecodeErrorZPtr { err }
13869 result_ok: o.result_ok,
13873 impl Clone for CResult_TxAddOutputDecodeErrorZ {
13874 fn clone(&self) -> Self {
13875 if self.result_ok {
13876 Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
13877 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
13880 Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
13881 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13887 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
13888 /// but with all dynamically-allocated buffers duplicated in new buffers.
13889 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
13891 /// The contents of CResult_TxRemoveInputDecodeErrorZ
13892 pub union CResult_TxRemoveInputDecodeErrorZPtr {
13893 /// A pointer to the contents in the success state.
13894 /// Reading from this pointer when `result_ok` is not set is undefined.
13895 pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
13896 /// A pointer to the contents in the error state.
13897 /// Reading from this pointer when `result_ok` is set is undefined.
13898 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13901 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
13902 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13903 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13904 pub struct CResult_TxRemoveInputDecodeErrorZ {
13905 /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
13906 /// `err` or `result` depending on the state of `result_ok`.
13907 pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
13908 /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
13909 pub result_ok: bool,
13912 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
13913 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
13914 CResult_TxRemoveInputDecodeErrorZ {
13915 contents: CResult_TxRemoveInputDecodeErrorZPtr {
13916 result: Box::into_raw(Box::new(o)),
13922 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
13923 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
13924 CResult_TxRemoveInputDecodeErrorZ {
13925 contents: CResult_TxRemoveInputDecodeErrorZPtr {
13926 err: Box::into_raw(Box::new(e)),
13931 /// Checks if the given object is currently in the success state
13933 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
13937 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
13938 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
13939 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
13940 fn drop(&mut self) {
13941 if self.result_ok {
13942 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13943 let _ = unsafe { Box::from_raw(self.contents.result) };
13946 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13947 let _ = unsafe { Box::from_raw(self.contents.err) };
13952 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
13953 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
13954 let contents = if o.result_ok {
13955 let result = unsafe { o.contents.result };
13956 unsafe { o.contents.result = core::ptr::null_mut() };
13957 CResult_TxRemoveInputDecodeErrorZPtr { result }
13959 let err = unsafe { o.contents.err };
13960 unsafe { o.contents.err = core::ptr::null_mut(); }
13961 CResult_TxRemoveInputDecodeErrorZPtr { err }
13965 result_ok: o.result_ok,
13969 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
13970 fn clone(&self) -> Self {
13971 if self.result_ok {
13972 Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
13973 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
13976 Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
13977 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13983 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
13984 /// but with all dynamically-allocated buffers duplicated in new buffers.
13985 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
13987 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
13988 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
13989 /// A pointer to the contents in the success state.
13990 /// Reading from this pointer when `result_ok` is not set is undefined.
13991 pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
13992 /// A pointer to the contents in the error state.
13993 /// Reading from this pointer when `result_ok` is set is undefined.
13994 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13997 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
13998 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
13999 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14000 pub struct CResult_TxRemoveOutputDecodeErrorZ {
14001 /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
14002 /// `err` or `result` depending on the state of `result_ok`.
14003 pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
14004 /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
14005 pub result_ok: bool,
14008 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
14009 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
14010 CResult_TxRemoveOutputDecodeErrorZ {
14011 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
14012 result: Box::into_raw(Box::new(o)),
14018 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
14019 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
14020 CResult_TxRemoveOutputDecodeErrorZ {
14021 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
14022 err: Box::into_raw(Box::new(e)),
14027 /// Checks if the given object is currently in the success state
14029 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
14033 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
14034 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
14035 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
14036 fn drop(&mut self) {
14037 if self.result_ok {
14038 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14039 let _ = unsafe { Box::from_raw(self.contents.result) };
14042 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14043 let _ = unsafe { Box::from_raw(self.contents.err) };
14048 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
14049 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
14050 let contents = if o.result_ok {
14051 let result = unsafe { o.contents.result };
14052 unsafe { o.contents.result = core::ptr::null_mut() };
14053 CResult_TxRemoveOutputDecodeErrorZPtr { result }
14055 let err = unsafe { o.contents.err };
14056 unsafe { o.contents.err = core::ptr::null_mut(); }
14057 CResult_TxRemoveOutputDecodeErrorZPtr { err }
14061 result_ok: o.result_ok,
14065 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
14066 fn clone(&self) -> Self {
14067 if self.result_ok {
14068 Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
14069 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
14072 Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
14073 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14079 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
14080 /// but with all dynamically-allocated buffers duplicated in new buffers.
14081 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
14083 /// The contents of CResult_TxCompleteDecodeErrorZ
14084 pub union CResult_TxCompleteDecodeErrorZPtr {
14085 /// A pointer to the contents in the success state.
14086 /// Reading from this pointer when `result_ok` is not set is undefined.
14087 pub result: *mut crate::lightning::ln::msgs::TxComplete,
14088 /// A pointer to the contents in the error state.
14089 /// Reading from this pointer when `result_ok` is set is undefined.
14090 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14093 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
14094 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
14095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14096 pub struct CResult_TxCompleteDecodeErrorZ {
14097 /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
14098 /// `err` or `result` depending on the state of `result_ok`.
14099 pub contents: CResult_TxCompleteDecodeErrorZPtr,
14100 /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
14101 pub result_ok: bool,
14104 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
14105 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
14106 CResult_TxCompleteDecodeErrorZ {
14107 contents: CResult_TxCompleteDecodeErrorZPtr {
14108 result: Box::into_raw(Box::new(o)),
14114 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
14115 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
14116 CResult_TxCompleteDecodeErrorZ {
14117 contents: CResult_TxCompleteDecodeErrorZPtr {
14118 err: Box::into_raw(Box::new(e)),
14123 /// Checks if the given object is currently in the success state
14125 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
14129 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
14130 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
14131 impl Drop for CResult_TxCompleteDecodeErrorZ {
14132 fn drop(&mut self) {
14133 if self.result_ok {
14134 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14135 let _ = unsafe { Box::from_raw(self.contents.result) };
14138 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14139 let _ = unsafe { Box::from_raw(self.contents.err) };
14144 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
14145 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
14146 let contents = if o.result_ok {
14147 let result = unsafe { o.contents.result };
14148 unsafe { o.contents.result = core::ptr::null_mut() };
14149 CResult_TxCompleteDecodeErrorZPtr { result }
14151 let err = unsafe { o.contents.err };
14152 unsafe { o.contents.err = core::ptr::null_mut(); }
14153 CResult_TxCompleteDecodeErrorZPtr { err }
14157 result_ok: o.result_ok,
14161 impl Clone for CResult_TxCompleteDecodeErrorZ {
14162 fn clone(&self) -> Self {
14163 if self.result_ok {
14164 Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
14165 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
14168 Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
14169 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14175 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
14176 /// but with all dynamically-allocated buffers duplicated in new buffers.
14177 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
14179 /// The contents of CResult_TxSignaturesDecodeErrorZ
14180 pub union CResult_TxSignaturesDecodeErrorZPtr {
14181 /// A pointer to the contents in the success state.
14182 /// Reading from this pointer when `result_ok` is not set is undefined.
14183 pub result: *mut crate::lightning::ln::msgs::TxSignatures,
14184 /// A pointer to the contents in the error state.
14185 /// Reading from this pointer when `result_ok` is set is undefined.
14186 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14189 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
14190 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
14191 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14192 pub struct CResult_TxSignaturesDecodeErrorZ {
14193 /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
14194 /// `err` or `result` depending on the state of `result_ok`.
14195 pub contents: CResult_TxSignaturesDecodeErrorZPtr,
14196 /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
14197 pub result_ok: bool,
14200 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
14201 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
14202 CResult_TxSignaturesDecodeErrorZ {
14203 contents: CResult_TxSignaturesDecodeErrorZPtr {
14204 result: Box::into_raw(Box::new(o)),
14210 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
14211 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
14212 CResult_TxSignaturesDecodeErrorZ {
14213 contents: CResult_TxSignaturesDecodeErrorZPtr {
14214 err: Box::into_raw(Box::new(e)),
14219 /// Checks if the given object is currently in the success state
14221 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
14225 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
14226 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
14227 impl Drop for CResult_TxSignaturesDecodeErrorZ {
14228 fn drop(&mut self) {
14229 if self.result_ok {
14230 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14231 let _ = unsafe { Box::from_raw(self.contents.result) };
14234 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14235 let _ = unsafe { Box::from_raw(self.contents.err) };
14240 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
14241 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
14242 let contents = if o.result_ok {
14243 let result = unsafe { o.contents.result };
14244 unsafe { o.contents.result = core::ptr::null_mut() };
14245 CResult_TxSignaturesDecodeErrorZPtr { result }
14247 let err = unsafe { o.contents.err };
14248 unsafe { o.contents.err = core::ptr::null_mut(); }
14249 CResult_TxSignaturesDecodeErrorZPtr { err }
14253 result_ok: o.result_ok,
14257 impl Clone for CResult_TxSignaturesDecodeErrorZ {
14258 fn clone(&self) -> Self {
14259 if self.result_ok {
14260 Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
14261 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
14264 Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
14265 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14271 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
14272 /// but with all dynamically-allocated buffers duplicated in new buffers.
14273 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
14275 /// The contents of CResult_TxInitRbfDecodeErrorZ
14276 pub union CResult_TxInitRbfDecodeErrorZPtr {
14277 /// A pointer to the contents in the success state.
14278 /// Reading from this pointer when `result_ok` is not set is undefined.
14279 pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
14280 /// A pointer to the contents in the error state.
14281 /// Reading from this pointer when `result_ok` is set is undefined.
14282 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14285 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
14286 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
14287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14288 pub struct CResult_TxInitRbfDecodeErrorZ {
14289 /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
14290 /// `err` or `result` depending on the state of `result_ok`.
14291 pub contents: CResult_TxInitRbfDecodeErrorZPtr,
14292 /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
14293 pub result_ok: bool,
14296 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
14297 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
14298 CResult_TxInitRbfDecodeErrorZ {
14299 contents: CResult_TxInitRbfDecodeErrorZPtr {
14300 result: Box::into_raw(Box::new(o)),
14306 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
14307 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
14308 CResult_TxInitRbfDecodeErrorZ {
14309 contents: CResult_TxInitRbfDecodeErrorZPtr {
14310 err: Box::into_raw(Box::new(e)),
14315 /// Checks if the given object is currently in the success state
14317 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
14321 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
14322 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
14323 impl Drop for CResult_TxInitRbfDecodeErrorZ {
14324 fn drop(&mut self) {
14325 if self.result_ok {
14326 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14327 let _ = unsafe { Box::from_raw(self.contents.result) };
14330 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14331 let _ = unsafe { Box::from_raw(self.contents.err) };
14336 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
14337 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
14338 let contents = if o.result_ok {
14339 let result = unsafe { o.contents.result };
14340 unsafe { o.contents.result = core::ptr::null_mut() };
14341 CResult_TxInitRbfDecodeErrorZPtr { result }
14343 let err = unsafe { o.contents.err };
14344 unsafe { o.contents.err = core::ptr::null_mut(); }
14345 CResult_TxInitRbfDecodeErrorZPtr { err }
14349 result_ok: o.result_ok,
14353 impl Clone for CResult_TxInitRbfDecodeErrorZ {
14354 fn clone(&self) -> Self {
14355 if self.result_ok {
14356 Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
14357 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
14360 Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
14361 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14367 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
14368 /// but with all dynamically-allocated buffers duplicated in new buffers.
14369 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
14371 /// The contents of CResult_TxAckRbfDecodeErrorZ
14372 pub union CResult_TxAckRbfDecodeErrorZPtr {
14373 /// A pointer to the contents in the success state.
14374 /// Reading from this pointer when `result_ok` is not set is undefined.
14375 pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
14376 /// A pointer to the contents in the error state.
14377 /// Reading from this pointer when `result_ok` is set is undefined.
14378 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14381 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
14382 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
14383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14384 pub struct CResult_TxAckRbfDecodeErrorZ {
14385 /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
14386 /// `err` or `result` depending on the state of `result_ok`.
14387 pub contents: CResult_TxAckRbfDecodeErrorZPtr,
14388 /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
14389 pub result_ok: bool,
14392 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
14393 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
14394 CResult_TxAckRbfDecodeErrorZ {
14395 contents: CResult_TxAckRbfDecodeErrorZPtr {
14396 result: Box::into_raw(Box::new(o)),
14402 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
14403 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
14404 CResult_TxAckRbfDecodeErrorZ {
14405 contents: CResult_TxAckRbfDecodeErrorZPtr {
14406 err: Box::into_raw(Box::new(e)),
14411 /// Checks if the given object is currently in the success state
14413 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
14417 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
14418 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
14419 impl Drop for CResult_TxAckRbfDecodeErrorZ {
14420 fn drop(&mut self) {
14421 if self.result_ok {
14422 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14423 let _ = unsafe { Box::from_raw(self.contents.result) };
14426 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14427 let _ = unsafe { Box::from_raw(self.contents.err) };
14432 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
14433 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
14434 let contents = if o.result_ok {
14435 let result = unsafe { o.contents.result };
14436 unsafe { o.contents.result = core::ptr::null_mut() };
14437 CResult_TxAckRbfDecodeErrorZPtr { result }
14439 let err = unsafe { o.contents.err };
14440 unsafe { o.contents.err = core::ptr::null_mut(); }
14441 CResult_TxAckRbfDecodeErrorZPtr { err }
14445 result_ok: o.result_ok,
14449 impl Clone for CResult_TxAckRbfDecodeErrorZ {
14450 fn clone(&self) -> Self {
14451 if self.result_ok {
14452 Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
14453 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
14456 Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
14457 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14463 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
14464 /// but with all dynamically-allocated buffers duplicated in new buffers.
14465 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
14467 /// The contents of CResult_TxAbortDecodeErrorZ
14468 pub union CResult_TxAbortDecodeErrorZPtr {
14469 /// A pointer to the contents in the success state.
14470 /// Reading from this pointer when `result_ok` is not set is undefined.
14471 pub result: *mut crate::lightning::ln::msgs::TxAbort,
14472 /// A pointer to the contents in the error state.
14473 /// Reading from this pointer when `result_ok` is set is undefined.
14474 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14477 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
14478 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
14479 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14480 pub struct CResult_TxAbortDecodeErrorZ {
14481 /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
14482 /// `err` or `result` depending on the state of `result_ok`.
14483 pub contents: CResult_TxAbortDecodeErrorZPtr,
14484 /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
14485 pub result_ok: bool,
14488 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
14489 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
14490 CResult_TxAbortDecodeErrorZ {
14491 contents: CResult_TxAbortDecodeErrorZPtr {
14492 result: Box::into_raw(Box::new(o)),
14498 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
14499 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
14500 CResult_TxAbortDecodeErrorZ {
14501 contents: CResult_TxAbortDecodeErrorZPtr {
14502 err: Box::into_raw(Box::new(e)),
14507 /// Checks if the given object is currently in the success state
14509 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
14513 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
14514 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
14515 impl Drop for CResult_TxAbortDecodeErrorZ {
14516 fn drop(&mut self) {
14517 if self.result_ok {
14518 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14519 let _ = unsafe { Box::from_raw(self.contents.result) };
14522 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14523 let _ = unsafe { Box::from_raw(self.contents.err) };
14528 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
14529 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
14530 let contents = if o.result_ok {
14531 let result = unsafe { o.contents.result };
14532 unsafe { o.contents.result = core::ptr::null_mut() };
14533 CResult_TxAbortDecodeErrorZPtr { result }
14535 let err = unsafe { o.contents.err };
14536 unsafe { o.contents.err = core::ptr::null_mut(); }
14537 CResult_TxAbortDecodeErrorZPtr { err }
14541 result_ok: o.result_ok,
14545 impl Clone for CResult_TxAbortDecodeErrorZ {
14546 fn clone(&self) -> Self {
14547 if self.result_ok {
14548 Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
14549 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
14552 Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
14553 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14559 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
14560 /// but with all dynamically-allocated buffers duplicated in new buffers.
14561 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
14563 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
14564 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
14565 /// A pointer to the contents in the success state.
14566 /// Reading from this pointer when `result_ok` is not set is undefined.
14567 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
14568 /// A pointer to the contents in the error state.
14569 /// Reading from this pointer when `result_ok` is set is undefined.
14570 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14573 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
14574 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
14575 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14576 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
14577 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
14578 /// `err` or `result` depending on the state of `result_ok`.
14579 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
14580 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
14581 pub result_ok: bool,
14584 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
14585 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14586 CResult_AnnouncementSignaturesDecodeErrorZ {
14587 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14588 result: Box::into_raw(Box::new(o)),
14594 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
14595 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14596 CResult_AnnouncementSignaturesDecodeErrorZ {
14597 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14598 err: Box::into_raw(Box::new(e)),
14603 /// Checks if the given object is currently in the success state
14605 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
14609 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
14610 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
14611 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
14612 fn drop(&mut self) {
14613 if self.result_ok {
14614 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14615 let _ = unsafe { Box::from_raw(self.contents.result) };
14618 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14619 let _ = unsafe { Box::from_raw(self.contents.err) };
14624 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
14625 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
14626 let contents = if o.result_ok {
14627 let result = unsafe { o.contents.result };
14628 unsafe { o.contents.result = core::ptr::null_mut() };
14629 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
14631 let err = unsafe { o.contents.err };
14632 unsafe { o.contents.err = core::ptr::null_mut(); }
14633 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
14637 result_ok: o.result_ok,
14641 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
14642 fn clone(&self) -> Self {
14643 if self.result_ok {
14644 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14645 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
14648 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14649 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14655 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
14656 /// but with all dynamically-allocated buffers duplicated in new buffers.
14657 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
14659 /// The contents of CResult_ChannelReestablishDecodeErrorZ
14660 pub union CResult_ChannelReestablishDecodeErrorZPtr {
14661 /// A pointer to the contents in the success state.
14662 /// Reading from this pointer when `result_ok` is not set is undefined.
14663 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
14664 /// A pointer to the contents in the error state.
14665 /// Reading from this pointer when `result_ok` is set is undefined.
14666 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14669 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
14670 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
14671 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14672 pub struct CResult_ChannelReestablishDecodeErrorZ {
14673 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
14674 /// `err` or `result` depending on the state of `result_ok`.
14675 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
14676 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
14677 pub result_ok: bool,
14680 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
14681 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
14682 CResult_ChannelReestablishDecodeErrorZ {
14683 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14684 result: Box::into_raw(Box::new(o)),
14690 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
14691 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
14692 CResult_ChannelReestablishDecodeErrorZ {
14693 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14694 err: Box::into_raw(Box::new(e)),
14699 /// Checks if the given object is currently in the success state
14701 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
14705 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
14706 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
14707 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
14708 fn drop(&mut self) {
14709 if self.result_ok {
14710 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14711 let _ = unsafe { Box::from_raw(self.contents.result) };
14714 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14715 let _ = unsafe { Box::from_raw(self.contents.err) };
14720 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
14721 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
14722 let contents = if o.result_ok {
14723 let result = unsafe { o.contents.result };
14724 unsafe { o.contents.result = core::ptr::null_mut() };
14725 CResult_ChannelReestablishDecodeErrorZPtr { result }
14727 let err = unsafe { o.contents.err };
14728 unsafe { o.contents.err = core::ptr::null_mut(); }
14729 CResult_ChannelReestablishDecodeErrorZPtr { err }
14733 result_ok: o.result_ok,
14737 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
14738 fn clone(&self) -> Self {
14739 if self.result_ok {
14740 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14741 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
14744 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14745 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14751 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14752 /// but with all dynamically-allocated buffers duplicated in new buffers.
14753 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
14755 /// The contents of CResult_ClosingSignedDecodeErrorZ
14756 pub union CResult_ClosingSignedDecodeErrorZPtr {
14757 /// A pointer to the contents in the success state.
14758 /// Reading from this pointer when `result_ok` is not set is undefined.
14759 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
14760 /// A pointer to the contents in the error state.
14761 /// Reading from this pointer when `result_ok` is set is undefined.
14762 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14765 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
14766 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14767 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14768 pub struct CResult_ClosingSignedDecodeErrorZ {
14769 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
14770 /// `err` or `result` depending on the state of `result_ok`.
14771 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
14772 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
14773 pub result_ok: bool,
14776 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14777 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
14778 CResult_ClosingSignedDecodeErrorZ {
14779 contents: CResult_ClosingSignedDecodeErrorZPtr {
14780 result: Box::into_raw(Box::new(o)),
14786 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14787 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
14788 CResult_ClosingSignedDecodeErrorZ {
14789 contents: CResult_ClosingSignedDecodeErrorZPtr {
14790 err: Box::into_raw(Box::new(e)),
14795 /// Checks if the given object is currently in the success state
14797 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
14801 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14802 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
14803 impl Drop for CResult_ClosingSignedDecodeErrorZ {
14804 fn drop(&mut self) {
14805 if self.result_ok {
14806 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14807 let _ = unsafe { Box::from_raw(self.contents.result) };
14810 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14811 let _ = unsafe { Box::from_raw(self.contents.err) };
14816 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
14817 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14818 let contents = if o.result_ok {
14819 let result = unsafe { o.contents.result };
14820 unsafe { o.contents.result = core::ptr::null_mut() };
14821 CResult_ClosingSignedDecodeErrorZPtr { result }
14823 let err = unsafe { o.contents.err };
14824 unsafe { o.contents.err = core::ptr::null_mut(); }
14825 CResult_ClosingSignedDecodeErrorZPtr { err }
14829 result_ok: o.result_ok,
14833 impl Clone for CResult_ClosingSignedDecodeErrorZ {
14834 fn clone(&self) -> Self {
14835 if self.result_ok {
14836 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
14837 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
14840 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
14841 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14847 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14848 /// but with all dynamically-allocated buffers duplicated in new buffers.
14849 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
14851 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
14852 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14853 /// A pointer to the contents in the success state.
14854 /// Reading from this pointer when `result_ok` is not set is undefined.
14855 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
14856 /// A pointer to the contents in the error state.
14857 /// Reading from this pointer when `result_ok` is set is undefined.
14858 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14861 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
14862 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14864 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
14865 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
14866 /// `err` or `result` depending on the state of `result_ok`.
14867 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
14868 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
14869 pub result_ok: bool,
14872 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14873 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14874 CResult_ClosingSignedFeeRangeDecodeErrorZ {
14875 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14876 result: Box::into_raw(Box::new(o)),
14882 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14883 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14884 CResult_ClosingSignedFeeRangeDecodeErrorZ {
14885 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14886 err: Box::into_raw(Box::new(e)),
14891 /// Checks if the given object is currently in the success state
14893 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
14897 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14898 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
14899 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14900 fn drop(&mut self) {
14901 if self.result_ok {
14902 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14903 let _ = unsafe { Box::from_raw(self.contents.result) };
14906 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14907 let _ = unsafe { Box::from_raw(self.contents.err) };
14912 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14913 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14914 let contents = if o.result_ok {
14915 let result = unsafe { o.contents.result };
14916 unsafe { o.contents.result = core::ptr::null_mut() };
14917 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
14919 let err = unsafe { o.contents.err };
14920 unsafe { o.contents.err = core::ptr::null_mut(); }
14921 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
14925 result_ok: o.result_ok,
14929 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14930 fn clone(&self) -> Self {
14931 if self.result_ok {
14932 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14933 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
14936 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14937 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14943 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
14944 /// but with all dynamically-allocated buffers duplicated in new buffers.
14945 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
14947 /// The contents of CResult_CommitmentSignedDecodeErrorZ
14948 pub union CResult_CommitmentSignedDecodeErrorZPtr {
14949 /// A pointer to the contents in the success state.
14950 /// Reading from this pointer when `result_ok` is not set is undefined.
14951 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
14952 /// A pointer to the contents in the error state.
14953 /// Reading from this pointer when `result_ok` is set is undefined.
14954 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14957 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
14958 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14959 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14960 pub struct CResult_CommitmentSignedDecodeErrorZ {
14961 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
14962 /// `err` or `result` depending on the state of `result_ok`.
14963 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
14964 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
14965 pub result_ok: bool,
14968 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
14969 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
14970 CResult_CommitmentSignedDecodeErrorZ {
14971 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14972 result: Box::into_raw(Box::new(o)),
14978 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
14979 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
14980 CResult_CommitmentSignedDecodeErrorZ {
14981 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14982 err: Box::into_raw(Box::new(e)),
14987 /// Checks if the given object is currently in the success state
14989 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
14993 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
14994 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
14995 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
14996 fn drop(&mut self) {
14997 if self.result_ok {
14998 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14999 let _ = unsafe { Box::from_raw(self.contents.result) };
15002 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15003 let _ = unsafe { Box::from_raw(self.contents.err) };
15008 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
15009 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15010 let contents = if o.result_ok {
15011 let result = unsafe { o.contents.result };
15012 unsafe { o.contents.result = core::ptr::null_mut() };
15013 CResult_CommitmentSignedDecodeErrorZPtr { result }
15015 let err = unsafe { o.contents.err };
15016 unsafe { o.contents.err = core::ptr::null_mut(); }
15017 CResult_CommitmentSignedDecodeErrorZPtr { err }
15021 result_ok: o.result_ok,
15025 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
15026 fn clone(&self) -> Self {
15027 if self.result_ok {
15028 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15029 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
15032 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15033 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15039 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
15040 /// but with all dynamically-allocated buffers duplicated in new buffers.
15041 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
15043 /// The contents of CResult_FundingCreatedDecodeErrorZ
15044 pub union CResult_FundingCreatedDecodeErrorZPtr {
15045 /// A pointer to the contents in the success state.
15046 /// Reading from this pointer when `result_ok` is not set is undefined.
15047 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
15048 /// A pointer to the contents in the error state.
15049 /// Reading from this pointer when `result_ok` is set is undefined.
15050 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15053 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
15054 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
15055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15056 pub struct CResult_FundingCreatedDecodeErrorZ {
15057 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
15058 /// `err` or `result` depending on the state of `result_ok`.
15059 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
15060 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
15061 pub result_ok: bool,
15064 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
15065 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
15066 CResult_FundingCreatedDecodeErrorZ {
15067 contents: CResult_FundingCreatedDecodeErrorZPtr {
15068 result: Box::into_raw(Box::new(o)),
15074 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
15075 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
15076 CResult_FundingCreatedDecodeErrorZ {
15077 contents: CResult_FundingCreatedDecodeErrorZPtr {
15078 err: Box::into_raw(Box::new(e)),
15083 /// Checks if the given object is currently in the success state
15085 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
15089 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
15090 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
15091 impl Drop for CResult_FundingCreatedDecodeErrorZ {
15092 fn drop(&mut self) {
15093 if self.result_ok {
15094 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15095 let _ = unsafe { Box::from_raw(self.contents.result) };
15098 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15099 let _ = unsafe { Box::from_raw(self.contents.err) };
15104 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
15105 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
15106 let contents = if o.result_ok {
15107 let result = unsafe { o.contents.result };
15108 unsafe { o.contents.result = core::ptr::null_mut() };
15109 CResult_FundingCreatedDecodeErrorZPtr { result }
15111 let err = unsafe { o.contents.err };
15112 unsafe { o.contents.err = core::ptr::null_mut(); }
15113 CResult_FundingCreatedDecodeErrorZPtr { err }
15117 result_ok: o.result_ok,
15121 impl Clone for CResult_FundingCreatedDecodeErrorZ {
15122 fn clone(&self) -> Self {
15123 if self.result_ok {
15124 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
15125 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
15128 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
15129 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15135 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
15136 /// but with all dynamically-allocated buffers duplicated in new buffers.
15137 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
15139 /// The contents of CResult_FundingSignedDecodeErrorZ
15140 pub union CResult_FundingSignedDecodeErrorZPtr {
15141 /// A pointer to the contents in the success state.
15142 /// Reading from this pointer when `result_ok` is not set is undefined.
15143 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
15144 /// A pointer to the contents in the error state.
15145 /// Reading from this pointer when `result_ok` is set is undefined.
15146 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15149 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
15150 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15151 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15152 pub struct CResult_FundingSignedDecodeErrorZ {
15153 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
15154 /// `err` or `result` depending on the state of `result_ok`.
15155 pub contents: CResult_FundingSignedDecodeErrorZPtr,
15156 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
15157 pub result_ok: bool,
15160 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
15161 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
15162 CResult_FundingSignedDecodeErrorZ {
15163 contents: CResult_FundingSignedDecodeErrorZPtr {
15164 result: Box::into_raw(Box::new(o)),
15170 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
15171 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
15172 CResult_FundingSignedDecodeErrorZ {
15173 contents: CResult_FundingSignedDecodeErrorZPtr {
15174 err: Box::into_raw(Box::new(e)),
15179 /// Checks if the given object is currently in the success state
15181 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
15185 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
15186 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
15187 impl Drop for CResult_FundingSignedDecodeErrorZ {
15188 fn drop(&mut self) {
15189 if self.result_ok {
15190 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15191 let _ = unsafe { Box::from_raw(self.contents.result) };
15194 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15195 let _ = unsafe { Box::from_raw(self.contents.err) };
15200 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
15201 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15202 let contents = if o.result_ok {
15203 let result = unsafe { o.contents.result };
15204 unsafe { o.contents.result = core::ptr::null_mut() };
15205 CResult_FundingSignedDecodeErrorZPtr { result }
15207 let err = unsafe { o.contents.err };
15208 unsafe { o.contents.err = core::ptr::null_mut(); }
15209 CResult_FundingSignedDecodeErrorZPtr { err }
15213 result_ok: o.result_ok,
15217 impl Clone for CResult_FundingSignedDecodeErrorZ {
15218 fn clone(&self) -> Self {
15219 if self.result_ok {
15220 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
15221 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
15224 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
15225 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15231 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
15232 /// but with all dynamically-allocated buffers duplicated in new buffers.
15233 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
15235 /// The contents of CResult_ChannelReadyDecodeErrorZ
15236 pub union CResult_ChannelReadyDecodeErrorZPtr {
15237 /// A pointer to the contents in the success state.
15238 /// Reading from this pointer when `result_ok` is not set is undefined.
15239 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
15240 /// A pointer to the contents in the error state.
15241 /// Reading from this pointer when `result_ok` is set is undefined.
15242 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15245 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
15246 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
15247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15248 pub struct CResult_ChannelReadyDecodeErrorZ {
15249 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
15250 /// `err` or `result` depending on the state of `result_ok`.
15251 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
15252 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
15253 pub result_ok: bool,
15256 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
15257 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
15258 CResult_ChannelReadyDecodeErrorZ {
15259 contents: CResult_ChannelReadyDecodeErrorZPtr {
15260 result: Box::into_raw(Box::new(o)),
15266 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
15267 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
15268 CResult_ChannelReadyDecodeErrorZ {
15269 contents: CResult_ChannelReadyDecodeErrorZPtr {
15270 err: Box::into_raw(Box::new(e)),
15275 /// Checks if the given object is currently in the success state
15277 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
15281 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
15282 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
15283 impl Drop for CResult_ChannelReadyDecodeErrorZ {
15284 fn drop(&mut self) {
15285 if self.result_ok {
15286 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15287 let _ = unsafe { Box::from_raw(self.contents.result) };
15290 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15291 let _ = unsafe { Box::from_raw(self.contents.err) };
15296 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
15297 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
15298 let contents = if o.result_ok {
15299 let result = unsafe { o.contents.result };
15300 unsafe { o.contents.result = core::ptr::null_mut() };
15301 CResult_ChannelReadyDecodeErrorZPtr { result }
15303 let err = unsafe { o.contents.err };
15304 unsafe { o.contents.err = core::ptr::null_mut(); }
15305 CResult_ChannelReadyDecodeErrorZPtr { err }
15309 result_ok: o.result_ok,
15313 impl Clone for CResult_ChannelReadyDecodeErrorZ {
15314 fn clone(&self) -> Self {
15315 if self.result_ok {
15316 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
15317 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
15320 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
15321 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15327 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
15328 /// but with all dynamically-allocated buffers duplicated in new buffers.
15329 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
15331 /// The contents of CResult_InitDecodeErrorZ
15332 pub union CResult_InitDecodeErrorZPtr {
15333 /// A pointer to the contents in the success state.
15334 /// Reading from this pointer when `result_ok` is not set is undefined.
15335 pub result: *mut crate::lightning::ln::msgs::Init,
15336 /// A pointer to the contents in the error state.
15337 /// Reading from this pointer when `result_ok` is set is undefined.
15338 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15341 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
15342 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
15343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15344 pub struct CResult_InitDecodeErrorZ {
15345 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
15346 /// `err` or `result` depending on the state of `result_ok`.
15347 pub contents: CResult_InitDecodeErrorZPtr,
15348 /// Whether this CResult_InitDecodeErrorZ represents a success state.
15349 pub result_ok: bool,
15352 /// Creates a new CResult_InitDecodeErrorZ in the success state.
15353 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
15354 CResult_InitDecodeErrorZ {
15355 contents: CResult_InitDecodeErrorZPtr {
15356 result: Box::into_raw(Box::new(o)),
15362 /// Creates a new CResult_InitDecodeErrorZ in the error state.
15363 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
15364 CResult_InitDecodeErrorZ {
15365 contents: CResult_InitDecodeErrorZPtr {
15366 err: Box::into_raw(Box::new(e)),
15371 /// Checks if the given object is currently in the success state
15373 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
15377 /// Frees any resources used by the CResult_InitDecodeErrorZ.
15378 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
15379 impl Drop for CResult_InitDecodeErrorZ {
15380 fn drop(&mut self) {
15381 if self.result_ok {
15382 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15383 let _ = unsafe { Box::from_raw(self.contents.result) };
15386 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15387 let _ = unsafe { Box::from_raw(self.contents.err) };
15392 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
15393 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
15394 let contents = if o.result_ok {
15395 let result = unsafe { o.contents.result };
15396 unsafe { o.contents.result = core::ptr::null_mut() };
15397 CResult_InitDecodeErrorZPtr { result }
15399 let err = unsafe { o.contents.err };
15400 unsafe { o.contents.err = core::ptr::null_mut(); }
15401 CResult_InitDecodeErrorZPtr { err }
15405 result_ok: o.result_ok,
15409 impl Clone for CResult_InitDecodeErrorZ {
15410 fn clone(&self) -> Self {
15411 if self.result_ok {
15412 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
15413 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
15416 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
15417 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15423 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15424 /// but with all dynamically-allocated buffers duplicated in new buffers.
15425 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
15427 /// The contents of CResult_OpenChannelDecodeErrorZ
15428 pub union CResult_OpenChannelDecodeErrorZPtr {
15429 /// A pointer to the contents in the success state.
15430 /// Reading from this pointer when `result_ok` is not set is undefined.
15431 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
15432 /// A pointer to the contents in the error state.
15433 /// Reading from this pointer when `result_ok` is set is undefined.
15434 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15437 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
15438 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15440 pub struct CResult_OpenChannelDecodeErrorZ {
15441 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
15442 /// `err` or `result` depending on the state of `result_ok`.
15443 pub contents: CResult_OpenChannelDecodeErrorZPtr,
15444 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
15445 pub result_ok: bool,
15448 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15449 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
15450 CResult_OpenChannelDecodeErrorZ {
15451 contents: CResult_OpenChannelDecodeErrorZPtr {
15452 result: Box::into_raw(Box::new(o)),
15458 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15459 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
15460 CResult_OpenChannelDecodeErrorZ {
15461 contents: CResult_OpenChannelDecodeErrorZPtr {
15462 err: Box::into_raw(Box::new(e)),
15467 /// Checks if the given object is currently in the success state
15469 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
15473 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15474 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
15475 impl Drop for CResult_OpenChannelDecodeErrorZ {
15476 fn drop(&mut self) {
15477 if self.result_ok {
15478 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15479 let _ = unsafe { Box::from_raw(self.contents.result) };
15482 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15483 let _ = unsafe { Box::from_raw(self.contents.err) };
15488 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
15489 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15490 let contents = if o.result_ok {
15491 let result = unsafe { o.contents.result };
15492 unsafe { o.contents.result = core::ptr::null_mut() };
15493 CResult_OpenChannelDecodeErrorZPtr { result }
15495 let err = unsafe { o.contents.err };
15496 unsafe { o.contents.err = core::ptr::null_mut(); }
15497 CResult_OpenChannelDecodeErrorZPtr { err }
15501 result_ok: o.result_ok,
15505 impl Clone for CResult_OpenChannelDecodeErrorZ {
15506 fn clone(&self) -> Self {
15507 if self.result_ok {
15508 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
15509 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
15512 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
15513 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15519 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15520 /// but with all dynamically-allocated buffers duplicated in new buffers.
15521 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
15523 /// The contents of CResult_OpenChannelV2DecodeErrorZ
15524 pub union CResult_OpenChannelV2DecodeErrorZPtr {
15525 /// A pointer to the contents in the success state.
15526 /// Reading from this pointer when `result_ok` is not set is undefined.
15527 pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
15528 /// A pointer to the contents in the error state.
15529 /// Reading from this pointer when `result_ok` is set is undefined.
15530 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15533 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
15534 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
15535 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15536 pub struct CResult_OpenChannelV2DecodeErrorZ {
15537 /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
15538 /// `err` or `result` depending on the state of `result_ok`.
15539 pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
15540 /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
15541 pub result_ok: bool,
15544 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
15545 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
15546 CResult_OpenChannelV2DecodeErrorZ {
15547 contents: CResult_OpenChannelV2DecodeErrorZPtr {
15548 result: Box::into_raw(Box::new(o)),
15554 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
15555 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
15556 CResult_OpenChannelV2DecodeErrorZ {
15557 contents: CResult_OpenChannelV2DecodeErrorZPtr {
15558 err: Box::into_raw(Box::new(e)),
15563 /// Checks if the given object is currently in the success state
15565 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
15569 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
15570 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
15571 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
15572 fn drop(&mut self) {
15573 if self.result_ok {
15574 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15575 let _ = unsafe { Box::from_raw(self.contents.result) };
15578 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15579 let _ = unsafe { Box::from_raw(self.contents.err) };
15584 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
15585 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
15586 let contents = if o.result_ok {
15587 let result = unsafe { o.contents.result };
15588 unsafe { o.contents.result = core::ptr::null_mut() };
15589 CResult_OpenChannelV2DecodeErrorZPtr { result }
15591 let err = unsafe { o.contents.err };
15592 unsafe { o.contents.err = core::ptr::null_mut(); }
15593 CResult_OpenChannelV2DecodeErrorZPtr { err }
15597 result_ok: o.result_ok,
15601 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
15602 fn clone(&self) -> Self {
15603 if self.result_ok {
15604 Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
15605 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
15608 Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
15609 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15615 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
15616 /// but with all dynamically-allocated buffers duplicated in new buffers.
15617 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
15619 /// The contents of CResult_RevokeAndACKDecodeErrorZ
15620 pub union CResult_RevokeAndACKDecodeErrorZPtr {
15621 /// A pointer to the contents in the success state.
15622 /// Reading from this pointer when `result_ok` is not set is undefined.
15623 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
15624 /// A pointer to the contents in the error state.
15625 /// Reading from this pointer when `result_ok` is set is undefined.
15626 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15629 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
15630 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
15631 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15632 pub struct CResult_RevokeAndACKDecodeErrorZ {
15633 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
15634 /// `err` or `result` depending on the state of `result_ok`.
15635 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
15636 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
15637 pub result_ok: bool,
15640 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15641 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
15642 CResult_RevokeAndACKDecodeErrorZ {
15643 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15644 result: Box::into_raw(Box::new(o)),
15650 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15651 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
15652 CResult_RevokeAndACKDecodeErrorZ {
15653 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15654 err: Box::into_raw(Box::new(e)),
15659 /// Checks if the given object is currently in the success state
15661 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
15665 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15666 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
15667 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
15668 fn drop(&mut self) {
15669 if self.result_ok {
15670 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15671 let _ = unsafe { Box::from_raw(self.contents.result) };
15674 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15675 let _ = unsafe { Box::from_raw(self.contents.err) };
15680 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
15681 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
15682 let contents = if o.result_ok {
15683 let result = unsafe { o.contents.result };
15684 unsafe { o.contents.result = core::ptr::null_mut() };
15685 CResult_RevokeAndACKDecodeErrorZPtr { result }
15687 let err = unsafe { o.contents.err };
15688 unsafe { o.contents.err = core::ptr::null_mut(); }
15689 CResult_RevokeAndACKDecodeErrorZPtr { err }
15693 result_ok: o.result_ok,
15697 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
15698 fn clone(&self) -> Self {
15699 if self.result_ok {
15700 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15701 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
15704 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15705 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15711 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15712 /// but with all dynamically-allocated buffers duplicated in new buffers.
15713 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
15715 /// The contents of CResult_ShutdownDecodeErrorZ
15716 pub union CResult_ShutdownDecodeErrorZPtr {
15717 /// A pointer to the contents in the success state.
15718 /// Reading from this pointer when `result_ok` is not set is undefined.
15719 pub result: *mut crate::lightning::ln::msgs::Shutdown,
15720 /// A pointer to the contents in the error state.
15721 /// Reading from this pointer when `result_ok` is set is undefined.
15722 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15725 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
15726 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
15727 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15728 pub struct CResult_ShutdownDecodeErrorZ {
15729 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
15730 /// `err` or `result` depending on the state of `result_ok`.
15731 pub contents: CResult_ShutdownDecodeErrorZPtr,
15732 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
15733 pub result_ok: bool,
15736 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15737 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
15738 CResult_ShutdownDecodeErrorZ {
15739 contents: CResult_ShutdownDecodeErrorZPtr {
15740 result: Box::into_raw(Box::new(o)),
15746 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15747 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
15748 CResult_ShutdownDecodeErrorZ {
15749 contents: CResult_ShutdownDecodeErrorZPtr {
15750 err: Box::into_raw(Box::new(e)),
15755 /// Checks if the given object is currently in the success state
15757 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
15761 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
15762 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
15763 impl Drop for CResult_ShutdownDecodeErrorZ {
15764 fn drop(&mut self) {
15765 if self.result_ok {
15766 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15767 let _ = unsafe { Box::from_raw(self.contents.result) };
15770 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15771 let _ = unsafe { Box::from_raw(self.contents.err) };
15776 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
15777 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
15778 let contents = if o.result_ok {
15779 let result = unsafe { o.contents.result };
15780 unsafe { o.contents.result = core::ptr::null_mut() };
15781 CResult_ShutdownDecodeErrorZPtr { result }
15783 let err = unsafe { o.contents.err };
15784 unsafe { o.contents.err = core::ptr::null_mut(); }
15785 CResult_ShutdownDecodeErrorZPtr { err }
15789 result_ok: o.result_ok,
15793 impl Clone for CResult_ShutdownDecodeErrorZ {
15794 fn clone(&self) -> Self {
15795 if self.result_ok {
15796 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
15797 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
15800 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
15801 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15807 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
15808 /// but with all dynamically-allocated buffers duplicated in new buffers.
15809 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
15811 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
15812 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
15813 /// A pointer to the contents in the success state.
15814 /// Reading from this pointer when `result_ok` is not set is undefined.
15815 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15816 /// A pointer to the contents in the error state.
15817 /// Reading from this pointer when `result_ok` is set is undefined.
15818 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15821 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
15822 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15823 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15824 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
15825 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
15826 /// `err` or `result` depending on the state of `result_ok`.
15827 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
15828 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
15829 pub result_ok: bool,
15832 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15833 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
15834 CResult_UpdateFailHTLCDecodeErrorZ {
15835 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15836 result: Box::into_raw(Box::new(o)),
15842 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15843 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
15844 CResult_UpdateFailHTLCDecodeErrorZ {
15845 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15846 err: Box::into_raw(Box::new(e)),
15851 /// Checks if the given object is currently in the success state
15853 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
15857 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15858 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
15859 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
15860 fn drop(&mut self) {
15861 if self.result_ok {
15862 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15863 let _ = unsafe { Box::from_raw(self.contents.result) };
15866 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15867 let _ = unsafe { Box::from_raw(self.contents.err) };
15872 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
15873 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15874 let contents = if o.result_ok {
15875 let result = unsafe { o.contents.result };
15876 unsafe { o.contents.result = core::ptr::null_mut() };
15877 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
15879 let err = unsafe { o.contents.err };
15880 unsafe { o.contents.err = core::ptr::null_mut(); }
15881 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
15885 result_ok: o.result_ok,
15889 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
15890 fn clone(&self) -> Self {
15891 if self.result_ok {
15892 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15893 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
15896 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15897 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15903 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15904 /// but with all dynamically-allocated buffers duplicated in new buffers.
15905 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
15907 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
15908 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15909 /// A pointer to the contents in the success state.
15910 /// Reading from this pointer when `result_ok` is not set is undefined.
15911 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15912 /// A pointer to the contents in the error state.
15913 /// Reading from this pointer when `result_ok` is set is undefined.
15914 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15917 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
15918 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15919 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15920 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15921 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
15922 /// `err` or `result` depending on the state of `result_ok`.
15923 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
15924 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
15925 pub result_ok: bool,
15928 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15929 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15930 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15931 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15932 result: Box::into_raw(Box::new(o)),
15938 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15939 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15940 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15941 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15942 err: Box::into_raw(Box::new(e)),
15947 /// Checks if the given object is currently in the success state
15949 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
15953 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15954 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
15955 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15956 fn drop(&mut self) {
15957 if self.result_ok {
15958 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15959 let _ = unsafe { Box::from_raw(self.contents.result) };
15962 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15963 let _ = unsafe { Box::from_raw(self.contents.err) };
15968 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15969 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15970 let contents = if o.result_ok {
15971 let result = unsafe { o.contents.result };
15972 unsafe { o.contents.result = core::ptr::null_mut() };
15973 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
15975 let err = unsafe { o.contents.err };
15976 unsafe { o.contents.err = core::ptr::null_mut(); }
15977 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
15981 result_ok: o.result_ok,
15985 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15986 fn clone(&self) -> Self {
15987 if self.result_ok {
15988 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15989 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
15992 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15993 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15999 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
16000 /// but with all dynamically-allocated buffers duplicated in new buffers.
16001 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
16003 /// The contents of CResult_UpdateFeeDecodeErrorZ
16004 pub union CResult_UpdateFeeDecodeErrorZPtr {
16005 /// A pointer to the contents in the success state.
16006 /// Reading from this pointer when `result_ok` is not set is undefined.
16007 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
16008 /// A pointer to the contents in the error state.
16009 /// Reading from this pointer when `result_ok` is set is undefined.
16010 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16013 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
16014 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
16015 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16016 pub struct CResult_UpdateFeeDecodeErrorZ {
16017 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
16018 /// `err` or `result` depending on the state of `result_ok`.
16019 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
16020 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
16021 pub result_ok: bool,
16024 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
16025 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
16026 CResult_UpdateFeeDecodeErrorZ {
16027 contents: CResult_UpdateFeeDecodeErrorZPtr {
16028 result: Box::into_raw(Box::new(o)),
16034 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
16035 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
16036 CResult_UpdateFeeDecodeErrorZ {
16037 contents: CResult_UpdateFeeDecodeErrorZPtr {
16038 err: Box::into_raw(Box::new(e)),
16043 /// Checks if the given object is currently in the success state
16045 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
16049 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
16050 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
16051 impl Drop for CResult_UpdateFeeDecodeErrorZ {
16052 fn drop(&mut self) {
16053 if self.result_ok {
16054 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16055 let _ = unsafe { Box::from_raw(self.contents.result) };
16058 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16059 let _ = unsafe { Box::from_raw(self.contents.err) };
16064 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
16065 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
16066 let contents = if o.result_ok {
16067 let result = unsafe { o.contents.result };
16068 unsafe { o.contents.result = core::ptr::null_mut() };
16069 CResult_UpdateFeeDecodeErrorZPtr { result }
16071 let err = unsafe { o.contents.err };
16072 unsafe { o.contents.err = core::ptr::null_mut(); }
16073 CResult_UpdateFeeDecodeErrorZPtr { err }
16077 result_ok: o.result_ok,
16081 impl Clone for CResult_UpdateFeeDecodeErrorZ {
16082 fn clone(&self) -> Self {
16083 if self.result_ok {
16084 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
16085 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
16088 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
16089 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16095 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
16096 /// but with all dynamically-allocated buffers duplicated in new buffers.
16097 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
16099 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
16100 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16101 /// A pointer to the contents in the success state.
16102 /// Reading from this pointer when `result_ok` is not set is undefined.
16103 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
16104 /// A pointer to the contents in the error state.
16105 /// Reading from this pointer when `result_ok` is set is undefined.
16106 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16109 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
16110 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16112 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
16113 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
16114 /// `err` or `result` depending on the state of `result_ok`.
16115 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
16116 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
16117 pub result_ok: bool,
16120 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
16121 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16122 CResult_UpdateFulfillHTLCDecodeErrorZ {
16123 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16124 result: Box::into_raw(Box::new(o)),
16130 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
16131 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16132 CResult_UpdateFulfillHTLCDecodeErrorZ {
16133 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16134 err: Box::into_raw(Box::new(e)),
16139 /// Checks if the given object is currently in the success state
16141 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
16145 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
16146 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
16147 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
16148 fn drop(&mut self) {
16149 if self.result_ok {
16150 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16151 let _ = unsafe { Box::from_raw(self.contents.result) };
16154 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16155 let _ = unsafe { Box::from_raw(self.contents.err) };
16160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
16161 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16162 let contents = if o.result_ok {
16163 let result = unsafe { o.contents.result };
16164 unsafe { o.contents.result = core::ptr::null_mut() };
16165 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
16167 let err = unsafe { o.contents.err };
16168 unsafe { o.contents.err = core::ptr::null_mut(); }
16169 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
16173 result_ok: o.result_ok,
16177 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
16178 fn clone(&self) -> Self {
16179 if self.result_ok {
16180 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16181 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
16184 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16185 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16191 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
16192 /// but with all dynamically-allocated buffers duplicated in new buffers.
16193 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
16195 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
16196 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
16197 /// A pointer to the contents in the success state.
16198 /// Reading from this pointer when `result_ok` is not set is undefined.
16199 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
16200 /// A pointer to the contents in the error state.
16201 /// Reading from this pointer when `result_ok` is set is undefined.
16202 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16205 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
16206 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16208 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
16209 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
16210 /// `err` or `result` depending on the state of `result_ok`.
16211 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
16212 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
16213 pub result_ok: bool,
16216 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
16217 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
16218 CResult_UpdateAddHTLCDecodeErrorZ {
16219 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16220 result: Box::into_raw(Box::new(o)),
16226 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
16227 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
16228 CResult_UpdateAddHTLCDecodeErrorZ {
16229 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16230 err: Box::into_raw(Box::new(e)),
16235 /// Checks if the given object is currently in the success state
16237 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
16241 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
16242 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
16243 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
16244 fn drop(&mut self) {
16245 if self.result_ok {
16246 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16247 let _ = unsafe { Box::from_raw(self.contents.result) };
16250 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16251 let _ = unsafe { Box::from_raw(self.contents.err) };
16256 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
16257 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16258 let contents = if o.result_ok {
16259 let result = unsafe { o.contents.result };
16260 unsafe { o.contents.result = core::ptr::null_mut() };
16261 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
16263 let err = unsafe { o.contents.err };
16264 unsafe { o.contents.err = core::ptr::null_mut(); }
16265 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
16269 result_ok: o.result_ok,
16273 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
16274 fn clone(&self) -> Self {
16275 if self.result_ok {
16276 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16277 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
16280 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16281 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16287 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
16288 /// but with all dynamically-allocated buffers duplicated in new buffers.
16289 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
16291 /// The contents of CResult_OnionMessageDecodeErrorZ
16292 pub union CResult_OnionMessageDecodeErrorZPtr {
16293 /// A pointer to the contents in the success state.
16294 /// Reading from this pointer when `result_ok` is not set is undefined.
16295 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
16296 /// A pointer to the contents in the error state.
16297 /// Reading from this pointer when `result_ok` is set is undefined.
16298 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16301 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
16302 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16304 pub struct CResult_OnionMessageDecodeErrorZ {
16305 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
16306 /// `err` or `result` depending on the state of `result_ok`.
16307 pub contents: CResult_OnionMessageDecodeErrorZPtr,
16308 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
16309 pub result_ok: bool,
16312 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
16313 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
16314 CResult_OnionMessageDecodeErrorZ {
16315 contents: CResult_OnionMessageDecodeErrorZPtr {
16316 result: Box::into_raw(Box::new(o)),
16322 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
16323 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
16324 CResult_OnionMessageDecodeErrorZ {
16325 contents: CResult_OnionMessageDecodeErrorZPtr {
16326 err: Box::into_raw(Box::new(e)),
16331 /// Checks if the given object is currently in the success state
16333 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
16337 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
16338 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
16339 impl Drop for CResult_OnionMessageDecodeErrorZ {
16340 fn drop(&mut self) {
16341 if self.result_ok {
16342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16343 let _ = unsafe { Box::from_raw(self.contents.result) };
16346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16347 let _ = unsafe { Box::from_raw(self.contents.err) };
16352 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
16353 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16354 let contents = if o.result_ok {
16355 let result = unsafe { o.contents.result };
16356 unsafe { o.contents.result = core::ptr::null_mut() };
16357 CResult_OnionMessageDecodeErrorZPtr { result }
16359 let err = unsafe { o.contents.err };
16360 unsafe { o.contents.err = core::ptr::null_mut(); }
16361 CResult_OnionMessageDecodeErrorZPtr { err }
16365 result_ok: o.result_ok,
16369 impl Clone for CResult_OnionMessageDecodeErrorZ {
16370 fn clone(&self) -> Self {
16371 if self.result_ok {
16372 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
16373 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
16376 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
16377 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16383 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
16384 /// but with all dynamically-allocated buffers duplicated in new buffers.
16385 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
16387 /// The contents of CResult_PingDecodeErrorZ
16388 pub union CResult_PingDecodeErrorZPtr {
16389 /// A pointer to the contents in the success state.
16390 /// Reading from this pointer when `result_ok` is not set is undefined.
16391 pub result: *mut crate::lightning::ln::msgs::Ping,
16392 /// A pointer to the contents in the error state.
16393 /// Reading from this pointer when `result_ok` is set is undefined.
16394 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16397 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
16398 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
16399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16400 pub struct CResult_PingDecodeErrorZ {
16401 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
16402 /// `err` or `result` depending on the state of `result_ok`.
16403 pub contents: CResult_PingDecodeErrorZPtr,
16404 /// Whether this CResult_PingDecodeErrorZ represents a success state.
16405 pub result_ok: bool,
16408 /// Creates a new CResult_PingDecodeErrorZ in the success state.
16409 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
16410 CResult_PingDecodeErrorZ {
16411 contents: CResult_PingDecodeErrorZPtr {
16412 result: Box::into_raw(Box::new(o)),
16418 /// Creates a new CResult_PingDecodeErrorZ in the error state.
16419 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
16420 CResult_PingDecodeErrorZ {
16421 contents: CResult_PingDecodeErrorZPtr {
16422 err: Box::into_raw(Box::new(e)),
16427 /// Checks if the given object is currently in the success state
16429 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
16433 /// Frees any resources used by the CResult_PingDecodeErrorZ.
16434 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
16435 impl Drop for CResult_PingDecodeErrorZ {
16436 fn drop(&mut self) {
16437 if self.result_ok {
16438 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16439 let _ = unsafe { Box::from_raw(self.contents.result) };
16442 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16443 let _ = unsafe { Box::from_raw(self.contents.err) };
16448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
16449 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
16450 let contents = if o.result_ok {
16451 let result = unsafe { o.contents.result };
16452 unsafe { o.contents.result = core::ptr::null_mut() };
16453 CResult_PingDecodeErrorZPtr { result }
16455 let err = unsafe { o.contents.err };
16456 unsafe { o.contents.err = core::ptr::null_mut(); }
16457 CResult_PingDecodeErrorZPtr { err }
16461 result_ok: o.result_ok,
16465 impl Clone for CResult_PingDecodeErrorZ {
16466 fn clone(&self) -> Self {
16467 if self.result_ok {
16468 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
16469 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
16472 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
16473 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16479 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16480 /// but with all dynamically-allocated buffers duplicated in new buffers.
16481 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
16483 /// The contents of CResult_PongDecodeErrorZ
16484 pub union CResult_PongDecodeErrorZPtr {
16485 /// A pointer to the contents in the success state.
16486 /// Reading from this pointer when `result_ok` is not set is undefined.
16487 pub result: *mut crate::lightning::ln::msgs::Pong,
16488 /// A pointer to the contents in the error state.
16489 /// Reading from this pointer when `result_ok` is set is undefined.
16490 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16493 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
16494 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
16495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16496 pub struct CResult_PongDecodeErrorZ {
16497 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
16498 /// `err` or `result` depending on the state of `result_ok`.
16499 pub contents: CResult_PongDecodeErrorZPtr,
16500 /// Whether this CResult_PongDecodeErrorZ represents a success state.
16501 pub result_ok: bool,
16504 /// Creates a new CResult_PongDecodeErrorZ in the success state.
16505 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
16506 CResult_PongDecodeErrorZ {
16507 contents: CResult_PongDecodeErrorZPtr {
16508 result: Box::into_raw(Box::new(o)),
16514 /// Creates a new CResult_PongDecodeErrorZ in the error state.
16515 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
16516 CResult_PongDecodeErrorZ {
16517 contents: CResult_PongDecodeErrorZPtr {
16518 err: Box::into_raw(Box::new(e)),
16523 /// Checks if the given object is currently in the success state
16525 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
16529 /// Frees any resources used by the CResult_PongDecodeErrorZ.
16530 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
16531 impl Drop for CResult_PongDecodeErrorZ {
16532 fn drop(&mut self) {
16533 if self.result_ok {
16534 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16535 let _ = unsafe { Box::from_raw(self.contents.result) };
16538 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16539 let _ = unsafe { Box::from_raw(self.contents.err) };
16544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
16545 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
16546 let contents = if o.result_ok {
16547 let result = unsafe { o.contents.result };
16548 unsafe { o.contents.result = core::ptr::null_mut() };
16549 CResult_PongDecodeErrorZPtr { result }
16551 let err = unsafe { o.contents.err };
16552 unsafe { o.contents.err = core::ptr::null_mut(); }
16553 CResult_PongDecodeErrorZPtr { err }
16557 result_ok: o.result_ok,
16561 impl Clone for CResult_PongDecodeErrorZ {
16562 fn clone(&self) -> Self {
16563 if self.result_ok {
16564 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
16565 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
16568 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
16569 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16575 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16576 /// but with all dynamically-allocated buffers duplicated in new buffers.
16577 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
16579 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
16580 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16581 /// A pointer to the contents in the success state.
16582 /// Reading from this pointer when `result_ok` is not set is undefined.
16583 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
16584 /// A pointer to the contents in the error state.
16585 /// Reading from this pointer when `result_ok` is set is undefined.
16586 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16589 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16590 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16592 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16593 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
16594 /// `err` or `result` depending on the state of `result_ok`.
16595 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
16596 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
16597 pub result_ok: bool,
16600 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16601 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16602 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16603 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16604 result: Box::into_raw(Box::new(o)),
16610 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16611 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16612 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16613 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16614 err: Box::into_raw(Box::new(e)),
16619 /// Checks if the given object is currently in the success state
16621 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
16625 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16626 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
16627 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16628 fn drop(&mut self) {
16629 if self.result_ok {
16630 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16631 let _ = unsafe { Box::from_raw(self.contents.result) };
16634 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16635 let _ = unsafe { Box::from_raw(self.contents.err) };
16640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16641 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16642 let contents = if o.result_ok {
16643 let result = unsafe { o.contents.result };
16644 unsafe { o.contents.result = core::ptr::null_mut() };
16645 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
16647 let err = unsafe { o.contents.err };
16648 unsafe { o.contents.err = core::ptr::null_mut(); }
16649 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
16653 result_ok: o.result_ok,
16657 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16658 fn clone(&self) -> Self {
16659 if self.result_ok {
16660 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16661 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16664 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16665 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16671 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16672 /// but with all dynamically-allocated buffers duplicated in new buffers.
16673 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16675 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
16676 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
16677 /// A pointer to the contents in the success state.
16678 /// Reading from this pointer when `result_ok` is not set is undefined.
16679 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
16680 /// A pointer to the contents in the error state.
16681 /// Reading from this pointer when `result_ok` is set is undefined.
16682 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16685 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16686 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16687 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16688 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
16689 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
16690 /// `err` or `result` depending on the state of `result_ok`.
16691 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
16692 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
16693 pub result_ok: bool,
16696 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16697 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
16698 CResult_ChannelAnnouncementDecodeErrorZ {
16699 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16700 result: Box::into_raw(Box::new(o)),
16706 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16707 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
16708 CResult_ChannelAnnouncementDecodeErrorZ {
16709 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16710 err: Box::into_raw(Box::new(e)),
16715 /// Checks if the given object is currently in the success state
16717 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
16721 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16722 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
16723 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
16724 fn drop(&mut self) {
16725 if self.result_ok {
16726 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16727 let _ = unsafe { Box::from_raw(self.contents.result) };
16730 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16731 let _ = unsafe { Box::from_raw(self.contents.err) };
16736 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
16737 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16738 let contents = if o.result_ok {
16739 let result = unsafe { o.contents.result };
16740 unsafe { o.contents.result = core::ptr::null_mut() };
16741 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
16743 let err = unsafe { o.contents.err };
16744 unsafe { o.contents.err = core::ptr::null_mut(); }
16745 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
16749 result_ok: o.result_ok,
16753 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
16754 fn clone(&self) -> Self {
16755 if self.result_ok {
16756 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16757 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16760 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16761 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16767 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16768 /// but with all dynamically-allocated buffers duplicated in new buffers.
16769 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16771 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
16772 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16773 /// A pointer to the contents in the success state.
16774 /// Reading from this pointer when `result_ok` is not set is undefined.
16775 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
16776 /// A pointer to the contents in the error state.
16777 /// Reading from this pointer when `result_ok` is set is undefined.
16778 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16781 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16782 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16783 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16784 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
16785 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
16786 /// `err` or `result` depending on the state of `result_ok`.
16787 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
16788 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
16789 pub result_ok: bool,
16792 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16793 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16794 CResult_UnsignedChannelUpdateDecodeErrorZ {
16795 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16796 result: Box::into_raw(Box::new(o)),
16802 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16803 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16804 CResult_UnsignedChannelUpdateDecodeErrorZ {
16805 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16806 err: Box::into_raw(Box::new(e)),
16811 /// Checks if the given object is currently in the success state
16813 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
16817 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16818 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
16819 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
16820 fn drop(&mut self) {
16821 if self.result_ok {
16822 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16823 let _ = unsafe { Box::from_raw(self.contents.result) };
16826 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16827 let _ = unsafe { Box::from_raw(self.contents.err) };
16832 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
16833 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16834 let contents = if o.result_ok {
16835 let result = unsafe { o.contents.result };
16836 unsafe { o.contents.result = core::ptr::null_mut() };
16837 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
16839 let err = unsafe { o.contents.err };
16840 unsafe { o.contents.err = core::ptr::null_mut(); }
16841 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
16845 result_ok: o.result_ok,
16849 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
16850 fn clone(&self) -> Self {
16851 if self.result_ok {
16852 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16853 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
16856 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16857 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16863 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16864 /// but with all dynamically-allocated buffers duplicated in new buffers.
16865 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16867 /// The contents of CResult_ChannelUpdateDecodeErrorZ
16868 pub union CResult_ChannelUpdateDecodeErrorZPtr {
16869 /// A pointer to the contents in the success state.
16870 /// Reading from this pointer when `result_ok` is not set is undefined.
16871 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
16872 /// A pointer to the contents in the error state.
16873 /// Reading from this pointer when `result_ok` is set is undefined.
16874 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16877 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16878 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16879 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16880 pub struct CResult_ChannelUpdateDecodeErrorZ {
16881 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
16882 /// `err` or `result` depending on the state of `result_ok`.
16883 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
16884 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
16885 pub result_ok: bool,
16888 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16889 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
16890 CResult_ChannelUpdateDecodeErrorZ {
16891 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16892 result: Box::into_raw(Box::new(o)),
16898 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16899 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
16900 CResult_ChannelUpdateDecodeErrorZ {
16901 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16902 err: Box::into_raw(Box::new(e)),
16907 /// Checks if the given object is currently in the success state
16909 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
16913 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16914 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
16915 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
16916 fn drop(&mut self) {
16917 if self.result_ok {
16918 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16919 let _ = unsafe { Box::from_raw(self.contents.result) };
16922 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16923 let _ = unsafe { Box::from_raw(self.contents.err) };
16928 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
16929 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16930 let contents = if o.result_ok {
16931 let result = unsafe { o.contents.result };
16932 unsafe { o.contents.result = core::ptr::null_mut() };
16933 CResult_ChannelUpdateDecodeErrorZPtr { result }
16935 let err = unsafe { o.contents.err };
16936 unsafe { o.contents.err = core::ptr::null_mut(); }
16937 CResult_ChannelUpdateDecodeErrorZPtr { err }
16941 result_ok: o.result_ok,
16945 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
16946 fn clone(&self) -> Self {
16947 if self.result_ok {
16948 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16949 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
16952 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16953 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16959 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16960 /// but with all dynamically-allocated buffers duplicated in new buffers.
16961 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16963 /// The contents of CResult_ErrorMessageDecodeErrorZ
16964 pub union CResult_ErrorMessageDecodeErrorZPtr {
16965 /// A pointer to the contents in the success state.
16966 /// Reading from this pointer when `result_ok` is not set is undefined.
16967 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
16968 /// A pointer to the contents in the error state.
16969 /// Reading from this pointer when `result_ok` is set is undefined.
16970 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16973 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
16974 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16976 pub struct CResult_ErrorMessageDecodeErrorZ {
16977 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
16978 /// `err` or `result` depending on the state of `result_ok`.
16979 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
16980 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
16981 pub result_ok: bool,
16984 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16985 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
16986 CResult_ErrorMessageDecodeErrorZ {
16987 contents: CResult_ErrorMessageDecodeErrorZPtr {
16988 result: Box::into_raw(Box::new(o)),
16994 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16995 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
16996 CResult_ErrorMessageDecodeErrorZ {
16997 contents: CResult_ErrorMessageDecodeErrorZPtr {
16998 err: Box::into_raw(Box::new(e)),
17003 /// Checks if the given object is currently in the success state
17005 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
17009 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
17010 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
17011 impl Drop for CResult_ErrorMessageDecodeErrorZ {
17012 fn drop(&mut self) {
17013 if self.result_ok {
17014 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17015 let _ = unsafe { Box::from_raw(self.contents.result) };
17018 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17019 let _ = unsafe { Box::from_raw(self.contents.err) };
17024 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
17025 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17026 let contents = if o.result_ok {
17027 let result = unsafe { o.contents.result };
17028 unsafe { o.contents.result = core::ptr::null_mut() };
17029 CResult_ErrorMessageDecodeErrorZPtr { result }
17031 let err = unsafe { o.contents.err };
17032 unsafe { o.contents.err = core::ptr::null_mut(); }
17033 CResult_ErrorMessageDecodeErrorZPtr { err }
17037 result_ok: o.result_ok,
17041 impl Clone for CResult_ErrorMessageDecodeErrorZ {
17042 fn clone(&self) -> Self {
17043 if self.result_ok {
17044 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
17045 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
17048 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
17049 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17055 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
17056 /// but with all dynamically-allocated buffers duplicated in new buffers.
17057 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
17059 /// The contents of CResult_WarningMessageDecodeErrorZ
17060 pub union CResult_WarningMessageDecodeErrorZPtr {
17061 /// A pointer to the contents in the success state.
17062 /// Reading from this pointer when `result_ok` is not set is undefined.
17063 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
17064 /// A pointer to the contents in the error state.
17065 /// Reading from this pointer when `result_ok` is set is undefined.
17066 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17069 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
17070 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
17071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17072 pub struct CResult_WarningMessageDecodeErrorZ {
17073 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
17074 /// `err` or `result` depending on the state of `result_ok`.
17075 pub contents: CResult_WarningMessageDecodeErrorZPtr,
17076 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
17077 pub result_ok: bool,
17080 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
17081 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
17082 CResult_WarningMessageDecodeErrorZ {
17083 contents: CResult_WarningMessageDecodeErrorZPtr {
17084 result: Box::into_raw(Box::new(o)),
17090 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
17091 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
17092 CResult_WarningMessageDecodeErrorZ {
17093 contents: CResult_WarningMessageDecodeErrorZPtr {
17094 err: Box::into_raw(Box::new(e)),
17099 /// Checks if the given object is currently in the success state
17101 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
17105 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
17106 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
17107 impl Drop for CResult_WarningMessageDecodeErrorZ {
17108 fn drop(&mut self) {
17109 if self.result_ok {
17110 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17111 let _ = unsafe { Box::from_raw(self.contents.result) };
17114 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17115 let _ = unsafe { Box::from_raw(self.contents.err) };
17120 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
17121 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17122 let contents = if o.result_ok {
17123 let result = unsafe { o.contents.result };
17124 unsafe { o.contents.result = core::ptr::null_mut() };
17125 CResult_WarningMessageDecodeErrorZPtr { result }
17127 let err = unsafe { o.contents.err };
17128 unsafe { o.contents.err = core::ptr::null_mut(); }
17129 CResult_WarningMessageDecodeErrorZPtr { err }
17133 result_ok: o.result_ok,
17137 impl Clone for CResult_WarningMessageDecodeErrorZ {
17138 fn clone(&self) -> Self {
17139 if self.result_ok {
17140 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
17141 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
17144 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
17145 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17151 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
17152 /// but with all dynamically-allocated buffers duplicated in new buffers.
17153 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
17155 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
17156 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17157 /// A pointer to the contents in the success state.
17158 /// Reading from this pointer when `result_ok` is not set is undefined.
17159 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
17160 /// A pointer to the contents in the error state.
17161 /// Reading from this pointer when `result_ok` is set is undefined.
17162 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17165 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17166 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17167 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17168 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17169 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
17170 /// `err` or `result` depending on the state of `result_ok`.
17171 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
17172 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
17173 pub result_ok: bool,
17176 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
17177 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17178 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17179 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17180 result: Box::into_raw(Box::new(o)),
17186 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
17187 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17188 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17189 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17190 err: Box::into_raw(Box::new(e)),
17195 /// Checks if the given object is currently in the success state
17197 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
17201 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
17202 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
17203 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17204 fn drop(&mut self) {
17205 if self.result_ok {
17206 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17207 let _ = unsafe { Box::from_raw(self.contents.result) };
17210 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17211 let _ = unsafe { Box::from_raw(self.contents.err) };
17216 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17217 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17218 let contents = if o.result_ok {
17219 let result = unsafe { o.contents.result };
17220 unsafe { o.contents.result = core::ptr::null_mut() };
17221 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
17223 let err = unsafe { o.contents.err };
17224 unsafe { o.contents.err = core::ptr::null_mut(); }
17225 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
17229 result_ok: o.result_ok,
17233 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17234 fn clone(&self) -> Self {
17235 if self.result_ok {
17236 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17237 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17240 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17241 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17247 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
17248 /// but with all dynamically-allocated buffers duplicated in new buffers.
17249 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17251 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
17252 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
17253 /// A pointer to the contents in the success state.
17254 /// Reading from this pointer when `result_ok` is not set is undefined.
17255 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
17256 /// A pointer to the contents in the error state.
17257 /// Reading from this pointer when `result_ok` is set is undefined.
17258 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17261 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17262 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17263 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17264 pub struct CResult_NodeAnnouncementDecodeErrorZ {
17265 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
17266 /// `err` or `result` depending on the state of `result_ok`.
17267 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
17268 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
17269 pub result_ok: bool,
17272 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
17273 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
17274 CResult_NodeAnnouncementDecodeErrorZ {
17275 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17276 result: Box::into_raw(Box::new(o)),
17282 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
17283 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
17284 CResult_NodeAnnouncementDecodeErrorZ {
17285 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17286 err: Box::into_raw(Box::new(e)),
17291 /// Checks if the given object is currently in the success state
17293 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
17297 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
17298 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
17299 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
17300 fn drop(&mut self) {
17301 if self.result_ok {
17302 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17303 let _ = unsafe { Box::from_raw(self.contents.result) };
17306 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17307 let _ = unsafe { Box::from_raw(self.contents.err) };
17312 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
17313 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17314 let contents = if o.result_ok {
17315 let result = unsafe { o.contents.result };
17316 unsafe { o.contents.result = core::ptr::null_mut() };
17317 CResult_NodeAnnouncementDecodeErrorZPtr { result }
17319 let err = unsafe { o.contents.err };
17320 unsafe { o.contents.err = core::ptr::null_mut(); }
17321 CResult_NodeAnnouncementDecodeErrorZPtr { err }
17325 result_ok: o.result_ok,
17329 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
17330 fn clone(&self) -> Self {
17331 if self.result_ok {
17332 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17333 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17336 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17337 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17343 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
17344 /// but with all dynamically-allocated buffers duplicated in new buffers.
17345 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17347 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
17348 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
17349 /// A pointer to the contents in the success state.
17350 /// Reading from this pointer when `result_ok` is not set is undefined.
17351 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
17352 /// A pointer to the contents in the error state.
17353 /// Reading from this pointer when `result_ok` is set is undefined.
17354 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17357 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
17358 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
17359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17360 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
17361 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
17362 /// `err` or `result` depending on the state of `result_ok`.
17363 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
17364 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
17365 pub result_ok: bool,
17368 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
17369 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17370 CResult_QueryShortChannelIdsDecodeErrorZ {
17371 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17372 result: Box::into_raw(Box::new(o)),
17378 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
17379 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17380 CResult_QueryShortChannelIdsDecodeErrorZ {
17381 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17382 err: Box::into_raw(Box::new(e)),
17387 /// Checks if the given object is currently in the success state
17389 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
17393 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
17394 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
17395 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
17396 fn drop(&mut self) {
17397 if self.result_ok {
17398 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17399 let _ = unsafe { Box::from_raw(self.contents.result) };
17402 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17403 let _ = unsafe { Box::from_raw(self.contents.err) };
17408 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
17409 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
17410 let contents = if o.result_ok {
17411 let result = unsafe { o.contents.result };
17412 unsafe { o.contents.result = core::ptr::null_mut() };
17413 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
17415 let err = unsafe { o.contents.err };
17416 unsafe { o.contents.err = core::ptr::null_mut(); }
17417 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
17421 result_ok: o.result_ok,
17425 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
17426 fn clone(&self) -> Self {
17427 if self.result_ok {
17428 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17429 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
17432 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17433 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17439 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
17440 /// but with all dynamically-allocated buffers duplicated in new buffers.
17441 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
17443 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
17444 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17445 /// A pointer to the contents in the success state.
17446 /// Reading from this pointer when `result_ok` is not set is undefined.
17447 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
17448 /// A pointer to the contents in the error state.
17449 /// Reading from this pointer when `result_ok` is set is undefined.
17450 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17453 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
17454 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
17455 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17456 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17457 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
17458 /// `err` or `result` depending on the state of `result_ok`.
17459 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
17460 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
17461 pub result_ok: bool,
17464 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
17465 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17466 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17467 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17468 result: Box::into_raw(Box::new(o)),
17474 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
17475 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17476 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17477 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17478 err: Box::into_raw(Box::new(e)),
17483 /// Checks if the given object is currently in the success state
17485 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
17489 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
17490 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
17491 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17492 fn drop(&mut self) {
17493 if self.result_ok {
17494 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17495 let _ = unsafe { Box::from_raw(self.contents.result) };
17498 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17499 let _ = unsafe { Box::from_raw(self.contents.err) };
17504 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17505 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
17506 let contents = if o.result_ok {
17507 let result = unsafe { o.contents.result };
17508 unsafe { o.contents.result = core::ptr::null_mut() };
17509 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
17511 let err = unsafe { o.contents.err };
17512 unsafe { o.contents.err = core::ptr::null_mut(); }
17513 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
17517 result_ok: o.result_ok,
17521 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17522 fn clone(&self) -> Self {
17523 if self.result_ok {
17524 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17525 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
17528 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17529 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17535 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
17536 /// but with all dynamically-allocated buffers duplicated in new buffers.
17537 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
17539 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
17540 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
17541 /// A pointer to the contents in the success state.
17542 /// Reading from this pointer when `result_ok` is not set is undefined.
17543 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
17544 /// A pointer to the contents in the error state.
17545 /// Reading from this pointer when `result_ok` is set is undefined.
17546 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17549 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
17550 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17552 pub struct CResult_QueryChannelRangeDecodeErrorZ {
17553 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
17554 /// `err` or `result` depending on the state of `result_ok`.
17555 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
17556 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
17557 pub result_ok: bool,
17560 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
17561 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
17562 CResult_QueryChannelRangeDecodeErrorZ {
17563 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17564 result: Box::into_raw(Box::new(o)),
17570 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
17571 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
17572 CResult_QueryChannelRangeDecodeErrorZ {
17573 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17574 err: Box::into_raw(Box::new(e)),
17579 /// Checks if the given object is currently in the success state
17581 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
17585 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
17586 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
17587 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
17588 fn drop(&mut self) {
17589 if self.result_ok {
17590 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17591 let _ = unsafe { Box::from_raw(self.contents.result) };
17594 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17595 let _ = unsafe { Box::from_raw(self.contents.err) };
17600 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
17601 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17602 let contents = if o.result_ok {
17603 let result = unsafe { o.contents.result };
17604 unsafe { o.contents.result = core::ptr::null_mut() };
17605 CResult_QueryChannelRangeDecodeErrorZPtr { result }
17607 let err = unsafe { o.contents.err };
17608 unsafe { o.contents.err = core::ptr::null_mut(); }
17609 CResult_QueryChannelRangeDecodeErrorZPtr { err }
17613 result_ok: o.result_ok,
17617 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
17618 fn clone(&self) -> Self {
17619 if self.result_ok {
17620 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17621 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
17624 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17625 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17631 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
17632 /// but with all dynamically-allocated buffers duplicated in new buffers.
17633 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17635 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
17636 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
17637 /// A pointer to the contents in the success state.
17638 /// Reading from this pointer when `result_ok` is not set is undefined.
17639 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
17640 /// A pointer to the contents in the error state.
17641 /// Reading from this pointer when `result_ok` is set is undefined.
17642 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17645 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
17646 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17648 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
17649 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
17650 /// `err` or `result` depending on the state of `result_ok`.
17651 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
17652 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
17653 pub result_ok: bool,
17656 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
17657 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
17658 CResult_ReplyChannelRangeDecodeErrorZ {
17659 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17660 result: Box::into_raw(Box::new(o)),
17666 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
17667 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
17668 CResult_ReplyChannelRangeDecodeErrorZ {
17669 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17670 err: Box::into_raw(Box::new(e)),
17675 /// Checks if the given object is currently in the success state
17677 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
17681 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
17682 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
17683 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
17684 fn drop(&mut self) {
17685 if self.result_ok {
17686 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17687 let _ = unsafe { Box::from_raw(self.contents.result) };
17690 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17691 let _ = unsafe { Box::from_raw(self.contents.err) };
17696 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
17697 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17698 let contents = if o.result_ok {
17699 let result = unsafe { o.contents.result };
17700 unsafe { o.contents.result = core::ptr::null_mut() };
17701 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
17703 let err = unsafe { o.contents.err };
17704 unsafe { o.contents.err = core::ptr::null_mut(); }
17705 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
17709 result_ok: o.result_ok,
17713 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
17714 fn clone(&self) -> Self {
17715 if self.result_ok {
17716 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17717 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
17720 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17721 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17727 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
17728 /// but with all dynamically-allocated buffers duplicated in new buffers.
17729 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17731 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
17732 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
17733 /// A pointer to the contents in the success state.
17734 /// Reading from this pointer when `result_ok` is not set is undefined.
17735 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
17736 /// A pointer to the contents in the error state.
17737 /// Reading from this pointer when `result_ok` is set is undefined.
17738 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17741 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
17742 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
17743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17744 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
17745 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
17746 /// `err` or `result` depending on the state of `result_ok`.
17747 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
17748 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
17749 pub result_ok: bool,
17752 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
17753 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
17754 CResult_GossipTimestampFilterDecodeErrorZ {
17755 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17756 result: Box::into_raw(Box::new(o)),
17762 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
17763 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
17764 CResult_GossipTimestampFilterDecodeErrorZ {
17765 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17766 err: Box::into_raw(Box::new(e)),
17771 /// Checks if the given object is currently in the success state
17773 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
17777 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
17778 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
17779 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
17780 fn drop(&mut self) {
17781 if self.result_ok {
17782 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17783 let _ = unsafe { Box::from_raw(self.contents.result) };
17786 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17787 let _ = unsafe { Box::from_raw(self.contents.err) };
17792 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
17793 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
17794 let contents = if o.result_ok {
17795 let result = unsafe { o.contents.result };
17796 unsafe { o.contents.result = core::ptr::null_mut() };
17797 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
17799 let err = unsafe { o.contents.err };
17800 unsafe { o.contents.err = core::ptr::null_mut(); }
17801 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
17805 result_ok: o.result_ok,
17809 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
17810 fn clone(&self) -> Self {
17811 if self.result_ok {
17812 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17813 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
17816 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17817 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17823 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17824 /// but with all dynamically-allocated buffers duplicated in new buffers.
17825 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
17827 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
17828 /// This corresponds to std::vector in C++
17829 pub struct CVec_PhantomRouteHintsZ {
17830 /// The elements in the array.
17831 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17832 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
17833 /// The number of elements pointed to by `data`.
17836 impl CVec_PhantomRouteHintsZ {
17837 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
17838 if self.datalen == 0 { return Vec::new(); }
17839 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17840 self.data = core::ptr::null_mut();
17844 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
17845 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17848 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
17849 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
17850 let datalen = v.len();
17851 let data = Box::into_raw(v.into_boxed_slice());
17852 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17856 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17857 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
17858 impl Drop for CVec_PhantomRouteHintsZ {
17859 fn drop(&mut self) {
17860 if self.datalen == 0 { return; }
17861 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17864 impl Clone for CVec_PhantomRouteHintsZ {
17865 fn clone(&self) -> Self {
17866 let mut res = Vec::new();
17867 if self.datalen == 0 { return Self::from(res); }
17868 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17873 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
17874 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17875 /// A pointer to the contents in the success state.
17876 /// Reading from this pointer when `result_ok` is not set is undefined.
17877 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
17878 /// A pointer to the contents in the error state.
17879 /// Reading from this pointer when `result_ok` is set is undefined.
17880 pub err: *mut crate::lightning_invoice::SignOrCreationError,
17883 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
17884 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
17885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17886 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
17887 /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
17888 /// `err` or `result` depending on the state of `result_ok`.
17889 pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
17890 /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
17891 pub result_ok: bool,
17894 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
17895 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
17896 CResult_Bolt11InvoiceSignOrCreationErrorZ {
17897 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17898 result: Box::into_raw(Box::new(o)),
17904 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
17905 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
17906 CResult_Bolt11InvoiceSignOrCreationErrorZ {
17907 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17908 err: Box::into_raw(Box::new(e)),
17913 /// Checks if the given object is currently in the success state
17915 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
17919 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
17920 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
17921 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17922 fn drop(&mut self) {
17923 if self.result_ok {
17924 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17925 let _ = unsafe { Box::from_raw(self.contents.result) };
17928 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17929 let _ = unsafe { Box::from_raw(self.contents.err) };
17934 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17935 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
17936 let contents = if o.result_ok {
17937 let result = unsafe { o.contents.result };
17938 unsafe { o.contents.result = core::ptr::null_mut() };
17939 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
17941 let err = unsafe { o.contents.err };
17942 unsafe { o.contents.err = core::ptr::null_mut(); }
17943 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
17947 result_ok: o.result_ok,
17951 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
17952 fn clone(&self) -> Self {
17953 if self.result_ok {
17954 Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17955 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
17958 Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
17959 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
17965 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
17966 /// but with all dynamically-allocated buffers duplicated in new buffers.
17967 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
17969 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
17970 /// This corresponds to std::vector in C++
17971 pub struct CVec_FutureZ {
17972 /// The elements in the array.
17973 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17974 pub data: *mut crate::lightning::util::wakers::Future,
17975 /// The number of elements pointed to by `data`.
17978 impl CVec_FutureZ {
17979 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
17980 if self.datalen == 0 { return Vec::new(); }
17981 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17982 self.data = core::ptr::null_mut();
17986 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
17987 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17990 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
17991 fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
17992 let datalen = v.len();
17993 let data = Box::into_raw(v.into_boxed_slice());
17994 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17998 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17999 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
18000 impl Drop for CVec_FutureZ {
18001 fn drop(&mut self) {
18002 if self.datalen == 0 { return; }
18003 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18006 impl Clone for CVec_FutureZ {
18007 fn clone(&self) -> Self {
18008 let mut res = Vec::new();
18009 if self.datalen == 0 { return Self::from(res); }
18010 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18015 /// The contents of CResult_OffersMessageDecodeErrorZ
18016 pub union CResult_OffersMessageDecodeErrorZPtr {
18017 /// A pointer to the contents in the success state.
18018 /// Reading from this pointer when `result_ok` is not set is undefined.
18019 pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
18020 /// A pointer to the contents in the error state.
18021 /// Reading from this pointer when `result_ok` is set is undefined.
18022 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18025 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
18026 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
18027 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18028 pub struct CResult_OffersMessageDecodeErrorZ {
18029 /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
18030 /// `err` or `result` depending on the state of `result_ok`.
18031 pub contents: CResult_OffersMessageDecodeErrorZPtr,
18032 /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
18033 pub result_ok: bool,
18036 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
18037 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
18038 CResult_OffersMessageDecodeErrorZ {
18039 contents: CResult_OffersMessageDecodeErrorZPtr {
18040 result: Box::into_raw(Box::new(o)),
18046 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
18047 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
18048 CResult_OffersMessageDecodeErrorZ {
18049 contents: CResult_OffersMessageDecodeErrorZPtr {
18050 err: Box::into_raw(Box::new(e)),
18055 /// Checks if the given object is currently in the success state
18057 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
18061 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
18062 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
18063 impl Drop for CResult_OffersMessageDecodeErrorZ {
18064 fn drop(&mut self) {
18065 if self.result_ok {
18066 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18067 let _ = unsafe { Box::from_raw(self.contents.result) };
18070 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18071 let _ = unsafe { Box::from_raw(self.contents.err) };
18076 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
18077 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
18078 let contents = if o.result_ok {
18079 let result = unsafe { o.contents.result };
18080 unsafe { o.contents.result = core::ptr::null_mut() };
18081 CResult_OffersMessageDecodeErrorZPtr { result }
18083 let err = unsafe { o.contents.err };
18084 unsafe { o.contents.err = core::ptr::null_mut(); }
18085 CResult_OffersMessageDecodeErrorZPtr { err }
18089 result_ok: o.result_ok,
18093 impl Clone for CResult_OffersMessageDecodeErrorZ {
18094 fn clone(&self) -> Self {
18095 if self.result_ok {
18096 Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
18097 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
18100 Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
18101 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18107 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
18108 /// but with all dynamically-allocated buffers duplicated in new buffers.
18109 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
18111 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
18112 pub enum COption_HTLCClaimZ {
18113 /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
18114 Some(crate::lightning::ln::chan_utils::HTLCClaim),
18115 /// When we're in this state, this COption_HTLCClaimZ contains nothing
18118 impl COption_HTLCClaimZ {
18119 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18120 if let Self::None = self { false } else { true }
18122 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18125 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
18126 if let Self::Some(v) = self { v } else { unreachable!() }
18130 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
18131 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
18132 COption_HTLCClaimZ::Some(o)
18135 /// Constructs a new COption_HTLCClaimZ containing nothing
18136 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
18137 COption_HTLCClaimZ::None
18140 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
18141 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
18143 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
18144 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
18145 /// A pointer to the contents in the success state.
18146 /// Reading from this pointer when `result_ok` is not set is undefined.
18147 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
18148 /// A pointer to the contents in the error state.
18149 /// Reading from this pointer when `result_ok` is set is undefined.
18150 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18153 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
18154 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
18155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18156 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18157 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
18158 /// `err` or `result` depending on the state of `result_ok`.
18159 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
18160 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
18161 pub result_ok: bool,
18164 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
18165 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18166 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18167 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
18168 result: Box::into_raw(Box::new(o)),
18174 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
18175 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18176 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18177 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
18178 err: Box::into_raw(Box::new(e)),
18183 /// Checks if the given object is currently in the success state
18185 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
18189 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
18190 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
18191 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18192 fn drop(&mut self) {
18193 if self.result_ok {
18194 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18195 let _ = unsafe { Box::from_raw(self.contents.result) };
18198 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18199 let _ = unsafe { Box::from_raw(self.contents.err) };
18204 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18205 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
18206 let contents = if o.result_ok {
18207 let result = unsafe { o.contents.result };
18208 unsafe { o.contents.result = core::ptr::null_mut() };
18209 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
18211 let err = unsafe { o.contents.err };
18212 unsafe { o.contents.err = core::ptr::null_mut(); }
18213 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
18217 result_ok: o.result_ok,
18221 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
18222 fn clone(&self) -> Self {
18223 if self.result_ok {
18224 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
18225 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
18228 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
18229 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18235 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
18236 /// but with all dynamically-allocated buffers duplicated in new buffers.
18237 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
18239 /// The contents of CResult_TxCreationKeysDecodeErrorZ
18240 pub union CResult_TxCreationKeysDecodeErrorZPtr {
18241 /// A pointer to the contents in the success state.
18242 /// Reading from this pointer when `result_ok` is not set is undefined.
18243 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
18244 /// A pointer to the contents in the error state.
18245 /// Reading from this pointer when `result_ok` is set is undefined.
18246 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18249 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
18250 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
18251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18252 pub struct CResult_TxCreationKeysDecodeErrorZ {
18253 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
18254 /// `err` or `result` depending on the state of `result_ok`.
18255 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
18256 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
18257 pub result_ok: bool,
18260 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
18261 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
18262 CResult_TxCreationKeysDecodeErrorZ {
18263 contents: CResult_TxCreationKeysDecodeErrorZPtr {
18264 result: Box::into_raw(Box::new(o)),
18270 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
18271 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
18272 CResult_TxCreationKeysDecodeErrorZ {
18273 contents: CResult_TxCreationKeysDecodeErrorZPtr {
18274 err: Box::into_raw(Box::new(e)),
18279 /// Checks if the given object is currently in the success state
18281 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
18285 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
18286 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
18287 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
18288 fn drop(&mut self) {
18289 if self.result_ok {
18290 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18291 let _ = unsafe { Box::from_raw(self.contents.result) };
18294 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18295 let _ = unsafe { Box::from_raw(self.contents.err) };
18300 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
18301 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
18302 let contents = if o.result_ok {
18303 let result = unsafe { o.contents.result };
18304 unsafe { o.contents.result = core::ptr::null_mut() };
18305 CResult_TxCreationKeysDecodeErrorZPtr { result }
18307 let err = unsafe { o.contents.err };
18308 unsafe { o.contents.err = core::ptr::null_mut(); }
18309 CResult_TxCreationKeysDecodeErrorZPtr { err }
18313 result_ok: o.result_ok,
18317 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
18318 fn clone(&self) -> Self {
18319 if self.result_ok {
18320 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
18321 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
18324 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
18325 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18331 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
18332 /// but with all dynamically-allocated buffers duplicated in new buffers.
18333 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
18335 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
18336 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
18337 /// A pointer to the contents in the success state.
18338 /// Reading from this pointer when `result_ok` is not set is undefined.
18339 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
18340 /// A pointer to the contents in the error state.
18341 /// Reading from this pointer when `result_ok` is set is undefined.
18342 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18345 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
18346 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
18347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18348 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
18349 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
18350 /// `err` or `result` depending on the state of `result_ok`.
18351 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
18352 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
18353 pub result_ok: bool,
18356 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
18357 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
18358 CResult_ChannelPublicKeysDecodeErrorZ {
18359 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18360 result: Box::into_raw(Box::new(o)),
18366 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
18367 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
18368 CResult_ChannelPublicKeysDecodeErrorZ {
18369 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18370 err: Box::into_raw(Box::new(e)),
18375 /// Checks if the given object is currently in the success state
18377 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
18381 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
18382 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
18383 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
18384 fn drop(&mut self) {
18385 if self.result_ok {
18386 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18387 let _ = unsafe { Box::from_raw(self.contents.result) };
18390 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18391 let _ = unsafe { Box::from_raw(self.contents.err) };
18396 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
18397 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
18398 let contents = if o.result_ok {
18399 let result = unsafe { o.contents.result };
18400 unsafe { o.contents.result = core::ptr::null_mut() };
18401 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
18403 let err = unsafe { o.contents.err };
18404 unsafe { o.contents.err = core::ptr::null_mut(); }
18405 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
18409 result_ok: o.result_ok,
18413 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
18414 fn clone(&self) -> Self {
18415 if self.result_ok {
18416 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18417 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
18420 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
18421 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18427 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
18428 /// but with all dynamically-allocated buffers duplicated in new buffers.
18429 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
18431 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
18432 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18433 /// A pointer to the contents in the success state.
18434 /// Reading from this pointer when `result_ok` is not set is undefined.
18435 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
18436 /// A pointer to the contents in the error state.
18437 /// Reading from this pointer when `result_ok` is set is undefined.
18438 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18441 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
18442 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
18443 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18444 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
18445 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
18446 /// `err` or `result` depending on the state of `result_ok`.
18447 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
18448 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
18449 pub result_ok: bool,
18452 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
18453 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
18454 CResult_HTLCOutputInCommitmentDecodeErrorZ {
18455 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18456 result: Box::into_raw(Box::new(o)),
18462 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
18463 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
18464 CResult_HTLCOutputInCommitmentDecodeErrorZ {
18465 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18466 err: Box::into_raw(Box::new(e)),
18471 /// Checks if the given object is currently in the success state
18473 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
18477 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
18478 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
18479 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18480 fn drop(&mut self) {
18481 if self.result_ok {
18482 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18483 let _ = unsafe { Box::from_raw(self.contents.result) };
18486 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18487 let _ = unsafe { Box::from_raw(self.contents.err) };
18492 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18493 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
18494 let contents = if o.result_ok {
18495 let result = unsafe { o.contents.result };
18496 unsafe { o.contents.result = core::ptr::null_mut() };
18497 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
18499 let err = unsafe { o.contents.err };
18500 unsafe { o.contents.err = core::ptr::null_mut(); }
18501 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
18505 result_ok: o.result_ok,
18509 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
18510 fn clone(&self) -> Self {
18511 if self.result_ok {
18512 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18513 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
18516 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
18517 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18523 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
18524 /// but with all dynamically-allocated buffers duplicated in new buffers.
18525 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
18527 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
18528 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18529 /// A pointer to the contents in the success state.
18530 /// Reading from this pointer when `result_ok` is not set is undefined.
18531 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
18532 /// A pointer to the contents in the error state.
18533 /// Reading from this pointer when `result_ok` is set is undefined.
18534 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18537 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
18538 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
18539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18540 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18541 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
18542 /// `err` or `result` depending on the state of `result_ok`.
18543 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
18544 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
18545 pub result_ok: bool,
18548 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
18549 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18550 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18551 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18552 result: Box::into_raw(Box::new(o)),
18558 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
18559 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18560 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18561 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18562 err: Box::into_raw(Box::new(e)),
18567 /// Checks if the given object is currently in the success state
18569 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
18573 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
18574 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
18575 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18576 fn drop(&mut self) {
18577 if self.result_ok {
18578 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18579 let _ = unsafe { Box::from_raw(self.contents.result) };
18582 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18583 let _ = unsafe { Box::from_raw(self.contents.err) };
18588 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18589 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
18590 let contents = if o.result_ok {
18591 let result = unsafe { o.contents.result };
18592 unsafe { o.contents.result = core::ptr::null_mut() };
18593 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
18595 let err = unsafe { o.contents.err };
18596 unsafe { o.contents.err = core::ptr::null_mut(); }
18597 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
18601 result_ok: o.result_ok,
18605 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
18606 fn clone(&self) -> Self {
18607 if self.result_ok {
18608 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18609 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
18612 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
18613 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18619 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
18620 /// but with all dynamically-allocated buffers duplicated in new buffers.
18621 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
18623 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
18624 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
18625 /// A pointer to the contents in the success state.
18626 /// Reading from this pointer when `result_ok` is not set is undefined.
18627 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
18628 /// A pointer to the contents in the error state.
18629 /// Reading from this pointer when `result_ok` is set is undefined.
18630 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18633 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
18634 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
18635 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18636 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
18637 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
18638 /// `err` or `result` depending on the state of `result_ok`.
18639 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
18640 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
18641 pub result_ok: bool,
18644 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
18645 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
18646 CResult_ChannelTransactionParametersDecodeErrorZ {
18647 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18648 result: Box::into_raw(Box::new(o)),
18654 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
18655 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
18656 CResult_ChannelTransactionParametersDecodeErrorZ {
18657 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18658 err: Box::into_raw(Box::new(e)),
18663 /// Checks if the given object is currently in the success state
18665 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
18669 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
18670 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
18671 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
18672 fn drop(&mut self) {
18673 if self.result_ok {
18674 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18675 let _ = unsafe { Box::from_raw(self.contents.result) };
18678 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18679 let _ = unsafe { Box::from_raw(self.contents.err) };
18684 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
18685 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
18686 let contents = if o.result_ok {
18687 let result = unsafe { o.contents.result };
18688 unsafe { o.contents.result = core::ptr::null_mut() };
18689 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
18691 let err = unsafe { o.contents.err };
18692 unsafe { o.contents.err = core::ptr::null_mut(); }
18693 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
18697 result_ok: o.result_ok,
18701 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
18702 fn clone(&self) -> Self {
18703 if self.result_ok {
18704 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18705 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
18708 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
18709 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18715 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
18716 /// but with all dynamically-allocated buffers duplicated in new buffers.
18717 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
18719 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
18720 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18721 /// A pointer to the contents in the success state.
18722 /// Reading from this pointer when `result_ok` is not set is undefined.
18723 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
18724 /// A pointer to the contents in the error state.
18725 /// Reading from this pointer when `result_ok` is set is undefined.
18726 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18729 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18730 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18731 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18732 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
18733 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
18734 /// `err` or `result` depending on the state of `result_ok`.
18735 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
18736 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
18737 pub result_ok: bool,
18740 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
18741 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
18742 CResult_HolderCommitmentTransactionDecodeErrorZ {
18743 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18744 result: Box::into_raw(Box::new(o)),
18750 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
18751 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
18752 CResult_HolderCommitmentTransactionDecodeErrorZ {
18753 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18754 err: Box::into_raw(Box::new(e)),
18759 /// Checks if the given object is currently in the success state
18761 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
18765 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
18766 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
18767 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
18768 fn drop(&mut self) {
18769 if self.result_ok {
18770 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18771 let _ = unsafe { Box::from_raw(self.contents.result) };
18774 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18775 let _ = unsafe { Box::from_raw(self.contents.err) };
18780 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
18781 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
18782 let contents = if o.result_ok {
18783 let result = unsafe { o.contents.result };
18784 unsafe { o.contents.result = core::ptr::null_mut() };
18785 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
18787 let err = unsafe { o.contents.err };
18788 unsafe { o.contents.err = core::ptr::null_mut(); }
18789 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
18793 result_ok: o.result_ok,
18797 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
18798 fn clone(&self) -> Self {
18799 if self.result_ok {
18800 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18801 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
18804 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
18805 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18811 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
18812 /// but with all dynamically-allocated buffers duplicated in new buffers.
18813 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
18815 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
18816 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18817 /// A pointer to the contents in the success state.
18818 /// Reading from this pointer when `result_ok` is not set is undefined.
18819 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
18820 /// A pointer to the contents in the error state.
18821 /// Reading from this pointer when `result_ok` is set is undefined.
18822 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18825 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18826 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18827 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18828 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
18829 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
18830 /// `err` or `result` depending on the state of `result_ok`.
18831 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
18832 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
18833 pub result_ok: bool,
18836 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
18837 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
18838 CResult_BuiltCommitmentTransactionDecodeErrorZ {
18839 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18840 result: Box::into_raw(Box::new(o)),
18846 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
18847 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
18848 CResult_BuiltCommitmentTransactionDecodeErrorZ {
18849 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18850 err: Box::into_raw(Box::new(e)),
18855 /// Checks if the given object is currently in the success state
18857 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
18861 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
18862 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
18863 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18864 fn drop(&mut self) {
18865 if self.result_ok {
18866 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18867 let _ = unsafe { Box::from_raw(self.contents.result) };
18870 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18871 let _ = unsafe { Box::from_raw(self.contents.err) };
18876 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18877 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
18878 let contents = if o.result_ok {
18879 let result = unsafe { o.contents.result };
18880 unsafe { o.contents.result = core::ptr::null_mut() };
18881 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
18883 let err = unsafe { o.contents.err };
18884 unsafe { o.contents.err = core::ptr::null_mut(); }
18885 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
18889 result_ok: o.result_ok,
18893 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
18894 fn clone(&self) -> Self {
18895 if self.result_ok {
18896 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18897 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
18900 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
18901 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18907 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
18908 /// but with all dynamically-allocated buffers duplicated in new buffers.
18909 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
18911 /// The contents of CResult_TrustedClosingTransactionNoneZ
18912 pub union CResult_TrustedClosingTransactionNoneZPtr {
18913 /// A pointer to the contents in the success state.
18914 /// Reading from this pointer when `result_ok` is not set is undefined.
18915 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
18916 /// Note that this value is always NULL, as there are no contents in the Err variant
18917 pub err: *mut core::ffi::c_void,
18920 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
18921 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
18922 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18923 pub struct CResult_TrustedClosingTransactionNoneZ {
18924 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
18925 /// `err` or `result` depending on the state of `result_ok`.
18926 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
18927 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
18928 pub result_ok: bool,
18931 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
18932 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
18933 CResult_TrustedClosingTransactionNoneZ {
18934 contents: CResult_TrustedClosingTransactionNoneZPtr {
18935 result: Box::into_raw(Box::new(o)),
18941 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
18942 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
18943 CResult_TrustedClosingTransactionNoneZ {
18944 contents: CResult_TrustedClosingTransactionNoneZPtr {
18945 err: core::ptr::null_mut(),
18950 /// Checks if the given object is currently in the success state
18952 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
18956 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
18957 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
18958 impl Drop for CResult_TrustedClosingTransactionNoneZ {
18959 fn drop(&mut self) {
18960 if self.result_ok {
18961 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18962 let _ = unsafe { Box::from_raw(self.contents.result) };
18968 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
18969 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
18970 let contents = if o.result_ok {
18971 let result = unsafe { o.contents.result };
18972 unsafe { o.contents.result = core::ptr::null_mut() };
18973 CResult_TrustedClosingTransactionNoneZPtr { result }
18975 let _ = unsafe { Box::from_raw(o.contents.err) };
18976 o.contents.err = core::ptr::null_mut();
18977 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
18981 result_ok: o.result_ok,
18986 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
18987 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
18988 /// A pointer to the contents in the success state.
18989 /// Reading from this pointer when `result_ok` is not set is undefined.
18990 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
18991 /// A pointer to the contents in the error state.
18992 /// Reading from this pointer when `result_ok` is set is undefined.
18993 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18996 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
18997 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
18998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18999 pub struct CResult_CommitmentTransactionDecodeErrorZ {
19000 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
19001 /// `err` or `result` depending on the state of `result_ok`.
19002 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
19003 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
19004 pub result_ok: bool,
19007 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
19008 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
19009 CResult_CommitmentTransactionDecodeErrorZ {
19010 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
19011 result: Box::into_raw(Box::new(o)),
19017 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
19018 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
19019 CResult_CommitmentTransactionDecodeErrorZ {
19020 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
19021 err: Box::into_raw(Box::new(e)),
19026 /// Checks if the given object is currently in the success state
19028 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
19032 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
19033 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
19034 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
19035 fn drop(&mut self) {
19036 if self.result_ok {
19037 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19038 let _ = unsafe { Box::from_raw(self.contents.result) };
19041 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19042 let _ = unsafe { Box::from_raw(self.contents.err) };
19047 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
19048 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
19049 let contents = if o.result_ok {
19050 let result = unsafe { o.contents.result };
19051 unsafe { o.contents.result = core::ptr::null_mut() };
19052 CResult_CommitmentTransactionDecodeErrorZPtr { result }
19054 let err = unsafe { o.contents.err };
19055 unsafe { o.contents.err = core::ptr::null_mut(); }
19056 CResult_CommitmentTransactionDecodeErrorZPtr { err }
19060 result_ok: o.result_ok,
19064 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
19065 fn clone(&self) -> Self {
19066 if self.result_ok {
19067 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
19068 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
19071 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
19072 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19078 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
19079 /// but with all dynamically-allocated buffers duplicated in new buffers.
19080 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
19082 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
19083 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
19084 /// A pointer to the contents in the success state.
19085 /// Reading from this pointer when `result_ok` is not set is undefined.
19086 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
19087 /// Note that this value is always NULL, as there are no contents in the Err variant
19088 pub err: *mut core::ffi::c_void,
19091 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
19092 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
19093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19094 pub struct CResult_TrustedCommitmentTransactionNoneZ {
19095 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
19096 /// `err` or `result` depending on the state of `result_ok`.
19097 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
19098 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
19099 pub result_ok: bool,
19102 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
19103 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
19104 CResult_TrustedCommitmentTransactionNoneZ {
19105 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
19106 result: Box::into_raw(Box::new(o)),
19112 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
19113 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
19114 CResult_TrustedCommitmentTransactionNoneZ {
19115 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
19116 err: core::ptr::null_mut(),
19121 /// Checks if the given object is currently in the success state
19123 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
19127 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
19128 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
19129 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
19130 fn drop(&mut self) {
19131 if self.result_ok {
19132 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19133 let _ = unsafe { Box::from_raw(self.contents.result) };
19139 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
19140 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
19141 let contents = if o.result_ok {
19142 let result = unsafe { o.contents.result };
19143 unsafe { o.contents.result = core::ptr::null_mut() };
19144 CResult_TrustedCommitmentTransactionNoneZPtr { result }
19146 let _ = unsafe { Box::from_raw(o.contents.err) };
19147 o.contents.err = core::ptr::null_mut();
19148 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
19152 result_ok: o.result_ok,
19157 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
19158 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
19159 /// A pointer to the contents in the success state.
19160 /// Reading from this pointer when `result_ok` is not set is undefined.
19161 pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
19162 /// Note that this value is always NULL, as there are no contents in the Err variant
19163 pub err: *mut core::ffi::c_void,
19166 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
19167 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
19168 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19169 pub struct CResult_CVec_ECDSASignatureZNoneZ {
19170 /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
19171 /// `err` or `result` depending on the state of `result_ok`.
19172 pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
19173 /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
19174 pub result_ok: bool,
19177 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
19178 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
19179 CResult_CVec_ECDSASignatureZNoneZ {
19180 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
19181 result: Box::into_raw(Box::new(o)),
19187 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
19188 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
19189 CResult_CVec_ECDSASignatureZNoneZ {
19190 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
19191 err: core::ptr::null_mut(),
19196 /// Checks if the given object is currently in the success state
19198 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
19202 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
19203 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
19204 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
19205 fn drop(&mut self) {
19206 if self.result_ok {
19207 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19208 let _ = unsafe { Box::from_raw(self.contents.result) };
19214 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
19215 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> Self {
19216 let contents = if o.result_ok {
19217 let result = unsafe { o.contents.result };
19218 unsafe { o.contents.result = core::ptr::null_mut() };
19219 CResult_CVec_ECDSASignatureZNoneZPtr { result }
19221 let _ = unsafe { Box::from_raw(o.contents.err) };
19222 o.contents.err = core::ptr::null_mut();
19223 CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
19227 result_ok: o.result_ok,
19231 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
19232 fn clone(&self) -> Self {
19233 if self.result_ok {
19234 Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
19235 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
19238 Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
19239 err: core::ptr::null_mut()
19245 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
19246 /// but with all dynamically-allocated buffers duplicated in new buffers.
19247 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
19250 /// An enum which can either contain a usize or not
19251 pub enum COption_usizeZ {
19252 /// When we're in this state, this COption_usizeZ contains a usize
19254 /// When we're in this state, this COption_usizeZ contains nothing
19257 impl COption_usizeZ {
19258 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19259 if let Self::None = self { false } else { true }
19261 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19264 #[allow(unused)] pub(crate) fn take(mut self) -> usize {
19265 if let Self::Some(v) = self { v } else { unreachable!() }
19269 /// Constructs a new COption_usizeZ containing a usize
19270 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
19271 COption_usizeZ::Some(o)
19274 /// Constructs a new COption_usizeZ containing nothing
19275 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
19276 COption_usizeZ::None
19279 /// Frees any resources associated with the usize, if we are in the Some state
19280 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
19282 /// Creates a new COption_usizeZ which has the same data as `orig`
19283 /// but with all dynamically-allocated buffers duplicated in new buffers.
19284 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
19286 /// The contents of CResult_ShutdownScriptDecodeErrorZ
19287 pub union CResult_ShutdownScriptDecodeErrorZPtr {
19288 /// A pointer to the contents in the success state.
19289 /// Reading from this pointer when `result_ok` is not set is undefined.
19290 pub result: *mut crate::lightning::ln::script::ShutdownScript,
19291 /// A pointer to the contents in the error state.
19292 /// Reading from this pointer when `result_ok` is set is undefined.
19293 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19296 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
19297 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
19298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19299 pub struct CResult_ShutdownScriptDecodeErrorZ {
19300 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
19301 /// `err` or `result` depending on the state of `result_ok`.
19302 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
19303 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
19304 pub result_ok: bool,
19307 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
19308 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
19309 CResult_ShutdownScriptDecodeErrorZ {
19310 contents: CResult_ShutdownScriptDecodeErrorZPtr {
19311 result: Box::into_raw(Box::new(o)),
19317 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
19318 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
19319 CResult_ShutdownScriptDecodeErrorZ {
19320 contents: CResult_ShutdownScriptDecodeErrorZPtr {
19321 err: Box::into_raw(Box::new(e)),
19326 /// Checks if the given object is currently in the success state
19328 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
19332 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
19333 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
19334 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
19335 fn drop(&mut self) {
19336 if self.result_ok {
19337 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19338 let _ = unsafe { Box::from_raw(self.contents.result) };
19341 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19342 let _ = unsafe { Box::from_raw(self.contents.err) };
19347 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
19348 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
19349 let contents = if o.result_ok {
19350 let result = unsafe { o.contents.result };
19351 unsafe { o.contents.result = core::ptr::null_mut() };
19352 CResult_ShutdownScriptDecodeErrorZPtr { result }
19354 let err = unsafe { o.contents.err };
19355 unsafe { o.contents.err = core::ptr::null_mut(); }
19356 CResult_ShutdownScriptDecodeErrorZPtr { err }
19360 result_ok: o.result_ok,
19364 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
19365 fn clone(&self) -> Self {
19366 if self.result_ok {
19367 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
19368 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
19371 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
19372 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19378 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
19379 /// but with all dynamically-allocated buffers duplicated in new buffers.
19380 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
19382 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
19383 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19384 /// A pointer to the contents in the success state.
19385 /// Reading from this pointer when `result_ok` is not set is undefined.
19386 pub result: *mut crate::lightning::ln::script::ShutdownScript,
19387 /// A pointer to the contents in the error state.
19388 /// Reading from this pointer when `result_ok` is set is undefined.
19389 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
19392 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
19393 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
19394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19395 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
19396 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
19397 /// `err` or `result` depending on the state of `result_ok`.
19398 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
19399 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
19400 pub result_ok: bool,
19403 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
19404 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
19405 CResult_ShutdownScriptInvalidShutdownScriptZ {
19406 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19407 result: Box::into_raw(Box::new(o)),
19413 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
19414 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
19415 CResult_ShutdownScriptInvalidShutdownScriptZ {
19416 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19417 err: Box::into_raw(Box::new(e)),
19422 /// Checks if the given object is currently in the success state
19424 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
19428 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
19429 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
19430 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
19431 fn drop(&mut self) {
19432 if self.result_ok {
19433 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19434 let _ = unsafe { Box::from_raw(self.contents.result) };
19437 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19438 let _ = unsafe { Box::from_raw(self.contents.err) };
19443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
19444 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
19445 let contents = if o.result_ok {
19446 let result = unsafe { o.contents.result };
19447 unsafe { o.contents.result = core::ptr::null_mut() };
19448 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
19450 let err = unsafe { o.contents.err };
19451 unsafe { o.contents.err = core::ptr::null_mut(); }
19452 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
19456 result_ok: o.result_ok,
19460 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
19461 fn clone(&self) -> Self {
19462 if self.result_ok {
19463 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19464 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
19467 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
19468 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
19474 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
19475 /// but with all dynamically-allocated buffers duplicated in new buffers.
19476 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
19478 /// The contents of CResult_PaymentPurposeDecodeErrorZ
19479 pub union CResult_PaymentPurposeDecodeErrorZPtr {
19480 /// A pointer to the contents in the success state.
19481 /// Reading from this pointer when `result_ok` is not set is undefined.
19482 pub result: *mut crate::lightning::events::PaymentPurpose,
19483 /// A pointer to the contents in the error state.
19484 /// Reading from this pointer when `result_ok` is set is undefined.
19485 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19488 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
19489 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
19490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19491 pub struct CResult_PaymentPurposeDecodeErrorZ {
19492 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
19493 /// `err` or `result` depending on the state of `result_ok`.
19494 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
19495 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
19496 pub result_ok: bool,
19499 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
19500 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
19501 CResult_PaymentPurposeDecodeErrorZ {
19502 contents: CResult_PaymentPurposeDecodeErrorZPtr {
19503 result: Box::into_raw(Box::new(o)),
19509 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
19510 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
19511 CResult_PaymentPurposeDecodeErrorZ {
19512 contents: CResult_PaymentPurposeDecodeErrorZPtr {
19513 err: Box::into_raw(Box::new(e)),
19518 /// Checks if the given object is currently in the success state
19520 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
19524 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
19525 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
19526 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
19527 fn drop(&mut self) {
19528 if self.result_ok {
19529 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19530 let _ = unsafe { Box::from_raw(self.contents.result) };
19533 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19534 let _ = unsafe { Box::from_raw(self.contents.err) };
19539 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
19540 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
19541 let contents = if o.result_ok {
19542 let result = unsafe { o.contents.result };
19543 unsafe { o.contents.result = core::ptr::null_mut() };
19544 CResult_PaymentPurposeDecodeErrorZPtr { result }
19546 let err = unsafe { o.contents.err };
19547 unsafe { o.contents.err = core::ptr::null_mut(); }
19548 CResult_PaymentPurposeDecodeErrorZPtr { err }
19552 result_ok: o.result_ok,
19556 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
19557 fn clone(&self) -> Self {
19558 if self.result_ok {
19559 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
19560 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
19563 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
19564 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19570 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
19571 /// but with all dynamically-allocated buffers duplicated in new buffers.
19572 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
19574 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
19575 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
19576 /// A pointer to the contents in the success state.
19577 /// Reading from this pointer when `result_ok` is not set is undefined.
19578 pub result: *mut crate::lightning::events::ClaimedHTLC,
19579 /// A pointer to the contents in the error state.
19580 /// Reading from this pointer when `result_ok` is set is undefined.
19581 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19584 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
19585 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
19586 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19587 pub struct CResult_ClaimedHTLCDecodeErrorZ {
19588 /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
19589 /// `err` or `result` depending on the state of `result_ok`.
19590 pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
19591 /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
19592 pub result_ok: bool,
19595 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
19596 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
19597 CResult_ClaimedHTLCDecodeErrorZ {
19598 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19599 result: Box::into_raw(Box::new(o)),
19605 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
19606 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
19607 CResult_ClaimedHTLCDecodeErrorZ {
19608 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19609 err: Box::into_raw(Box::new(e)),
19614 /// Checks if the given object is currently in the success state
19616 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
19620 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
19621 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
19622 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
19623 fn drop(&mut self) {
19624 if self.result_ok {
19625 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19626 let _ = unsafe { Box::from_raw(self.contents.result) };
19629 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19630 let _ = unsafe { Box::from_raw(self.contents.err) };
19635 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
19636 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
19637 let contents = if o.result_ok {
19638 let result = unsafe { o.contents.result };
19639 unsafe { o.contents.result = core::ptr::null_mut() };
19640 CResult_ClaimedHTLCDecodeErrorZPtr { result }
19642 let err = unsafe { o.contents.err };
19643 unsafe { o.contents.err = core::ptr::null_mut(); }
19644 CResult_ClaimedHTLCDecodeErrorZPtr { err }
19648 result_ok: o.result_ok,
19652 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
19653 fn clone(&self) -> Self {
19654 if self.result_ok {
19655 Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19656 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
19659 Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
19660 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19666 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
19667 /// but with all dynamically-allocated buffers duplicated in new buffers.
19668 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
19671 /// An enum which can either contain a crate::lightning::events::PathFailure or not
19672 pub enum COption_PathFailureZ {
19673 /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
19674 Some(crate::lightning::events::PathFailure),
19675 /// When we're in this state, this COption_PathFailureZ contains nothing
19678 impl COption_PathFailureZ {
19679 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19680 if let Self::None = self { false } else { true }
19682 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19685 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
19686 if let Self::Some(v) = self { v } else { unreachable!() }
19690 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
19691 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
19692 COption_PathFailureZ::Some(o)
19695 /// Constructs a new COption_PathFailureZ containing nothing
19696 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
19697 COption_PathFailureZ::None
19700 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
19701 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
19703 /// Creates a new COption_PathFailureZ which has the same data as `orig`
19704 /// but with all dynamically-allocated buffers duplicated in new buffers.
19705 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
19707 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
19708 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
19709 /// A pointer to the contents in the success state.
19710 /// Reading from this pointer when `result_ok` is not set is undefined.
19711 pub result: *mut crate::c_types::derived::COption_PathFailureZ,
19712 /// A pointer to the contents in the error state.
19713 /// Reading from this pointer when `result_ok` is set is undefined.
19714 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19717 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
19718 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19720 pub struct CResult_COption_PathFailureZDecodeErrorZ {
19721 /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
19722 /// `err` or `result` depending on the state of `result_ok`.
19723 pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
19724 /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
19725 pub result_ok: bool,
19728 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
19729 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
19730 CResult_COption_PathFailureZDecodeErrorZ {
19731 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19732 result: Box::into_raw(Box::new(o)),
19738 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
19739 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
19740 CResult_COption_PathFailureZDecodeErrorZ {
19741 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19742 err: Box::into_raw(Box::new(e)),
19747 /// Checks if the given object is currently in the success state
19749 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
19753 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
19754 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
19755 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
19756 fn drop(&mut self) {
19757 if self.result_ok {
19758 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19759 let _ = unsafe { Box::from_raw(self.contents.result) };
19762 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19763 let _ = unsafe { Box::from_raw(self.contents.err) };
19768 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
19769 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
19770 let contents = if o.result_ok {
19771 let result = unsafe { o.contents.result };
19772 unsafe { o.contents.result = core::ptr::null_mut() };
19773 CResult_COption_PathFailureZDecodeErrorZPtr { result }
19775 let err = unsafe { o.contents.err };
19776 unsafe { o.contents.err = core::ptr::null_mut(); }
19777 CResult_COption_PathFailureZDecodeErrorZPtr { err }
19781 result_ok: o.result_ok,
19785 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
19786 fn clone(&self) -> Self {
19787 if self.result_ok {
19788 Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19789 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
19792 Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
19793 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19799 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
19800 /// but with all dynamically-allocated buffers duplicated in new buffers.
19801 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
19804 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
19805 pub enum COption_ClosureReasonZ {
19806 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
19807 Some(crate::lightning::events::ClosureReason),
19808 /// When we're in this state, this COption_ClosureReasonZ contains nothing
19811 impl COption_ClosureReasonZ {
19812 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19813 if let Self::None = self { false } else { true }
19815 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19818 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
19819 if let Self::Some(v) = self { v } else { unreachable!() }
19823 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
19824 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
19825 COption_ClosureReasonZ::Some(o)
19828 /// Constructs a new COption_ClosureReasonZ containing nothing
19829 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
19830 COption_ClosureReasonZ::None
19833 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
19834 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
19836 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
19837 /// but with all dynamically-allocated buffers duplicated in new buffers.
19838 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
19840 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
19841 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
19842 /// A pointer to the contents in the success state.
19843 /// Reading from this pointer when `result_ok` is not set is undefined.
19844 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
19845 /// A pointer to the contents in the error state.
19846 /// Reading from this pointer when `result_ok` is set is undefined.
19847 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19850 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
19851 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19853 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
19854 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
19855 /// `err` or `result` depending on the state of `result_ok`.
19856 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
19857 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
19858 pub result_ok: bool,
19861 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
19862 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
19863 CResult_COption_ClosureReasonZDecodeErrorZ {
19864 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19865 result: Box::into_raw(Box::new(o)),
19871 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
19872 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
19873 CResult_COption_ClosureReasonZDecodeErrorZ {
19874 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19875 err: Box::into_raw(Box::new(e)),
19880 /// Checks if the given object is currently in the success state
19882 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
19886 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
19887 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
19888 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
19889 fn drop(&mut self) {
19890 if self.result_ok {
19891 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19892 let _ = unsafe { Box::from_raw(self.contents.result) };
19895 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19896 let _ = unsafe { Box::from_raw(self.contents.err) };
19901 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
19902 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
19903 let contents = if o.result_ok {
19904 let result = unsafe { o.contents.result };
19905 unsafe { o.contents.result = core::ptr::null_mut() };
19906 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
19908 let err = unsafe { o.contents.err };
19909 unsafe { o.contents.err = core::ptr::null_mut(); }
19910 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
19914 result_ok: o.result_ok,
19918 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
19919 fn clone(&self) -> Self {
19920 if self.result_ok {
19921 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19922 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
19925 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
19926 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19932 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
19933 /// but with all dynamically-allocated buffers duplicated in new buffers.
19934 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
19937 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
19938 pub enum COption_HTLCDestinationZ {
19939 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
19940 Some(crate::lightning::events::HTLCDestination),
19941 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
19944 impl COption_HTLCDestinationZ {
19945 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
19946 if let Self::None = self { false } else { true }
19948 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
19951 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
19952 if let Self::Some(v) = self { v } else { unreachable!() }
19956 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
19957 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
19958 COption_HTLCDestinationZ::Some(o)
19961 /// Constructs a new COption_HTLCDestinationZ containing nothing
19962 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
19963 COption_HTLCDestinationZ::None
19966 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
19967 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
19969 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
19970 /// but with all dynamically-allocated buffers duplicated in new buffers.
19971 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
19973 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
19974 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19975 /// A pointer to the contents in the success state.
19976 /// Reading from this pointer when `result_ok` is not set is undefined.
19977 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
19978 /// A pointer to the contents in the error state.
19979 /// Reading from this pointer when `result_ok` is set is undefined.
19980 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19983 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
19984 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19986 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
19987 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
19988 /// `err` or `result` depending on the state of `result_ok`.
19989 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
19990 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
19991 pub result_ok: bool,
19994 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
19995 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
19996 CResult_COption_HTLCDestinationZDecodeErrorZ {
19997 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
19998 result: Box::into_raw(Box::new(o)),
20004 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
20005 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
20006 CResult_COption_HTLCDestinationZDecodeErrorZ {
20007 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
20008 err: Box::into_raw(Box::new(e)),
20013 /// Checks if the given object is currently in the success state
20015 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
20019 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
20020 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
20021 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
20022 fn drop(&mut self) {
20023 if self.result_ok {
20024 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20025 let _ = unsafe { Box::from_raw(self.contents.result) };
20028 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20029 let _ = unsafe { Box::from_raw(self.contents.err) };
20034 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
20035 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
20036 let contents = if o.result_ok {
20037 let result = unsafe { o.contents.result };
20038 unsafe { o.contents.result = core::ptr::null_mut() };
20039 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
20041 let err = unsafe { o.contents.err };
20042 unsafe { o.contents.err = core::ptr::null_mut(); }
20043 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
20047 result_ok: o.result_ok,
20051 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
20052 fn clone(&self) -> Self {
20053 if self.result_ok {
20054 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
20055 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
20058 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
20059 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20065 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
20066 /// but with all dynamically-allocated buffers duplicated in new buffers.
20067 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
20069 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
20070 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
20071 /// A pointer to the contents in the success state.
20072 /// Reading from this pointer when `result_ok` is not set is undefined.
20073 pub result: *mut crate::lightning::events::PaymentFailureReason,
20074 /// A pointer to the contents in the error state.
20075 /// Reading from this pointer when `result_ok` is set is undefined.
20076 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20079 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
20080 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
20081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20082 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
20083 /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
20084 /// `err` or `result` depending on the state of `result_ok`.
20085 pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
20086 /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
20087 pub result_ok: bool,
20090 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
20091 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
20092 CResult_PaymentFailureReasonDecodeErrorZ {
20093 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
20094 result: Box::into_raw(Box::new(o)),
20100 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
20101 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
20102 CResult_PaymentFailureReasonDecodeErrorZ {
20103 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
20104 err: Box::into_raw(Box::new(e)),
20109 /// Checks if the given object is currently in the success state
20111 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
20115 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
20116 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
20117 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
20118 fn drop(&mut self) {
20119 if self.result_ok {
20120 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20121 let _ = unsafe { Box::from_raw(self.contents.result) };
20124 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20125 let _ = unsafe { Box::from_raw(self.contents.err) };
20130 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
20131 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
20132 let contents = if o.result_ok {
20133 let result = unsafe { o.contents.result };
20134 unsafe { o.contents.result = core::ptr::null_mut() };
20135 CResult_PaymentFailureReasonDecodeErrorZPtr { result }
20137 let err = unsafe { o.contents.err };
20138 unsafe { o.contents.err = core::ptr::null_mut(); }
20139 CResult_PaymentFailureReasonDecodeErrorZPtr { err }
20143 result_ok: o.result_ok,
20147 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
20148 fn clone(&self) -> Self {
20149 if self.result_ok {
20150 Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
20151 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
20154 Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
20155 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20161 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
20162 /// but with all dynamically-allocated buffers duplicated in new buffers.
20163 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
20166 /// An enum which can either contain a crate::c_types::U128 or not
20167 pub enum COption_U128Z {
20168 /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
20169 Some(crate::c_types::U128),
20170 /// When we're in this state, this COption_U128Z contains nothing
20173 impl COption_U128Z {
20174 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20175 if let Self::None = self { false } else { true }
20177 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20180 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
20181 if let Self::Some(v) = self { v } else { unreachable!() }
20185 /// Constructs a new COption_U128Z containing a crate::c_types::U128
20186 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
20187 COption_U128Z::Some(o)
20190 /// Constructs a new COption_U128Z containing nothing
20191 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
20192 COption_U128Z::None
20195 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
20196 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
20198 /// Creates a new COption_U128Z which has the same data as `orig`
20199 /// but with all dynamically-allocated buffers duplicated in new buffers.
20200 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
20202 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
20203 /// This corresponds to std::vector in C++
20204 pub struct CVec_ClaimedHTLCZ {
20205 /// The elements in the array.
20206 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20207 pub data: *mut crate::lightning::events::ClaimedHTLC,
20208 /// The number of elements pointed to by `data`.
20211 impl CVec_ClaimedHTLCZ {
20212 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
20213 if self.datalen == 0 { return Vec::new(); }
20214 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20215 self.data = core::ptr::null_mut();
20219 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
20220 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20223 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
20224 fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
20225 let datalen = v.len();
20226 let data = Box::into_raw(v.into_boxed_slice());
20227 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20231 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20232 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
20233 impl Drop for CVec_ClaimedHTLCZ {
20234 fn drop(&mut self) {
20235 if self.datalen == 0 { return; }
20236 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20239 impl Clone for CVec_ClaimedHTLCZ {
20240 fn clone(&self) -> Self {
20241 let mut res = Vec::new();
20242 if self.datalen == 0 { return Self::from(res); }
20243 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20249 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
20250 pub enum COption_PaymentFailureReasonZ {
20251 /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
20252 Some(crate::lightning::events::PaymentFailureReason),
20253 /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
20256 impl COption_PaymentFailureReasonZ {
20257 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20258 if let Self::None = self { false } else { true }
20260 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20263 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
20264 if let Self::Some(v) = self { v } else { unreachable!() }
20268 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
20269 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
20270 COption_PaymentFailureReasonZ::Some(o)
20273 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
20274 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
20275 COption_PaymentFailureReasonZ::None
20278 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
20279 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
20281 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
20282 /// but with all dynamically-allocated buffers duplicated in new buffers.
20283 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
20286 /// An enum which can either contain a crate::lightning::events::Event or not
20287 pub enum COption_EventZ {
20288 /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
20289 Some(crate::lightning::events::Event),
20290 /// When we're in this state, this COption_EventZ contains nothing
20293 impl COption_EventZ {
20294 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20295 if let Self::None = self { false } else { true }
20297 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20300 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
20301 if let Self::Some(v) = self { v } else { unreachable!() }
20305 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
20306 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
20307 COption_EventZ::Some(o)
20310 /// Constructs a new COption_EventZ containing nothing
20311 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
20312 COption_EventZ::None
20315 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
20316 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
20318 /// Creates a new COption_EventZ which has the same data as `orig`
20319 /// but with all dynamically-allocated buffers duplicated in new buffers.
20320 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
20322 /// The contents of CResult_COption_EventZDecodeErrorZ
20323 pub union CResult_COption_EventZDecodeErrorZPtr {
20324 /// A pointer to the contents in the success state.
20325 /// Reading from this pointer when `result_ok` is not set is undefined.
20326 pub result: *mut crate::c_types::derived::COption_EventZ,
20327 /// A pointer to the contents in the error state.
20328 /// Reading from this pointer when `result_ok` is set is undefined.
20329 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20332 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
20333 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
20334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20335 pub struct CResult_COption_EventZDecodeErrorZ {
20336 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
20337 /// `err` or `result` depending on the state of `result_ok`.
20338 pub contents: CResult_COption_EventZDecodeErrorZPtr,
20339 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
20340 pub result_ok: bool,
20343 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
20344 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
20345 CResult_COption_EventZDecodeErrorZ {
20346 contents: CResult_COption_EventZDecodeErrorZPtr {
20347 result: Box::into_raw(Box::new(o)),
20353 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
20354 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
20355 CResult_COption_EventZDecodeErrorZ {
20356 contents: CResult_COption_EventZDecodeErrorZPtr {
20357 err: Box::into_raw(Box::new(e)),
20362 /// Checks if the given object is currently in the success state
20364 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
20368 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
20369 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
20370 impl Drop for CResult_COption_EventZDecodeErrorZ {
20371 fn drop(&mut self) {
20372 if self.result_ok {
20373 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20374 let _ = unsafe { Box::from_raw(self.contents.result) };
20377 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20378 let _ = unsafe { Box::from_raw(self.contents.err) };
20383 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
20384 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
20385 let contents = if o.result_ok {
20386 let result = unsafe { o.contents.result };
20387 unsafe { o.contents.result = core::ptr::null_mut() };
20388 CResult_COption_EventZDecodeErrorZPtr { result }
20390 let err = unsafe { o.contents.err };
20391 unsafe { o.contents.err = core::ptr::null_mut(); }
20392 CResult_COption_EventZDecodeErrorZPtr { err }
20396 result_ok: o.result_ok,
20400 impl Clone for CResult_COption_EventZDecodeErrorZ {
20401 fn clone(&self) -> Self {
20402 if self.result_ok {
20403 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
20404 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
20407 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
20408 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20414 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
20415 /// but with all dynamically-allocated buffers duplicated in new buffers.
20416 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
20418 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
20419 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
20420 /// A pointer to the contents in the success state.
20421 /// Reading from this pointer when `result_ok` is not set is undefined.
20422 pub result: *mut crate::lightning_invoice::SiPrefix,
20423 /// A pointer to the contents in the error state.
20424 /// Reading from this pointer when `result_ok` is set is undefined.
20425 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
20428 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
20429 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
20430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20431 pub struct CResult_SiPrefixBolt11ParseErrorZ {
20432 /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
20433 /// `err` or `result` depending on the state of `result_ok`.
20434 pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
20435 /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
20436 pub result_ok: bool,
20439 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
20440 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
20441 CResult_SiPrefixBolt11ParseErrorZ {
20442 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20443 result: Box::into_raw(Box::new(o)),
20449 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
20450 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
20451 CResult_SiPrefixBolt11ParseErrorZ {
20452 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20453 err: Box::into_raw(Box::new(e)),
20458 /// Checks if the given object is currently in the success state
20460 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
20464 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
20465 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
20466 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
20467 fn drop(&mut self) {
20468 if self.result_ok {
20469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20470 let _ = unsafe { Box::from_raw(self.contents.result) };
20473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20474 let _ = unsafe { Box::from_raw(self.contents.err) };
20479 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
20480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
20481 let contents = if o.result_ok {
20482 let result = unsafe { o.contents.result };
20483 unsafe { o.contents.result = core::ptr::null_mut() };
20484 CResult_SiPrefixBolt11ParseErrorZPtr { result }
20486 let err = unsafe { o.contents.err };
20487 unsafe { o.contents.err = core::ptr::null_mut(); }
20488 CResult_SiPrefixBolt11ParseErrorZPtr { err }
20492 result_ok: o.result_ok,
20496 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
20497 fn clone(&self) -> Self {
20498 if self.result_ok {
20499 Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20500 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
20503 Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
20504 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
20510 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
20511 /// but with all dynamically-allocated buffers duplicated in new buffers.
20512 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
20514 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
20515 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20516 /// A pointer to the contents in the success state.
20517 /// Reading from this pointer when `result_ok` is not set is undefined.
20518 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20519 /// A pointer to the contents in the error state.
20520 /// Reading from this pointer when `result_ok` is set is undefined.
20521 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
20524 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
20525 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
20526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20527 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20528 /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
20529 /// `err` or `result` depending on the state of `result_ok`.
20530 pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
20531 /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
20532 pub result_ok: bool,
20535 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
20536 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20537 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20538 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20539 result: Box::into_raw(Box::new(o)),
20545 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
20546 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20547 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20548 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20549 err: Box::into_raw(Box::new(e)),
20554 /// Checks if the given object is currently in the success state
20556 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
20560 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
20561 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
20562 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20563 fn drop(&mut self) {
20564 if self.result_ok {
20565 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20566 let _ = unsafe { Box::from_raw(self.contents.result) };
20569 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20570 let _ = unsafe { Box::from_raw(self.contents.err) };
20575 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20576 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
20577 let contents = if o.result_ok {
20578 let result = unsafe { o.contents.result };
20579 unsafe { o.contents.result = core::ptr::null_mut() };
20580 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
20582 let err = unsafe { o.contents.err };
20583 unsafe { o.contents.err = core::ptr::null_mut(); }
20584 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
20588 result_ok: o.result_ok,
20592 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
20593 fn clone(&self) -> Self {
20594 if self.result_ok {
20595 Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20596 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20599 Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
20600 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
20606 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
20607 /// but with all dynamically-allocated buffers duplicated in new buffers.
20608 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
20610 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
20611 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20612 /// A pointer to the contents in the success state.
20613 /// Reading from this pointer when `result_ok` is not set is undefined.
20614 pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
20615 /// A pointer to the contents in the error state.
20616 /// Reading from this pointer when `result_ok` is set is undefined.
20617 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
20620 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
20621 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
20622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20623 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20624 /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
20625 /// `err` or `result` depending on the state of `result_ok`.
20626 pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
20627 /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
20628 pub result_ok: bool,
20631 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
20632 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20633 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20634 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20635 result: Box::into_raw(Box::new(o)),
20641 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
20642 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20643 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20644 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20645 err: Box::into_raw(Box::new(e)),
20650 /// Checks if the given object is currently in the success state
20652 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
20656 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
20657 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
20658 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20659 fn drop(&mut self) {
20660 if self.result_ok {
20661 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20662 let _ = unsafe { Box::from_raw(self.contents.result) };
20665 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20666 let _ = unsafe { Box::from_raw(self.contents.err) };
20671 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20672 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
20673 let contents = if o.result_ok {
20674 let result = unsafe { o.contents.result };
20675 unsafe { o.contents.result = core::ptr::null_mut() };
20676 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
20678 let err = unsafe { o.contents.err };
20679 unsafe { o.contents.err = core::ptr::null_mut(); }
20680 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
20684 result_ok: o.result_ok,
20688 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
20689 fn clone(&self) -> Self {
20690 if self.result_ok {
20691 Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20692 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
20695 Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
20696 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
20702 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
20703 /// but with all dynamically-allocated buffers duplicated in new buffers.
20704 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
20706 /// A tuple of 3 elements. See the individual fields for the types contained.
20707 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20708 /// The element at position 0
20709 pub a: crate::lightning_invoice::RawBolt11Invoice,
20710 /// The element at position 1
20711 pub b: crate::c_types::ThirtyTwoBytes,
20712 /// The element at position 2
20713 pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
20715 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20716 fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
20724 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20725 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
20726 (self.a, self.b, self.c)
20729 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
20730 fn clone(&self) -> Self {
20732 a: Clone::clone(&self.a),
20733 b: Clone::clone(&self.b),
20734 c: Clone::clone(&self.c),
20739 /// Creates a new tuple which has the same data as `orig`
20740 /// but with all dynamically-allocated buffers duplicated in new buffers.
20741 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
20742 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
20744 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 {
20745 C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
20749 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
20750 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
20752 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
20753 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
20754 /// A pointer to the contents in the success state.
20755 /// Reading from this pointer when `result_ok` is not set is undefined.
20756 pub result: *mut crate::lightning_invoice::PayeePubKey,
20757 /// A pointer to the contents in the error state.
20758 /// Reading from this pointer when `result_ok` is set is undefined.
20759 pub err: *mut crate::c_types::Secp256k1Error,
20762 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
20763 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
20764 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20765 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
20766 /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
20767 /// `err` or `result` depending on the state of `result_ok`.
20768 pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
20769 /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
20770 pub result_ok: bool,
20773 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
20774 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
20775 CResult_PayeePubKeySecp256k1ErrorZ {
20776 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20777 result: Box::into_raw(Box::new(o)),
20783 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
20784 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
20785 CResult_PayeePubKeySecp256k1ErrorZ {
20786 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20787 err: Box::into_raw(Box::new(e)),
20792 /// Checks if the given object is currently in the success state
20794 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
20798 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
20799 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
20800 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
20801 fn drop(&mut self) {
20802 if self.result_ok {
20803 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20804 let _ = unsafe { Box::from_raw(self.contents.result) };
20807 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20808 let _ = unsafe { Box::from_raw(self.contents.err) };
20813 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
20814 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
20815 let contents = if o.result_ok {
20816 let result = unsafe { o.contents.result };
20817 unsafe { o.contents.result = core::ptr::null_mut() };
20818 CResult_PayeePubKeySecp256k1ErrorZPtr { result }
20820 let err = unsafe { o.contents.err };
20821 unsafe { o.contents.err = core::ptr::null_mut(); }
20822 CResult_PayeePubKeySecp256k1ErrorZPtr { err }
20826 result_ok: o.result_ok,
20830 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
20831 fn clone(&self) -> Self {
20832 if self.result_ok {
20833 Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20834 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
20837 Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
20838 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
20844 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
20845 /// but with all dynamically-allocated buffers duplicated in new buffers.
20846 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
20848 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
20849 /// This corresponds to std::vector in C++
20850 pub struct CVec_PrivateRouteZ {
20851 /// The elements in the array.
20852 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20853 pub data: *mut crate::lightning_invoice::PrivateRoute,
20854 /// The number of elements pointed to by `data`.
20857 impl CVec_PrivateRouteZ {
20858 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
20859 if self.datalen == 0 { return Vec::new(); }
20860 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20861 self.data = core::ptr::null_mut();
20865 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
20866 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20869 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
20870 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
20871 let datalen = v.len();
20872 let data = Box::into_raw(v.into_boxed_slice());
20873 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20877 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20878 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
20879 impl Drop for CVec_PrivateRouteZ {
20880 fn drop(&mut self) {
20881 if self.datalen == 0 { return; }
20882 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20885 impl Clone for CVec_PrivateRouteZ {
20886 fn clone(&self) -> Self {
20887 let mut res = Vec::new();
20888 if self.datalen == 0 { return Self::from(res); }
20889 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20894 /// The contents of CResult_PositiveTimestampCreationErrorZ
20895 pub union CResult_PositiveTimestampCreationErrorZPtr {
20896 /// A pointer to the contents in the success state.
20897 /// Reading from this pointer when `result_ok` is not set is undefined.
20898 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
20899 /// A pointer to the contents in the error state.
20900 /// Reading from this pointer when `result_ok` is set is undefined.
20901 pub err: *mut crate::lightning_invoice::CreationError,
20904 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
20905 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
20906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20907 pub struct CResult_PositiveTimestampCreationErrorZ {
20908 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
20909 /// `err` or `result` depending on the state of `result_ok`.
20910 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
20911 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
20912 pub result_ok: bool,
20915 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
20916 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
20917 CResult_PositiveTimestampCreationErrorZ {
20918 contents: CResult_PositiveTimestampCreationErrorZPtr {
20919 result: Box::into_raw(Box::new(o)),
20925 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
20926 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
20927 CResult_PositiveTimestampCreationErrorZ {
20928 contents: CResult_PositiveTimestampCreationErrorZPtr {
20929 err: Box::into_raw(Box::new(e)),
20934 /// Checks if the given object is currently in the success state
20936 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
20940 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
20941 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
20942 impl Drop for CResult_PositiveTimestampCreationErrorZ {
20943 fn drop(&mut self) {
20944 if self.result_ok {
20945 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20946 let _ = unsafe { Box::from_raw(self.contents.result) };
20949 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20950 let _ = unsafe { Box::from_raw(self.contents.err) };
20955 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
20956 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
20957 let contents = if o.result_ok {
20958 let result = unsafe { o.contents.result };
20959 unsafe { o.contents.result = core::ptr::null_mut() };
20960 CResult_PositiveTimestampCreationErrorZPtr { result }
20962 let err = unsafe { o.contents.err };
20963 unsafe { o.contents.err = core::ptr::null_mut(); }
20964 CResult_PositiveTimestampCreationErrorZPtr { err }
20968 result_ok: o.result_ok,
20972 impl Clone for CResult_PositiveTimestampCreationErrorZ {
20973 fn clone(&self) -> Self {
20974 if self.result_ok {
20975 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
20976 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
20979 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
20980 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
20986 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
20987 /// but with all dynamically-allocated buffers duplicated in new buffers.
20988 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
20990 /// The contents of CResult_NoneBolt11SemanticErrorZ
20991 pub union CResult_NoneBolt11SemanticErrorZPtr {
20992 /// Note that this value is always NULL, as there are no contents in the OK variant
20993 pub result: *mut core::ffi::c_void,
20994 /// A pointer to the contents in the error state.
20995 /// Reading from this pointer when `result_ok` is set is undefined.
20996 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
20999 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
21000 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
21001 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21002 pub struct CResult_NoneBolt11SemanticErrorZ {
21003 /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
21004 /// `err` or `result` depending on the state of `result_ok`.
21005 pub contents: CResult_NoneBolt11SemanticErrorZPtr,
21006 /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
21007 pub result_ok: bool,
21010 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
21011 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
21012 CResult_NoneBolt11SemanticErrorZ {
21013 contents: CResult_NoneBolt11SemanticErrorZPtr {
21014 result: core::ptr::null_mut(),
21020 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
21021 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
21022 CResult_NoneBolt11SemanticErrorZ {
21023 contents: CResult_NoneBolt11SemanticErrorZPtr {
21024 err: Box::into_raw(Box::new(e)),
21029 /// Checks if the given object is currently in the success state
21031 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
21035 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
21036 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
21037 impl Drop for CResult_NoneBolt11SemanticErrorZ {
21038 fn drop(&mut self) {
21039 if self.result_ok {
21041 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21042 let _ = unsafe { Box::from_raw(self.contents.err) };
21047 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
21048 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
21049 let contents = if o.result_ok {
21050 let _ = unsafe { Box::from_raw(o.contents.result) };
21051 o.contents.result = core::ptr::null_mut();
21052 CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
21054 let err = unsafe { o.contents.err };
21055 unsafe { o.contents.err = core::ptr::null_mut(); }
21056 CResult_NoneBolt11SemanticErrorZPtr { err }
21060 result_ok: o.result_ok,
21064 impl Clone for CResult_NoneBolt11SemanticErrorZ {
21065 fn clone(&self) -> Self {
21066 if self.result_ok {
21067 Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
21068 result: core::ptr::null_mut()
21071 Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
21072 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
21078 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
21079 /// but with all dynamically-allocated buffers duplicated in new buffers.
21080 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
21082 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
21083 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
21084 /// A pointer to the contents in the success state.
21085 /// Reading from this pointer when `result_ok` is not set is undefined.
21086 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
21087 /// A pointer to the contents in the error state.
21088 /// Reading from this pointer when `result_ok` is set is undefined.
21089 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
21092 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
21093 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
21094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21095 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21096 /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
21097 /// `err` or `result` depending on the state of `result_ok`.
21098 pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
21099 /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
21100 pub result_ok: bool,
21103 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
21104 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21105 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21106 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
21107 result: Box::into_raw(Box::new(o)),
21113 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
21114 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21115 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21116 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
21117 err: Box::into_raw(Box::new(e)),
21122 /// Checks if the given object is currently in the success state
21124 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
21128 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
21129 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
21130 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21131 fn drop(&mut self) {
21132 if self.result_ok {
21133 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21134 let _ = unsafe { Box::from_raw(self.contents.result) };
21137 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21138 let _ = unsafe { Box::from_raw(self.contents.err) };
21143 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21144 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
21145 let contents = if o.result_ok {
21146 let result = unsafe { o.contents.result };
21147 unsafe { o.contents.result = core::ptr::null_mut() };
21148 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
21150 let err = unsafe { o.contents.err };
21151 unsafe { o.contents.err = core::ptr::null_mut(); }
21152 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
21156 result_ok: o.result_ok,
21160 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
21161 fn clone(&self) -> Self {
21162 if self.result_ok {
21163 Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
21164 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
21167 Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
21168 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
21174 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
21175 /// but with all dynamically-allocated buffers duplicated in new buffers.
21176 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
21178 /// The contents of CResult_DescriptionCreationErrorZ
21179 pub union CResult_DescriptionCreationErrorZPtr {
21180 /// A pointer to the contents in the success state.
21181 /// Reading from this pointer when `result_ok` is not set is undefined.
21182 pub result: *mut crate::lightning_invoice::Description,
21183 /// A pointer to the contents in the error state.
21184 /// Reading from this pointer when `result_ok` is set is undefined.
21185 pub err: *mut crate::lightning_invoice::CreationError,
21188 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
21189 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
21190 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21191 pub struct CResult_DescriptionCreationErrorZ {
21192 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
21193 /// `err` or `result` depending on the state of `result_ok`.
21194 pub contents: CResult_DescriptionCreationErrorZPtr,
21195 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
21196 pub result_ok: bool,
21199 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
21200 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
21201 CResult_DescriptionCreationErrorZ {
21202 contents: CResult_DescriptionCreationErrorZPtr {
21203 result: Box::into_raw(Box::new(o)),
21209 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
21210 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
21211 CResult_DescriptionCreationErrorZ {
21212 contents: CResult_DescriptionCreationErrorZPtr {
21213 err: Box::into_raw(Box::new(e)),
21218 /// Checks if the given object is currently in the success state
21220 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
21224 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
21225 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
21226 impl Drop for CResult_DescriptionCreationErrorZ {
21227 fn drop(&mut self) {
21228 if self.result_ok {
21229 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21230 let _ = unsafe { Box::from_raw(self.contents.result) };
21233 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21234 let _ = unsafe { Box::from_raw(self.contents.err) };
21239 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
21240 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
21241 let contents = if o.result_ok {
21242 let result = unsafe { o.contents.result };
21243 unsafe { o.contents.result = core::ptr::null_mut() };
21244 CResult_DescriptionCreationErrorZPtr { result }
21246 let err = unsafe { o.contents.err };
21247 unsafe { o.contents.err = core::ptr::null_mut(); }
21248 CResult_DescriptionCreationErrorZPtr { err }
21252 result_ok: o.result_ok,
21256 impl Clone for CResult_DescriptionCreationErrorZ {
21257 fn clone(&self) -> Self {
21258 if self.result_ok {
21259 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
21260 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
21263 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
21264 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
21270 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
21271 /// but with all dynamically-allocated buffers duplicated in new buffers.
21272 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
21274 /// The contents of CResult_PrivateRouteCreationErrorZ
21275 pub union CResult_PrivateRouteCreationErrorZPtr {
21276 /// A pointer to the contents in the success state.
21277 /// Reading from this pointer when `result_ok` is not set is undefined.
21278 pub result: *mut crate::lightning_invoice::PrivateRoute,
21279 /// A pointer to the contents in the error state.
21280 /// Reading from this pointer when `result_ok` is set is undefined.
21281 pub err: *mut crate::lightning_invoice::CreationError,
21284 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
21285 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
21286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21287 pub struct CResult_PrivateRouteCreationErrorZ {
21288 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
21289 /// `err` or `result` depending on the state of `result_ok`.
21290 pub contents: CResult_PrivateRouteCreationErrorZPtr,
21291 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
21292 pub result_ok: bool,
21295 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
21296 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
21297 CResult_PrivateRouteCreationErrorZ {
21298 contents: CResult_PrivateRouteCreationErrorZPtr {
21299 result: Box::into_raw(Box::new(o)),
21305 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
21306 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
21307 CResult_PrivateRouteCreationErrorZ {
21308 contents: CResult_PrivateRouteCreationErrorZPtr {
21309 err: Box::into_raw(Box::new(e)),
21314 /// Checks if the given object is currently in the success state
21316 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
21320 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
21321 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
21322 impl Drop for CResult_PrivateRouteCreationErrorZ {
21323 fn drop(&mut self) {
21324 if self.result_ok {
21325 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21326 let _ = unsafe { Box::from_raw(self.contents.result) };
21329 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21330 let _ = unsafe { Box::from_raw(self.contents.err) };
21335 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
21336 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
21337 let contents = if o.result_ok {
21338 let result = unsafe { o.contents.result };
21339 unsafe { o.contents.result = core::ptr::null_mut() };
21340 CResult_PrivateRouteCreationErrorZPtr { result }
21342 let err = unsafe { o.contents.err };
21343 unsafe { o.contents.err = core::ptr::null_mut(); }
21344 CResult_PrivateRouteCreationErrorZPtr { err }
21348 result_ok: o.result_ok,
21352 impl Clone for CResult_PrivateRouteCreationErrorZ {
21353 fn clone(&self) -> Self {
21354 if self.result_ok {
21355 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
21356 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
21359 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
21360 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
21366 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
21367 /// but with all dynamically-allocated buffers duplicated in new buffers.
21368 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
21370 /// The contents of CResult_OutPointDecodeErrorZ
21371 pub union CResult_OutPointDecodeErrorZPtr {
21372 /// A pointer to the contents in the success state.
21373 /// Reading from this pointer when `result_ok` is not set is undefined.
21374 pub result: *mut crate::lightning::chain::transaction::OutPoint,
21375 /// A pointer to the contents in the error state.
21376 /// Reading from this pointer when `result_ok` is set is undefined.
21377 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21380 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
21381 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
21382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21383 pub struct CResult_OutPointDecodeErrorZ {
21384 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
21385 /// `err` or `result` depending on the state of `result_ok`.
21386 pub contents: CResult_OutPointDecodeErrorZPtr,
21387 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
21388 pub result_ok: bool,
21391 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
21392 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
21393 CResult_OutPointDecodeErrorZ {
21394 contents: CResult_OutPointDecodeErrorZPtr {
21395 result: Box::into_raw(Box::new(o)),
21401 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
21402 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
21403 CResult_OutPointDecodeErrorZ {
21404 contents: CResult_OutPointDecodeErrorZPtr {
21405 err: Box::into_raw(Box::new(e)),
21410 /// Checks if the given object is currently in the success state
21412 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
21416 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
21417 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
21418 impl Drop for CResult_OutPointDecodeErrorZ {
21419 fn drop(&mut self) {
21420 if self.result_ok {
21421 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21422 let _ = unsafe { Box::from_raw(self.contents.result) };
21425 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21426 let _ = unsafe { Box::from_raw(self.contents.err) };
21431 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
21432 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
21433 let contents = if o.result_ok {
21434 let result = unsafe { o.contents.result };
21435 unsafe { o.contents.result = core::ptr::null_mut() };
21436 CResult_OutPointDecodeErrorZPtr { result }
21438 let err = unsafe { o.contents.err };
21439 unsafe { o.contents.err = core::ptr::null_mut(); }
21440 CResult_OutPointDecodeErrorZPtr { err }
21444 result_ok: o.result_ok,
21448 impl Clone for CResult_OutPointDecodeErrorZ {
21449 fn clone(&self) -> Self {
21450 if self.result_ok {
21451 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
21452 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
21455 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
21456 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21462 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
21463 /// but with all dynamically-allocated buffers duplicated in new buffers.
21464 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
21466 /// The contents of CResult_BigSizeDecodeErrorZ
21467 pub union CResult_BigSizeDecodeErrorZPtr {
21468 /// A pointer to the contents in the success state.
21469 /// Reading from this pointer when `result_ok` is not set is undefined.
21470 pub result: *mut crate::lightning::util::ser::BigSize,
21471 /// A pointer to the contents in the error state.
21472 /// Reading from this pointer when `result_ok` is set is undefined.
21473 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21476 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
21477 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
21478 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21479 pub struct CResult_BigSizeDecodeErrorZ {
21480 /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
21481 /// `err` or `result` depending on the state of `result_ok`.
21482 pub contents: CResult_BigSizeDecodeErrorZPtr,
21483 /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
21484 pub result_ok: bool,
21487 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
21488 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
21489 CResult_BigSizeDecodeErrorZ {
21490 contents: CResult_BigSizeDecodeErrorZPtr {
21491 result: Box::into_raw(Box::new(o)),
21497 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
21498 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
21499 CResult_BigSizeDecodeErrorZ {
21500 contents: CResult_BigSizeDecodeErrorZPtr {
21501 err: Box::into_raw(Box::new(e)),
21506 /// Checks if the given object is currently in the success state
21508 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
21512 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
21513 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
21514 impl Drop for CResult_BigSizeDecodeErrorZ {
21515 fn drop(&mut self) {
21516 if self.result_ok {
21517 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21518 let _ = unsafe { Box::from_raw(self.contents.result) };
21521 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21522 let _ = unsafe { Box::from_raw(self.contents.err) };
21527 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
21528 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
21529 let contents = if o.result_ok {
21530 let result = unsafe { o.contents.result };
21531 unsafe { o.contents.result = core::ptr::null_mut() };
21532 CResult_BigSizeDecodeErrorZPtr { result }
21534 let err = unsafe { o.contents.err };
21535 unsafe { o.contents.err = core::ptr::null_mut(); }
21536 CResult_BigSizeDecodeErrorZPtr { err }
21540 result_ok: o.result_ok,
21544 impl Clone for CResult_BigSizeDecodeErrorZ {
21545 fn clone(&self) -> Self {
21546 if self.result_ok {
21547 Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
21548 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
21551 Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
21552 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21558 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
21559 /// but with all dynamically-allocated buffers duplicated in new buffers.
21560 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
21562 /// The contents of CResult_HostnameDecodeErrorZ
21563 pub union CResult_HostnameDecodeErrorZPtr {
21564 /// A pointer to the contents in the success state.
21565 /// Reading from this pointer when `result_ok` is not set is undefined.
21566 pub result: *mut crate::lightning::util::ser::Hostname,
21567 /// A pointer to the contents in the error state.
21568 /// Reading from this pointer when `result_ok` is set is undefined.
21569 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21572 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
21573 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
21574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21575 pub struct CResult_HostnameDecodeErrorZ {
21576 /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
21577 /// `err` or `result` depending on the state of `result_ok`.
21578 pub contents: CResult_HostnameDecodeErrorZPtr,
21579 /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
21580 pub result_ok: bool,
21583 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
21584 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
21585 CResult_HostnameDecodeErrorZ {
21586 contents: CResult_HostnameDecodeErrorZPtr {
21587 result: Box::into_raw(Box::new(o)),
21593 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
21594 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
21595 CResult_HostnameDecodeErrorZ {
21596 contents: CResult_HostnameDecodeErrorZPtr {
21597 err: Box::into_raw(Box::new(e)),
21602 /// Checks if the given object is currently in the success state
21604 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
21608 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
21609 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
21610 impl Drop for CResult_HostnameDecodeErrorZ {
21611 fn drop(&mut self) {
21612 if self.result_ok {
21613 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21614 let _ = unsafe { Box::from_raw(self.contents.result) };
21617 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21618 let _ = unsafe { Box::from_raw(self.contents.err) };
21623 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
21624 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
21625 let contents = if o.result_ok {
21626 let result = unsafe { o.contents.result };
21627 unsafe { o.contents.result = core::ptr::null_mut() };
21628 CResult_HostnameDecodeErrorZPtr { result }
21630 let err = unsafe { o.contents.err };
21631 unsafe { o.contents.err = core::ptr::null_mut(); }
21632 CResult_HostnameDecodeErrorZPtr { err }
21636 result_ok: o.result_ok,
21640 impl Clone for CResult_HostnameDecodeErrorZ {
21641 fn clone(&self) -> Self {
21642 if self.result_ok {
21643 Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
21644 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
21647 Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
21648 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21654 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
21655 /// but with all dynamically-allocated buffers duplicated in new buffers.
21656 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
21658 /// The contents of CResult_TransactionU16LenLimitedNoneZ
21659 pub union CResult_TransactionU16LenLimitedNoneZPtr {
21660 /// A pointer to the contents in the success state.
21661 /// Reading from this pointer when `result_ok` is not set is undefined.
21662 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
21663 /// Note that this value is always NULL, as there are no contents in the Err variant
21664 pub err: *mut core::ffi::c_void,
21667 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
21668 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
21669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21670 pub struct CResult_TransactionU16LenLimitedNoneZ {
21671 /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
21672 /// `err` or `result` depending on the state of `result_ok`.
21673 pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
21674 /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
21675 pub result_ok: bool,
21678 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
21679 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
21680 CResult_TransactionU16LenLimitedNoneZ {
21681 contents: CResult_TransactionU16LenLimitedNoneZPtr {
21682 result: Box::into_raw(Box::new(o)),
21688 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
21689 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
21690 CResult_TransactionU16LenLimitedNoneZ {
21691 contents: CResult_TransactionU16LenLimitedNoneZPtr {
21692 err: core::ptr::null_mut(),
21697 /// Checks if the given object is currently in the success state
21699 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
21703 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
21704 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
21705 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
21706 fn drop(&mut self) {
21707 if self.result_ok {
21708 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21709 let _ = unsafe { Box::from_raw(self.contents.result) };
21715 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
21716 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
21717 let contents = if o.result_ok {
21718 let result = unsafe { o.contents.result };
21719 unsafe { o.contents.result = core::ptr::null_mut() };
21720 CResult_TransactionU16LenLimitedNoneZPtr { result }
21722 let _ = unsafe { Box::from_raw(o.contents.err) };
21723 o.contents.err = core::ptr::null_mut();
21724 CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
21728 result_ok: o.result_ok,
21732 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
21733 fn clone(&self) -> Self {
21734 if self.result_ok {
21735 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
21736 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
21739 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
21740 err: core::ptr::null_mut()
21746 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
21747 /// but with all dynamically-allocated buffers duplicated in new buffers.
21748 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
21750 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
21751 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21752 /// A pointer to the contents in the success state.
21753 /// Reading from this pointer when `result_ok` is not set is undefined.
21754 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
21755 /// A pointer to the contents in the error state.
21756 /// Reading from this pointer when `result_ok` is set is undefined.
21757 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21760 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
21761 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
21762 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21763 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
21764 /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
21765 /// `err` or `result` depending on the state of `result_ok`.
21766 pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
21767 /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
21768 pub result_ok: bool,
21771 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
21772 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
21773 CResult_TransactionU16LenLimitedDecodeErrorZ {
21774 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21775 result: Box::into_raw(Box::new(o)),
21781 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
21782 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
21783 CResult_TransactionU16LenLimitedDecodeErrorZ {
21784 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21785 err: Box::into_raw(Box::new(e)),
21790 /// Checks if the given object is currently in the success state
21792 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
21796 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
21797 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
21798 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
21799 fn drop(&mut self) {
21800 if self.result_ok {
21801 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21802 let _ = unsafe { Box::from_raw(self.contents.result) };
21805 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21806 let _ = unsafe { Box::from_raw(self.contents.err) };
21811 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
21812 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
21813 let contents = if o.result_ok {
21814 let result = unsafe { o.contents.result };
21815 unsafe { o.contents.result = core::ptr::null_mut() };
21816 CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
21818 let err = unsafe { o.contents.err };
21819 unsafe { o.contents.err = core::ptr::null_mut(); }
21820 CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
21824 result_ok: o.result_ok,
21828 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
21829 fn clone(&self) -> Self {
21830 if self.result_ok {
21831 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21832 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
21835 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
21836 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21842 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
21843 /// but with all dynamically-allocated buffers duplicated in new buffers.
21844 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
21846 /// The contents of CResult_UntrustedStringDecodeErrorZ
21847 pub union CResult_UntrustedStringDecodeErrorZPtr {
21848 /// A pointer to the contents in the success state.
21849 /// Reading from this pointer when `result_ok` is not set is undefined.
21850 pub result: *mut crate::lightning::util::string::UntrustedString,
21851 /// A pointer to the contents in the error state.
21852 /// Reading from this pointer when `result_ok` is set is undefined.
21853 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21856 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
21857 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
21858 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21859 pub struct CResult_UntrustedStringDecodeErrorZ {
21860 /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
21861 /// `err` or `result` depending on the state of `result_ok`.
21862 pub contents: CResult_UntrustedStringDecodeErrorZPtr,
21863 /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
21864 pub result_ok: bool,
21867 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
21868 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
21869 CResult_UntrustedStringDecodeErrorZ {
21870 contents: CResult_UntrustedStringDecodeErrorZPtr {
21871 result: Box::into_raw(Box::new(o)),
21877 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
21878 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
21879 CResult_UntrustedStringDecodeErrorZ {
21880 contents: CResult_UntrustedStringDecodeErrorZPtr {
21881 err: Box::into_raw(Box::new(e)),
21886 /// Checks if the given object is currently in the success state
21888 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
21892 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
21893 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
21894 impl Drop for CResult_UntrustedStringDecodeErrorZ {
21895 fn drop(&mut self) {
21896 if self.result_ok {
21897 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21898 let _ = unsafe { Box::from_raw(self.contents.result) };
21901 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21902 let _ = unsafe { Box::from_raw(self.contents.err) };
21907 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
21908 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
21909 let contents = if o.result_ok {
21910 let result = unsafe { o.contents.result };
21911 unsafe { o.contents.result = core::ptr::null_mut() };
21912 CResult_UntrustedStringDecodeErrorZPtr { result }
21914 let err = unsafe { o.contents.err };
21915 unsafe { o.contents.err = core::ptr::null_mut(); }
21916 CResult_UntrustedStringDecodeErrorZPtr { err }
21920 result_ok: o.result_ok,
21924 impl Clone for CResult_UntrustedStringDecodeErrorZ {
21925 fn clone(&self) -> Self {
21926 if self.result_ok {
21927 Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
21928 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
21931 Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
21932 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21938 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
21939 /// but with all dynamically-allocated buffers duplicated in new buffers.
21940 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
21942 /// The contents of CResult_ReceiveTlvsDecodeErrorZ
21943 pub union CResult_ReceiveTlvsDecodeErrorZPtr {
21944 /// A pointer to the contents in the success state.
21945 /// Reading from this pointer when `result_ok` is not set is undefined.
21946 pub result: *mut crate::lightning::blinded_path::payment::ReceiveTlvs,
21947 /// A pointer to the contents in the error state.
21948 /// Reading from this pointer when `result_ok` is set is undefined.
21949 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21952 /// A CResult_ReceiveTlvsDecodeErrorZ represents the result of a fallible operation,
21953 /// containing a crate::lightning::blinded_path::payment::ReceiveTlvs on success and a crate::lightning::ln::msgs::DecodeError on failure.
21954 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21955 pub struct CResult_ReceiveTlvsDecodeErrorZ {
21956 /// The contents of this CResult_ReceiveTlvsDecodeErrorZ, accessible via either
21957 /// `err` or `result` depending on the state of `result_ok`.
21958 pub contents: CResult_ReceiveTlvsDecodeErrorZPtr,
21959 /// Whether this CResult_ReceiveTlvsDecodeErrorZ represents a success state.
21960 pub result_ok: bool,
21963 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ in the success state.
21964 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::ReceiveTlvs) -> CResult_ReceiveTlvsDecodeErrorZ {
21965 CResult_ReceiveTlvsDecodeErrorZ {
21966 contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21967 result: Box::into_raw(Box::new(o)),
21973 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ in the error state.
21974 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReceiveTlvsDecodeErrorZ {
21975 CResult_ReceiveTlvsDecodeErrorZ {
21976 contents: CResult_ReceiveTlvsDecodeErrorZPtr {
21977 err: Box::into_raw(Box::new(e)),
21982 /// Checks if the given object is currently in the success state
21984 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_is_ok(o: &CResult_ReceiveTlvsDecodeErrorZ) -> bool {
21988 /// Frees any resources used by the CResult_ReceiveTlvsDecodeErrorZ.
21989 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_free(_res: CResult_ReceiveTlvsDecodeErrorZ) { }
21990 impl Drop for CResult_ReceiveTlvsDecodeErrorZ {
21991 fn drop(&mut self) {
21992 if self.result_ok {
21993 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21994 let _ = unsafe { Box::from_raw(self.contents.result) };
21997 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21998 let _ = unsafe { Box::from_raw(self.contents.err) };
22003 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::ReceiveTlvs, crate::lightning::ln::msgs::DecodeError>> for CResult_ReceiveTlvsDecodeErrorZ {
22004 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::ReceiveTlvs, crate::lightning::ln::msgs::DecodeError>) -> Self {
22005 let contents = if o.result_ok {
22006 let result = unsafe { o.contents.result };
22007 unsafe { o.contents.result = core::ptr::null_mut() };
22008 CResult_ReceiveTlvsDecodeErrorZPtr { result }
22010 let err = unsafe { o.contents.err };
22011 unsafe { o.contents.err = core::ptr::null_mut(); }
22012 CResult_ReceiveTlvsDecodeErrorZPtr { err }
22016 result_ok: o.result_ok,
22020 impl Clone for CResult_ReceiveTlvsDecodeErrorZ {
22021 fn clone(&self) -> Self {
22022 if self.result_ok {
22023 Self { result_ok: true, contents: CResult_ReceiveTlvsDecodeErrorZPtr {
22024 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::ReceiveTlvs>::clone(unsafe { &*self.contents.result })))
22027 Self { result_ok: false, contents: CResult_ReceiveTlvsDecodeErrorZPtr {
22028 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22034 /// Creates a new CResult_ReceiveTlvsDecodeErrorZ which has the same data as `orig`
22035 /// but with all dynamically-allocated buffers duplicated in new buffers.
22036 pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_clone(orig: &CResult_ReceiveTlvsDecodeErrorZ) -> CResult_ReceiveTlvsDecodeErrorZ { Clone::clone(&orig) }
22038 /// The contents of CResult_PaymentRelayDecodeErrorZ
22039 pub union CResult_PaymentRelayDecodeErrorZPtr {
22040 /// A pointer to the contents in the success state.
22041 /// Reading from this pointer when `result_ok` is not set is undefined.
22042 pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay,
22043 /// A pointer to the contents in the error state.
22044 /// Reading from this pointer when `result_ok` is set is undefined.
22045 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22048 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
22049 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
22050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22051 pub struct CResult_PaymentRelayDecodeErrorZ {
22052 /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
22053 /// `err` or `result` depending on the state of `result_ok`.
22054 pub contents: CResult_PaymentRelayDecodeErrorZPtr,
22055 /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
22056 pub result_ok: bool,
22059 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
22060 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
22061 CResult_PaymentRelayDecodeErrorZ {
22062 contents: CResult_PaymentRelayDecodeErrorZPtr {
22063 result: Box::into_raw(Box::new(o)),
22069 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
22070 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
22071 CResult_PaymentRelayDecodeErrorZ {
22072 contents: CResult_PaymentRelayDecodeErrorZPtr {
22073 err: Box::into_raw(Box::new(e)),
22078 /// Checks if the given object is currently in the success state
22080 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
22084 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
22085 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
22086 impl Drop for CResult_PaymentRelayDecodeErrorZ {
22087 fn drop(&mut self) {
22088 if self.result_ok {
22089 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22090 let _ = unsafe { Box::from_raw(self.contents.result) };
22093 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22094 let _ = unsafe { Box::from_raw(self.contents.err) };
22099 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
22100 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> Self {
22101 let contents = if o.result_ok {
22102 let result = unsafe { o.contents.result };
22103 unsafe { o.contents.result = core::ptr::null_mut() };
22104 CResult_PaymentRelayDecodeErrorZPtr { result }
22106 let err = unsafe { o.contents.err };
22107 unsafe { o.contents.err = core::ptr::null_mut(); }
22108 CResult_PaymentRelayDecodeErrorZPtr { err }
22112 result_ok: o.result_ok,
22116 impl Clone for CResult_PaymentRelayDecodeErrorZ {
22117 fn clone(&self) -> Self {
22118 if self.result_ok {
22119 Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
22120 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
22123 Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
22124 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22130 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
22131 /// but with all dynamically-allocated buffers duplicated in new buffers.
22132 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
22134 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
22135 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
22136 /// A pointer to the contents in the success state.
22137 /// Reading from this pointer when `result_ok` is not set is undefined.
22138 pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
22139 /// A pointer to the contents in the error state.
22140 /// Reading from this pointer when `result_ok` is set is undefined.
22141 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22144 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
22145 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
22146 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22147 pub struct CResult_PaymentConstraintsDecodeErrorZ {
22148 /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
22149 /// `err` or `result` depending on the state of `result_ok`.
22150 pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
22151 /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
22152 pub result_ok: bool,
22155 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
22156 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
22157 CResult_PaymentConstraintsDecodeErrorZ {
22158 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
22159 result: Box::into_raw(Box::new(o)),
22165 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
22166 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
22167 CResult_PaymentConstraintsDecodeErrorZ {
22168 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
22169 err: Box::into_raw(Box::new(e)),
22174 /// Checks if the given object is currently in the success state
22176 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
22180 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
22181 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
22182 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
22183 fn drop(&mut self) {
22184 if self.result_ok {
22185 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22186 let _ = unsafe { Box::from_raw(self.contents.result) };
22189 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22190 let _ = unsafe { Box::from_raw(self.contents.err) };
22195 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
22196 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
22197 let contents = if o.result_ok {
22198 let result = unsafe { o.contents.result };
22199 unsafe { o.contents.result = core::ptr::null_mut() };
22200 CResult_PaymentConstraintsDecodeErrorZPtr { result }
22202 let err = unsafe { o.contents.err };
22203 unsafe { o.contents.err = core::ptr::null_mut(); }
22204 CResult_PaymentConstraintsDecodeErrorZPtr { err }
22208 result_ok: o.result_ok,
22212 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
22213 fn clone(&self) -> Self {
22214 if self.result_ok {
22215 Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
22216 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
22219 Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
22220 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22226 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
22227 /// but with all dynamically-allocated buffers duplicated in new buffers.
22228 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
22230 /// The contents of CResult_ThirtyTwoBytesPaymentErrorZ
22231 pub union CResult_ThirtyTwoBytesPaymentErrorZPtr {
22232 /// A pointer to the contents in the success state.
22233 /// Reading from this pointer when `result_ok` is not set is undefined.
22234 pub result: *mut crate::c_types::ThirtyTwoBytes,
22235 /// A pointer to the contents in the error state.
22236 /// Reading from this pointer when `result_ok` is set is undefined.
22237 pub err: *mut crate::lightning_invoice::payment::PaymentError,
22240 /// A CResult_ThirtyTwoBytesPaymentErrorZ represents the result of a fallible operation,
22241 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
22242 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22243 pub struct CResult_ThirtyTwoBytesPaymentErrorZ {
22244 /// The contents of this CResult_ThirtyTwoBytesPaymentErrorZ, accessible via either
22245 /// `err` or `result` depending on the state of `result_ok`.
22246 pub contents: CResult_ThirtyTwoBytesPaymentErrorZPtr,
22247 /// Whether this CResult_ThirtyTwoBytesPaymentErrorZ represents a success state.
22248 pub result_ok: bool,
22251 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the success state.
22252 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentErrorZ {
22253 CResult_ThirtyTwoBytesPaymentErrorZ {
22254 contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
22255 result: Box::into_raw(Box::new(o)),
22261 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the error state.
22262 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_ThirtyTwoBytesPaymentErrorZ {
22263 CResult_ThirtyTwoBytesPaymentErrorZ {
22264 contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
22265 err: Box::into_raw(Box::new(e)),
22270 /// Checks if the given object is currently in the success state
22272 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentErrorZ) -> bool {
22276 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentErrorZ.
22277 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_free(_res: CResult_ThirtyTwoBytesPaymentErrorZ) { }
22278 impl Drop for CResult_ThirtyTwoBytesPaymentErrorZ {
22279 fn drop(&mut self) {
22280 if self.result_ok {
22281 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22282 let _ = unsafe { Box::from_raw(self.contents.result) };
22285 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22286 let _ = unsafe { Box::from_raw(self.contents.err) };
22291 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_ThirtyTwoBytesPaymentErrorZ {
22292 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
22293 let contents = if o.result_ok {
22294 let result = unsafe { o.contents.result };
22295 unsafe { o.contents.result = core::ptr::null_mut() };
22296 CResult_ThirtyTwoBytesPaymentErrorZPtr { result }
22298 let err = unsafe { o.contents.err };
22299 unsafe { o.contents.err = core::ptr::null_mut(); }
22300 CResult_ThirtyTwoBytesPaymentErrorZPtr { err }
22304 result_ok: o.result_ok,
22308 impl Clone for CResult_ThirtyTwoBytesPaymentErrorZ {
22309 fn clone(&self) -> Self {
22310 if self.result_ok {
22311 Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
22312 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
22315 Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentErrorZPtr {
22316 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
22322 /// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ which has the same data as `orig`
22323 /// but with all dynamically-allocated buffers duplicated in new buffers.
22324 pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig: &CResult_ThirtyTwoBytesPaymentErrorZ) -> CResult_ThirtyTwoBytesPaymentErrorZ { Clone::clone(&orig) }
22326 /// The contents of CResult_NonePaymentErrorZ
22327 pub union CResult_NonePaymentErrorZPtr {
22328 /// Note that this value is always NULL, as there are no contents in the OK variant
22329 pub result: *mut core::ffi::c_void,
22330 /// A pointer to the contents in the error state.
22331 /// Reading from this pointer when `result_ok` is set is undefined.
22332 pub err: *mut crate::lightning_invoice::payment::PaymentError,
22335 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
22336 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
22337 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22338 pub struct CResult_NonePaymentErrorZ {
22339 /// The contents of this CResult_NonePaymentErrorZ, accessible via either
22340 /// `err` or `result` depending on the state of `result_ok`.
22341 pub contents: CResult_NonePaymentErrorZPtr,
22342 /// Whether this CResult_NonePaymentErrorZ represents a success state.
22343 pub result_ok: bool,
22346 /// Creates a new CResult_NonePaymentErrorZ in the success state.
22347 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
22348 CResult_NonePaymentErrorZ {
22349 contents: CResult_NonePaymentErrorZPtr {
22350 result: core::ptr::null_mut(),
22356 /// Creates a new CResult_NonePaymentErrorZ in the error state.
22357 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
22358 CResult_NonePaymentErrorZ {
22359 contents: CResult_NonePaymentErrorZPtr {
22360 err: Box::into_raw(Box::new(e)),
22365 /// Checks if the given object is currently in the success state
22367 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
22371 /// Frees any resources used by the CResult_NonePaymentErrorZ.
22372 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
22373 impl Drop for CResult_NonePaymentErrorZ {
22374 fn drop(&mut self) {
22375 if self.result_ok {
22377 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22378 let _ = unsafe { Box::from_raw(self.contents.err) };
22383 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
22384 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
22385 let contents = if o.result_ok {
22386 let _ = unsafe { Box::from_raw(o.contents.result) };
22387 o.contents.result = core::ptr::null_mut();
22388 CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
22390 let err = unsafe { o.contents.err };
22391 unsafe { o.contents.err = core::ptr::null_mut(); }
22392 CResult_NonePaymentErrorZPtr { err }
22396 result_ok: o.result_ok,
22400 impl Clone for CResult_NonePaymentErrorZ {
22401 fn clone(&self) -> Self {
22402 if self.result_ok {
22403 Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
22404 result: core::ptr::null_mut()
22407 Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
22408 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
22414 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
22415 /// but with all dynamically-allocated buffers duplicated in new buffers.
22416 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
22418 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ
22419 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22420 /// A pointer to the contents in the success state.
22421 /// Reading from this pointer when `result_ok` is not set is undefined.
22422 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
22423 /// A pointer to the contents in the error state.
22424 /// Reading from this pointer when `result_ok` is set is undefined.
22425 pub err: *mut crate::lightning_invoice::payment::ProbingError,
22428 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents the result of a fallible operation,
22429 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning_invoice::payment::ProbingError on failure.
22430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22431 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22432 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ, accessible via either
22433 /// `err` or `result` depending on the state of `result_ok`.
22434 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr,
22435 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents a success state.
22436 pub result_ok: bool,
22439 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the success state.
22440 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22441 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22442 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22443 result: Box::into_raw(Box::new(o)),
22449 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the error state.
22450 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e: crate::lightning_invoice::payment::ProbingError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22451 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22452 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22453 err: Box::into_raw(Box::new(e)),
22458 /// Checks if the given object is currently in the success state
22460 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) -> bool {
22464 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.
22465 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) { }
22466 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22467 fn drop(&mut self) {
22468 if self.result_ok {
22469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22470 let _ = unsafe { Box::from_raw(self.contents.result) };
22473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22474 let _ = unsafe { Box::from_raw(self.contents.err) };
22479 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning_invoice::payment::ProbingError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22480 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning_invoice::payment::ProbingError>) -> Self {
22481 let contents = if o.result_ok {
22482 let result = unsafe { o.contents.result };
22483 unsafe { o.contents.result = core::ptr::null_mut() };
22484 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { result }
22486 let err = unsafe { o.contents.err };
22487 unsafe { o.contents.err = core::ptr::null_mut(); }
22488 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { err }
22492 result_ok: o.result_ok,
22496 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
22497 fn clone(&self) -> Self {
22498 if self.result_ok {
22499 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22500 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
22503 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr {
22504 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::ProbingError>::clone(unsafe { &*self.contents.err })))
22510 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ which has the same data as `orig`
22511 /// but with all dynamically-allocated buffers duplicated in new buffers.
22512 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { Clone::clone(&orig) }
22514 /// The contents of CResult_StrSecp256k1ErrorZ
22515 pub union CResult_StrSecp256k1ErrorZPtr {
22516 /// A pointer to the contents in the success state.
22517 /// Reading from this pointer when `result_ok` is not set is undefined.
22518 pub result: *mut crate::c_types::Str,
22519 /// A pointer to the contents in the error state.
22520 /// Reading from this pointer when `result_ok` is set is undefined.
22521 pub err: *mut crate::c_types::Secp256k1Error,
22524 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
22525 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
22526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22527 pub struct CResult_StrSecp256k1ErrorZ {
22528 /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
22529 /// `err` or `result` depending on the state of `result_ok`.
22530 pub contents: CResult_StrSecp256k1ErrorZPtr,
22531 /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
22532 pub result_ok: bool,
22535 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
22536 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
22537 CResult_StrSecp256k1ErrorZ {
22538 contents: CResult_StrSecp256k1ErrorZPtr {
22539 result: Box::into_raw(Box::new(o)),
22545 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
22546 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
22547 CResult_StrSecp256k1ErrorZ {
22548 contents: CResult_StrSecp256k1ErrorZPtr {
22549 err: Box::into_raw(Box::new(e)),
22554 /// Checks if the given object is currently in the success state
22556 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
22560 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
22561 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
22562 impl Drop for CResult_StrSecp256k1ErrorZ {
22563 fn drop(&mut self) {
22564 if self.result_ok {
22565 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22566 let _ = unsafe { Box::from_raw(self.contents.result) };
22569 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22570 let _ = unsafe { Box::from_raw(self.contents.err) };
22575 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
22576 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
22577 let contents = if o.result_ok {
22578 let result = unsafe { o.contents.result };
22579 unsafe { o.contents.result = core::ptr::null_mut() };
22580 CResult_StrSecp256k1ErrorZPtr { result }
22582 let err = unsafe { o.contents.err };
22583 unsafe { o.contents.err = core::ptr::null_mut(); }
22584 CResult_StrSecp256k1ErrorZPtr { err }
22588 result_ok: o.result_ok,
22592 impl Clone for CResult_StrSecp256k1ErrorZ {
22593 fn clone(&self) -> Self {
22594 if self.result_ok {
22595 Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
22596 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
22599 Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
22600 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
22606 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
22607 /// but with all dynamically-allocated buffers duplicated in new buffers.
22608 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
22610 /// The contents of CResult_TxOutUtxoLookupErrorZ
22611 pub union CResult_TxOutUtxoLookupErrorZPtr {
22612 /// A pointer to the contents in the success state.
22613 /// Reading from this pointer when `result_ok` is not set is undefined.
22614 pub result: *mut crate::c_types::TxOut,
22615 /// A pointer to the contents in the error state.
22616 /// Reading from this pointer when `result_ok` is set is undefined.
22617 pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
22620 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
22621 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
22622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22623 pub struct CResult_TxOutUtxoLookupErrorZ {
22624 /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
22625 /// `err` or `result` depending on the state of `result_ok`.
22626 pub contents: CResult_TxOutUtxoLookupErrorZPtr,
22627 /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
22628 pub result_ok: bool,
22631 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
22632 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
22633 CResult_TxOutUtxoLookupErrorZ {
22634 contents: CResult_TxOutUtxoLookupErrorZPtr {
22635 result: Box::into_raw(Box::new(o)),
22641 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
22642 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
22643 CResult_TxOutUtxoLookupErrorZ {
22644 contents: CResult_TxOutUtxoLookupErrorZPtr {
22645 err: Box::into_raw(Box::new(e)),
22650 /// Checks if the given object is currently in the success state
22652 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
22656 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
22657 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
22658 impl Drop for CResult_TxOutUtxoLookupErrorZ {
22659 fn drop(&mut self) {
22660 if self.result_ok {
22661 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22662 let _ = unsafe { Box::from_raw(self.contents.result) };
22665 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22666 let _ = unsafe { Box::from_raw(self.contents.err) };
22671 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
22672 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
22673 let contents = if o.result_ok {
22674 let result = unsafe { o.contents.result };
22675 unsafe { o.contents.result = core::ptr::null_mut() };
22676 CResult_TxOutUtxoLookupErrorZPtr { result }
22678 let err = unsafe { o.contents.err };
22679 unsafe { o.contents.err = core::ptr::null_mut(); }
22680 CResult_TxOutUtxoLookupErrorZPtr { err }
22684 result_ok: o.result_ok,
22688 impl Clone for CResult_TxOutUtxoLookupErrorZ {
22689 fn clone(&self) -> Self {
22690 if self.result_ok {
22691 Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
22692 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
22695 Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
22696 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
22702 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
22703 /// but with all dynamically-allocated buffers duplicated in new buffers.
22704 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
22706 /// The contents of CResult_OnionMessagePathNoneZ
22707 pub union CResult_OnionMessagePathNoneZPtr {
22708 /// A pointer to the contents in the success state.
22709 /// Reading from this pointer when `result_ok` is not set is undefined.
22710 pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
22711 /// Note that this value is always NULL, as there are no contents in the Err variant
22712 pub err: *mut core::ffi::c_void,
22715 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
22716 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
22717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22718 pub struct CResult_OnionMessagePathNoneZ {
22719 /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
22720 /// `err` or `result` depending on the state of `result_ok`.
22721 pub contents: CResult_OnionMessagePathNoneZPtr,
22722 /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
22723 pub result_ok: bool,
22726 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
22727 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
22728 CResult_OnionMessagePathNoneZ {
22729 contents: CResult_OnionMessagePathNoneZPtr {
22730 result: Box::into_raw(Box::new(o)),
22736 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
22737 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
22738 CResult_OnionMessagePathNoneZ {
22739 contents: CResult_OnionMessagePathNoneZPtr {
22740 err: core::ptr::null_mut(),
22745 /// Checks if the given object is currently in the success state
22747 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
22751 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
22752 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
22753 impl Drop for CResult_OnionMessagePathNoneZ {
22754 fn drop(&mut self) {
22755 if self.result_ok {
22756 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22757 let _ = unsafe { Box::from_raw(self.contents.result) };
22763 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
22764 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
22765 let contents = if o.result_ok {
22766 let result = unsafe { o.contents.result };
22767 unsafe { o.contents.result = core::ptr::null_mut() };
22768 CResult_OnionMessagePathNoneZPtr { result }
22770 let _ = unsafe { Box::from_raw(o.contents.err) };
22771 o.contents.err = core::ptr::null_mut();
22772 CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
22776 result_ok: o.result_ok,
22780 impl Clone for CResult_OnionMessagePathNoneZ {
22781 fn clone(&self) -> Self {
22782 if self.result_ok {
22783 Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
22784 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
22787 Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
22788 err: core::ptr::null_mut()
22794 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
22795 /// but with all dynamically-allocated buffers duplicated in new buffers.
22796 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
22798 /// A tuple of 2 elements. See the individual fields for the types contained.
22799 pub struct C2Tuple_PublicKeyOnionMessageZ {
22800 /// The element at position 0
22801 pub a: crate::c_types::PublicKey,
22802 /// The element at position 1
22803 pub b: crate::lightning::ln::msgs::OnionMessage,
22805 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage)> for C2Tuple_PublicKeyOnionMessageZ {
22806 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage)) -> Self {
22813 impl C2Tuple_PublicKeyOnionMessageZ {
22814 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage) {
22818 impl Clone for C2Tuple_PublicKeyOnionMessageZ {
22819 fn clone(&self) -> Self {
22821 a: Clone::clone(&self.a),
22822 b: Clone::clone(&self.b),
22827 /// Creates a new tuple which has the same data as `orig`
22828 /// but with all dynamically-allocated buffers duplicated in new buffers.
22829 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_clone(orig: &C2Tuple_PublicKeyOnionMessageZ) -> C2Tuple_PublicKeyOnionMessageZ { Clone::clone(&orig) }
22830 /// Creates a new C2Tuple_PublicKeyOnionMessageZ from the contained elements.
22832 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::msgs::OnionMessage) -> C2Tuple_PublicKeyOnionMessageZ {
22833 C2Tuple_PublicKeyOnionMessageZ { a, b, }
22837 /// Frees any resources used by the C2Tuple_PublicKeyOnionMessageZ.
22838 pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_free(_res: C2Tuple_PublicKeyOnionMessageZ) { }
22840 /// The contents of CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ
22841 pub union CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22842 /// A pointer to the contents in the success state.
22843 /// Reading from this pointer when `result_ok` is not set is undefined.
22844 pub result: *mut crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ,
22845 /// A pointer to the contents in the error state.
22846 /// Reading from this pointer when `result_ok` is set is undefined.
22847 pub err: *mut crate::lightning::onion_message::messenger::SendError,
22850 /// A CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents the result of a fallible operation,
22851 /// containing a crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
22852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22853 pub struct CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22854 /// The contents of this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ, accessible via either
22855 /// `err` or `result` depending on the state of `result_ok`.
22856 pub contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr,
22857 /// Whether this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents a success state.
22858 pub result_ok: bool,
22861 /// Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the success state.
22862 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o: crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ) -> CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22863 CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22864 contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22865 result: Box::into_raw(Box::new(o)),
22871 /// Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the error state.
22872 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22873 CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22874 contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr {
22875 err: Box::into_raw(Box::new(e)),
22880 /// Checks if the given object is currently in the success state
22882 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o: &CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ) -> bool {
22886 /// Frees any resources used by the CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ.
22887 pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ) { }
22888 impl Drop for CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22889 fn drop(&mut self) {
22890 if self.result_ok {
22891 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22892 let _ = unsafe { Box::from_raw(self.contents.result) };
22895 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22896 let _ = unsafe { Box::from_raw(self.contents.err) };
22901 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ, crate::lightning::onion_message::messenger::SendError>> for CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
22902 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
22903 let contents = if o.result_ok {
22904 let result = unsafe { o.contents.result };
22905 unsafe { o.contents.result = core::ptr::null_mut() };
22906 CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { result }
22908 let err = unsafe { o.contents.err };
22909 unsafe { o.contents.err = core::ptr::null_mut(); }
22910 CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { err }
22914 result_ok: o.result_ok,
22919 /// The contents of CResult_PeeledOnionNoneZ
22920 pub union CResult_PeeledOnionNoneZPtr {
22921 /// A pointer to the contents in the success state.
22922 /// Reading from this pointer when `result_ok` is not set is undefined.
22923 pub result: *mut crate::lightning::onion_message::messenger::PeeledOnion,
22924 /// Note that this value is always NULL, as there are no contents in the Err variant
22925 pub err: *mut core::ffi::c_void,
22928 /// A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
22929 /// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
22930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22931 pub struct CResult_PeeledOnionNoneZ {
22932 /// The contents of this CResult_PeeledOnionNoneZ, accessible via either
22933 /// `err` or `result` depending on the state of `result_ok`.
22934 pub contents: CResult_PeeledOnionNoneZPtr,
22935 /// Whether this CResult_PeeledOnionNoneZ represents a success state.
22936 pub result_ok: bool,
22939 /// Creates a new CResult_PeeledOnionNoneZ in the success state.
22940 pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ {
22941 CResult_PeeledOnionNoneZ {
22942 contents: CResult_PeeledOnionNoneZPtr {
22943 result: Box::into_raw(Box::new(o)),
22949 /// Creates a new CResult_PeeledOnionNoneZ in the error state.
22950 pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ {
22951 CResult_PeeledOnionNoneZ {
22952 contents: CResult_PeeledOnionNoneZPtr {
22953 err: core::ptr::null_mut(),
22958 /// Checks if the given object is currently in the success state
22960 pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool {
22964 /// Frees any resources used by the CResult_PeeledOnionNoneZ.
22965 pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { }
22966 impl Drop for CResult_PeeledOnionNoneZ {
22967 fn drop(&mut self) {
22968 if self.result_ok {
22969 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22970 let _ = unsafe { Box::from_raw(self.contents.result) };
22976 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>> for CResult_PeeledOnionNoneZ {
22977 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>) -> Self {
22978 let contents = if o.result_ok {
22979 let result = unsafe { o.contents.result };
22980 unsafe { o.contents.result = core::ptr::null_mut() };
22981 CResult_PeeledOnionNoneZPtr { result }
22983 let _ = unsafe { Box::from_raw(o.contents.err) };
22984 o.contents.err = core::ptr::null_mut();
22985 CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() }
22989 result_ok: o.result_ok,
22994 /// The contents of CResult_NoneSendErrorZ
22995 pub union CResult_NoneSendErrorZPtr {
22996 /// Note that this value is always NULL, as there are no contents in the OK variant
22997 pub result: *mut core::ffi::c_void,
22998 /// A pointer to the contents in the error state.
22999 /// Reading from this pointer when `result_ok` is set is undefined.
23000 pub err: *mut crate::lightning::onion_message::messenger::SendError,
23003 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
23004 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
23005 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23006 pub struct CResult_NoneSendErrorZ {
23007 /// The contents of this CResult_NoneSendErrorZ, accessible via either
23008 /// `err` or `result` depending on the state of `result_ok`.
23009 pub contents: CResult_NoneSendErrorZPtr,
23010 /// Whether this CResult_NoneSendErrorZ represents a success state.
23011 pub result_ok: bool,
23014 /// Creates a new CResult_NoneSendErrorZ in the success state.
23015 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
23016 CResult_NoneSendErrorZ {
23017 contents: CResult_NoneSendErrorZPtr {
23018 result: core::ptr::null_mut(),
23024 /// Creates a new CResult_NoneSendErrorZ in the error state.
23025 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
23026 CResult_NoneSendErrorZ {
23027 contents: CResult_NoneSendErrorZPtr {
23028 err: Box::into_raw(Box::new(e)),
23033 /// Checks if the given object is currently in the success state
23035 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
23039 /// Frees any resources used by the CResult_NoneSendErrorZ.
23040 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
23041 impl Drop for CResult_NoneSendErrorZ {
23042 fn drop(&mut self) {
23043 if self.result_ok {
23045 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23046 let _ = unsafe { Box::from_raw(self.contents.err) };
23051 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
23052 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
23053 let contents = if o.result_ok {
23054 let _ = unsafe { Box::from_raw(o.contents.result) };
23055 o.contents.result = core::ptr::null_mut();
23056 CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
23058 let err = unsafe { o.contents.err };
23059 unsafe { o.contents.err = core::ptr::null_mut(); }
23060 CResult_NoneSendErrorZPtr { err }
23064 result_ok: o.result_ok,
23069 /// The contents of CResult_BlindedPathNoneZ
23070 pub union CResult_BlindedPathNoneZPtr {
23071 /// A pointer to the contents in the success state.
23072 /// Reading from this pointer when `result_ok` is not set is undefined.
23073 pub result: *mut crate::lightning::blinded_path::BlindedPath,
23074 /// Note that this value is always NULL, as there are no contents in the Err variant
23075 pub err: *mut core::ffi::c_void,
23078 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
23079 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
23080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23081 pub struct CResult_BlindedPathNoneZ {
23082 /// The contents of this CResult_BlindedPathNoneZ, accessible via either
23083 /// `err` or `result` depending on the state of `result_ok`.
23084 pub contents: CResult_BlindedPathNoneZPtr,
23085 /// Whether this CResult_BlindedPathNoneZ represents a success state.
23086 pub result_ok: bool,
23089 /// Creates a new CResult_BlindedPathNoneZ in the success state.
23090 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
23091 CResult_BlindedPathNoneZ {
23092 contents: CResult_BlindedPathNoneZPtr {
23093 result: Box::into_raw(Box::new(o)),
23099 /// Creates a new CResult_BlindedPathNoneZ in the error state.
23100 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
23101 CResult_BlindedPathNoneZ {
23102 contents: CResult_BlindedPathNoneZPtr {
23103 err: core::ptr::null_mut(),
23108 /// Checks if the given object is currently in the success state
23110 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
23114 /// Frees any resources used by the CResult_BlindedPathNoneZ.
23115 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
23116 impl Drop for CResult_BlindedPathNoneZ {
23117 fn drop(&mut self) {
23118 if self.result_ok {
23119 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23120 let _ = unsafe { Box::from_raw(self.contents.result) };
23126 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
23127 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
23128 let contents = if o.result_ok {
23129 let result = unsafe { o.contents.result };
23130 unsafe { o.contents.result = core::ptr::null_mut() };
23131 CResult_BlindedPathNoneZPtr { result }
23133 let _ = unsafe { Box::from_raw(o.contents.err) };
23134 o.contents.err = core::ptr::null_mut();
23135 CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
23139 result_ok: o.result_ok,
23143 impl Clone for CResult_BlindedPathNoneZ {
23144 fn clone(&self) -> Self {
23145 if self.result_ok {
23146 Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
23147 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
23150 Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
23151 err: core::ptr::null_mut()
23157 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
23158 /// but with all dynamically-allocated buffers duplicated in new buffers.
23159 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
23161 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
23162 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
23163 /// A pointer to the contents in the success state.
23164 /// Reading from this pointer when `result_ok` is not set is undefined.
23165 pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
23166 /// Note that this value is always NULL, as there are no contents in the Err variant
23167 pub err: *mut core::ffi::c_void,
23170 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
23171 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
23172 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23173 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23174 /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
23175 /// `err` or `result` depending on the state of `result_ok`.
23176 pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
23177 /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
23178 pub result_ok: bool,
23181 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
23182 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23183 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23184 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
23185 result: Box::into_raw(Box::new(o)),
23191 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
23192 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23193 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23194 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
23195 err: core::ptr::null_mut(),
23200 /// Checks if the given object is currently in the success state
23202 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
23206 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
23207 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
23208 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23209 fn drop(&mut self) {
23210 if self.result_ok {
23211 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23212 let _ = unsafe { Box::from_raw(self.contents.result) };
23218 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23219 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
23220 let contents = if o.result_ok {
23221 let result = unsafe { o.contents.result };
23222 unsafe { o.contents.result = core::ptr::null_mut() };
23223 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
23225 let _ = unsafe { Box::from_raw(o.contents.err) };
23226 o.contents.err = core::ptr::null_mut();
23227 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
23231 result_ok: o.result_ok,
23235 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
23236 fn clone(&self) -> Self {
23237 if self.result_ok {
23238 Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
23239 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
23242 Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
23243 err: core::ptr::null_mut()
23249 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
23250 /// but with all dynamically-allocated buffers duplicated in new buffers.
23251 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
23253 /// The contents of CResult_BlindedPathDecodeErrorZ
23254 pub union CResult_BlindedPathDecodeErrorZPtr {
23255 /// A pointer to the contents in the success state.
23256 /// Reading from this pointer when `result_ok` is not set is undefined.
23257 pub result: *mut crate::lightning::blinded_path::BlindedPath,
23258 /// A pointer to the contents in the error state.
23259 /// Reading from this pointer when `result_ok` is set is undefined.
23260 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23263 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
23264 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
23265 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23266 pub struct CResult_BlindedPathDecodeErrorZ {
23267 /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
23268 /// `err` or `result` depending on the state of `result_ok`.
23269 pub contents: CResult_BlindedPathDecodeErrorZPtr,
23270 /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
23271 pub result_ok: bool,
23274 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
23275 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
23276 CResult_BlindedPathDecodeErrorZ {
23277 contents: CResult_BlindedPathDecodeErrorZPtr {
23278 result: Box::into_raw(Box::new(o)),
23284 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
23285 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
23286 CResult_BlindedPathDecodeErrorZ {
23287 contents: CResult_BlindedPathDecodeErrorZPtr {
23288 err: Box::into_raw(Box::new(e)),
23293 /// Checks if the given object is currently in the success state
23295 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
23299 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
23300 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
23301 impl Drop for CResult_BlindedPathDecodeErrorZ {
23302 fn drop(&mut self) {
23303 if self.result_ok {
23304 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23305 let _ = unsafe { Box::from_raw(self.contents.result) };
23308 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23309 let _ = unsafe { Box::from_raw(self.contents.err) };
23314 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
23315 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
23316 let contents = if o.result_ok {
23317 let result = unsafe { o.contents.result };
23318 unsafe { o.contents.result = core::ptr::null_mut() };
23319 CResult_BlindedPathDecodeErrorZPtr { result }
23321 let err = unsafe { o.contents.err };
23322 unsafe { o.contents.err = core::ptr::null_mut(); }
23323 CResult_BlindedPathDecodeErrorZPtr { err }
23327 result_ok: o.result_ok,
23331 impl Clone for CResult_BlindedPathDecodeErrorZ {
23332 fn clone(&self) -> Self {
23333 if self.result_ok {
23334 Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
23335 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
23338 Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
23339 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23345 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
23346 /// but with all dynamically-allocated buffers duplicated in new buffers.
23347 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
23349 /// The contents of CResult_BlindedHopDecodeErrorZ
23350 pub union CResult_BlindedHopDecodeErrorZPtr {
23351 /// A pointer to the contents in the success state.
23352 /// Reading from this pointer when `result_ok` is not set is undefined.
23353 pub result: *mut crate::lightning::blinded_path::BlindedHop,
23354 /// A pointer to the contents in the error state.
23355 /// Reading from this pointer when `result_ok` is set is undefined.
23356 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23359 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
23360 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
23361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23362 pub struct CResult_BlindedHopDecodeErrorZ {
23363 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
23364 /// `err` or `result` depending on the state of `result_ok`.
23365 pub contents: CResult_BlindedHopDecodeErrorZPtr,
23366 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
23367 pub result_ok: bool,
23370 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
23371 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
23372 CResult_BlindedHopDecodeErrorZ {
23373 contents: CResult_BlindedHopDecodeErrorZPtr {
23374 result: Box::into_raw(Box::new(o)),
23380 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
23381 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
23382 CResult_BlindedHopDecodeErrorZ {
23383 contents: CResult_BlindedHopDecodeErrorZPtr {
23384 err: Box::into_raw(Box::new(e)),
23389 /// Checks if the given object is currently in the success state
23391 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
23395 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
23396 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
23397 impl Drop for CResult_BlindedHopDecodeErrorZ {
23398 fn drop(&mut self) {
23399 if self.result_ok {
23400 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23401 let _ = unsafe { Box::from_raw(self.contents.result) };
23404 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23405 let _ = unsafe { Box::from_raw(self.contents.err) };
23410 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
23411 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
23412 let contents = if o.result_ok {
23413 let result = unsafe { o.contents.result };
23414 unsafe { o.contents.result = core::ptr::null_mut() };
23415 CResult_BlindedHopDecodeErrorZPtr { result }
23417 let err = unsafe { o.contents.err };
23418 unsafe { o.contents.err = core::ptr::null_mut(); }
23419 CResult_BlindedHopDecodeErrorZPtr { err }
23423 result_ok: o.result_ok,
23427 impl Clone for CResult_BlindedHopDecodeErrorZ {
23428 fn clone(&self) -> Self {
23429 if self.result_ok {
23430 Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
23431 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
23434 Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
23435 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23441 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
23442 /// but with all dynamically-allocated buffers duplicated in new buffers.
23443 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
23445 /// The contents of CResult_InvoiceErrorDecodeErrorZ
23446 pub union CResult_InvoiceErrorDecodeErrorZPtr {
23447 /// A pointer to the contents in the success state.
23448 /// Reading from this pointer when `result_ok` is not set is undefined.
23449 pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
23450 /// A pointer to the contents in the error state.
23451 /// Reading from this pointer when `result_ok` is set is undefined.
23452 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23455 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
23456 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
23457 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23458 pub struct CResult_InvoiceErrorDecodeErrorZ {
23459 /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
23460 /// `err` or `result` depending on the state of `result_ok`.
23461 pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
23462 /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
23463 pub result_ok: bool,
23466 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
23467 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
23468 CResult_InvoiceErrorDecodeErrorZ {
23469 contents: CResult_InvoiceErrorDecodeErrorZPtr {
23470 result: Box::into_raw(Box::new(o)),
23476 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
23477 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
23478 CResult_InvoiceErrorDecodeErrorZ {
23479 contents: CResult_InvoiceErrorDecodeErrorZPtr {
23480 err: Box::into_raw(Box::new(e)),
23485 /// Checks if the given object is currently in the success state
23487 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
23491 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
23492 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
23493 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
23494 fn drop(&mut self) {
23495 if self.result_ok {
23496 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23497 let _ = unsafe { Box::from_raw(self.contents.result) };
23500 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23501 let _ = unsafe { Box::from_raw(self.contents.err) };
23506 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
23507 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
23508 let contents = if o.result_ok {
23509 let result = unsafe { o.contents.result };
23510 unsafe { o.contents.result = core::ptr::null_mut() };
23511 CResult_InvoiceErrorDecodeErrorZPtr { result }
23513 let err = unsafe { o.contents.err };
23514 unsafe { o.contents.err = core::ptr::null_mut(); }
23515 CResult_InvoiceErrorDecodeErrorZPtr { err }
23519 result_ok: o.result_ok,
23523 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
23524 fn clone(&self) -> Self {
23525 if self.result_ok {
23526 Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
23527 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
23530 Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
23531 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23537 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
23538 /// but with all dynamically-allocated buffers duplicated in new buffers.
23539 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
23541 /// An enum which can either contain a crate::lightning::chain::Filter or not
23542 pub enum COption_FilterZ {
23543 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
23544 Some(crate::lightning::chain::Filter),
23545 /// When we're in this state, this COption_FilterZ contains nothing
23548 impl COption_FilterZ {
23549 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23550 if let Self::None = self { false } else { true }
23552 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23555 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
23556 if let Self::Some(v) = self { v } else { unreachable!() }
23560 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
23561 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
23562 COption_FilterZ::Some(o)
23565 /// Constructs a new COption_FilterZ containing nothing
23566 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
23567 COption_FilterZ::None
23570 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
23571 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
23573 /// The contents of CResult_LockedChannelMonitorNoneZ
23574 pub union CResult_LockedChannelMonitorNoneZPtr {
23575 /// A pointer to the contents in the success state.
23576 /// Reading from this pointer when `result_ok` is not set is undefined.
23577 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
23578 /// Note that this value is always NULL, as there are no contents in the Err variant
23579 pub err: *mut core::ffi::c_void,
23582 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
23583 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
23584 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23585 pub struct CResult_LockedChannelMonitorNoneZ {
23586 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
23587 /// `err` or `result` depending on the state of `result_ok`.
23588 pub contents: CResult_LockedChannelMonitorNoneZPtr,
23589 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
23590 pub result_ok: bool,
23593 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
23594 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
23595 CResult_LockedChannelMonitorNoneZ {
23596 contents: CResult_LockedChannelMonitorNoneZPtr {
23597 result: Box::into_raw(Box::new(o)),
23603 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
23604 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
23605 CResult_LockedChannelMonitorNoneZ {
23606 contents: CResult_LockedChannelMonitorNoneZPtr {
23607 err: core::ptr::null_mut(),
23612 /// Checks if the given object is currently in the success state
23614 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
23618 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
23619 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
23620 impl Drop for CResult_LockedChannelMonitorNoneZ {
23621 fn drop(&mut self) {
23622 if self.result_ok {
23623 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23624 let _ = unsafe { Box::from_raw(self.contents.result) };
23630 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
23631 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
23632 let contents = if o.result_ok {
23633 let result = unsafe { o.contents.result };
23634 unsafe { o.contents.result = core::ptr::null_mut() };
23635 CResult_LockedChannelMonitorNoneZPtr { result }
23637 let _ = unsafe { Box::from_raw(o.contents.err) };
23638 o.contents.err = core::ptr::null_mut();
23639 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
23643 result_ok: o.result_ok,
23648 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
23649 /// This corresponds to std::vector in C++
23650 pub struct CVec_OutPointZ {
23651 /// The elements in the array.
23652 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23653 pub data: *mut crate::lightning::chain::transaction::OutPoint,
23654 /// The number of elements pointed to by `data`.
23657 impl CVec_OutPointZ {
23658 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
23659 if self.datalen == 0 { return Vec::new(); }
23660 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23661 self.data = core::ptr::null_mut();
23665 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
23666 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23669 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
23670 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
23671 let datalen = v.len();
23672 let data = Box::into_raw(v.into_boxed_slice());
23673 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23677 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23678 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
23679 impl Drop for CVec_OutPointZ {
23680 fn drop(&mut self) {
23681 if self.datalen == 0 { return; }
23682 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23685 impl Clone for CVec_OutPointZ {
23686 fn clone(&self) -> Self {
23687 let mut res = Vec::new();
23688 if self.datalen == 0 { return Self::from(res); }
23689 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23694 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
23695 /// This corresponds to std::vector in C++
23696 pub struct CVec_MonitorUpdateIdZ {
23697 /// The elements in the array.
23698 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23699 pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
23700 /// The number of elements pointed to by `data`.
23703 impl CVec_MonitorUpdateIdZ {
23704 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
23705 if self.datalen == 0 { return Vec::new(); }
23706 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23707 self.data = core::ptr::null_mut();
23711 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
23712 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23715 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
23716 fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
23717 let datalen = v.len();
23718 let data = Box::into_raw(v.into_boxed_slice());
23719 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23723 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23724 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
23725 impl Drop for CVec_MonitorUpdateIdZ {
23726 fn drop(&mut self) {
23727 if self.datalen == 0 { return; }
23728 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23731 impl Clone for CVec_MonitorUpdateIdZ {
23732 fn clone(&self) -> Self {
23733 let mut res = Vec::new();
23734 if self.datalen == 0 { return Self::from(res); }
23735 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23740 /// A tuple of 2 elements. See the individual fields for the types contained.
23741 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23742 /// The element at position 0
23743 pub a: crate::lightning::chain::transaction::OutPoint,
23744 /// The element at position 1
23745 pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
23747 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23748 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
23755 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23756 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
23760 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23761 fn clone(&self) -> Self {
23763 a: Clone::clone(&self.a),
23764 b: Clone::clone(&self.b),
23769 /// Creates a new tuple which has the same data as `orig`
23770 /// but with all dynamically-allocated buffers duplicated in new buffers.
23771 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
23772 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
23774 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
23775 C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
23779 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
23780 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
23782 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
23783 /// This corresponds to std::vector in C++
23784 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23785 /// The elements in the array.
23786 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23787 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
23788 /// The number of elements pointed to by `data`.
23791 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23792 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
23793 if self.datalen == 0 { return Vec::new(); }
23794 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23795 self.data = core::ptr::null_mut();
23799 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
23800 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23803 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23804 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
23805 let datalen = v.len();
23806 let data = Box::into_raw(v.into_boxed_slice());
23807 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23811 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23812 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
23813 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23814 fn drop(&mut self) {
23815 if self.datalen == 0 { return; }
23816 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23819 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
23820 fn clone(&self) -> Self {
23821 let mut res = Vec::new();
23822 if self.datalen == 0 { return Self::from(res); }
23823 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });