2 use alloc::str::FromStr;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
12 /// An enum which can either contain a u64 or not
13 pub enum COption_DurationZ {
14 /// When we're in this state, this COption_DurationZ contains a u64
16 /// When we're in this state, this COption_DurationZ contains nothing
19 impl COption_DurationZ {
20 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21 if let Self::None = self { false } else { true }
23 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
26 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
27 if let Self::Some(v) = self { v } else { unreachable!() }
31 /// Constructs a new COption_DurationZ containing a u64
32 pub extern "C" fn COption_DurationZ_some(o: u64) -> COption_DurationZ {
33 COption_DurationZ::Some(o)
36 /// Constructs a new COption_DurationZ containing nothing
37 pub extern "C" fn COption_DurationZ_none() -> COption_DurationZ {
38 COption_DurationZ::None
41 /// Frees any resources associated with the u64, if we are in the Some state
42 pub extern "C" fn COption_DurationZ_free(_res: COption_DurationZ) { }
44 /// Creates a new COption_DurationZ which has the same data as `orig`
45 /// but with all dynamically-allocated buffers duplicated in new buffers.
46 pub extern "C" fn COption_DurationZ_clone(orig: &COption_DurationZ) -> COption_DurationZ { Clone::clone(&orig) }
48 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
49 /// This corresponds to std::vector in C++
50 pub struct CVec_BlindedPathZ {
51 /// The elements in the array.
52 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
53 pub data: *mut crate::lightning::blinded_path::BlindedPath,
54 /// The number of elements pointed to by `data`.
57 impl CVec_BlindedPathZ {
58 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedPath> {
59 if self.datalen == 0 { return Vec::new(); }
60 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
61 self.data = core::ptr::null_mut();
65 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedPath] {
66 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
69 impl From<Vec<crate::lightning::blinded_path::BlindedPath>> for CVec_BlindedPathZ {
70 fn from(v: Vec<crate::lightning::blinded_path::BlindedPath>) -> Self {
71 let datalen = v.len();
72 let data = Box::into_raw(v.into_boxed_slice());
73 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
77 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
78 pub extern "C" fn CVec_BlindedPathZ_free(_res: CVec_BlindedPathZ) { }
79 impl Drop for CVec_BlindedPathZ {
81 if self.datalen == 0 { return; }
82 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
85 impl Clone for CVec_BlindedPathZ {
86 fn clone(&self) -> Self {
87 let mut res = Vec::new();
88 if self.datalen == 0 { return Self::from(res); }
89 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
95 /// An enum which can either contain a u64 or not
96 pub enum COption_u64Z {
97 /// When we're in this state, this COption_u64Z contains a u64
99 /// When we're in this state, this COption_u64Z contains nothing
103 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
104 if let Self::None = self { false } else { true }
106 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
109 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
110 if let Self::Some(v) = self { v } else { unreachable!() }
114 /// Constructs a new COption_u64Z containing a u64
115 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
116 COption_u64Z::Some(o)
119 /// Constructs a new COption_u64Z containing nothing
120 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
124 /// Frees any resources associated with the u64, if we are in the Some state
125 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
127 /// Creates a new COption_u64Z which has the same data as `orig`
128 /// but with all dynamically-allocated buffers duplicated in new buffers.
129 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
131 /// The contents of CResult_RefundBolt12ParseErrorZ
132 pub union CResult_RefundBolt12ParseErrorZPtr {
133 /// A pointer to the contents in the success state.
134 /// Reading from this pointer when `result_ok` is not set is undefined.
135 pub result: *mut crate::lightning::offers::refund::Refund,
136 /// A pointer to the contents in the error state.
137 /// Reading from this pointer when `result_ok` is set is undefined.
138 pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
141 /// A CResult_RefundBolt12ParseErrorZ represents the result of a fallible operation,
142 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
144 pub struct CResult_RefundBolt12ParseErrorZ {
145 /// The contents of this CResult_RefundBolt12ParseErrorZ, accessible via either
146 /// `err` or `result` depending on the state of `result_ok`.
147 pub contents: CResult_RefundBolt12ParseErrorZPtr,
148 /// Whether this CResult_RefundBolt12ParseErrorZ represents a success state.
152 /// Creates a new CResult_RefundBolt12ParseErrorZ in the success state.
153 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12ParseErrorZ {
154 CResult_RefundBolt12ParseErrorZ {
155 contents: CResult_RefundBolt12ParseErrorZPtr {
156 result: Box::into_raw(Box::new(o)),
162 /// Creates a new CResult_RefundBolt12ParseErrorZ in the error state.
163 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_RefundBolt12ParseErrorZ {
164 CResult_RefundBolt12ParseErrorZ {
165 contents: CResult_RefundBolt12ParseErrorZPtr {
166 err: Box::into_raw(Box::new(e)),
171 /// Checks if the given object is currently in the success state
173 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_is_ok(o: &CResult_RefundBolt12ParseErrorZ) -> bool {
177 /// Frees any resources used by the CResult_RefundBolt12ParseErrorZ.
178 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_free(_res: CResult_RefundBolt12ParseErrorZ) { }
179 impl Drop for CResult_RefundBolt12ParseErrorZ {
182 if unsafe { !(self.contents.result as *mut ()).is_null() } {
183 let _ = unsafe { Box::from_raw(self.contents.result) };
186 if unsafe { !(self.contents.err as *mut ()).is_null() } {
187 let _ = unsafe { Box::from_raw(self.contents.err) };
192 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_RefundBolt12ParseErrorZ {
193 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
194 let contents = if o.result_ok {
195 let result = unsafe { o.contents.result };
196 unsafe { o.contents.result = core::ptr::null_mut() };
197 CResult_RefundBolt12ParseErrorZPtr { result }
199 let err = unsafe { o.contents.err };
200 unsafe { o.contents.err = core::ptr::null_mut(); }
201 CResult_RefundBolt12ParseErrorZPtr { err }
205 result_ok: o.result_ok,
209 impl Clone for CResult_RefundBolt12ParseErrorZ {
210 fn clone(&self) -> Self {
212 Self { result_ok: true, contents: CResult_RefundBolt12ParseErrorZPtr {
213 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
216 Self { result_ok: false, contents: CResult_RefundBolt12ParseErrorZPtr {
217 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
223 /// Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig`
224 /// but with all dynamically-allocated buffers duplicated in new buffers.
225 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_clone(orig: &CResult_RefundBolt12ParseErrorZ) -> CResult_RefundBolt12ParseErrorZ { Clone::clone(&orig) }
227 /// The contents of CResult_NoneAPIErrorZ
228 pub union CResult_NoneAPIErrorZPtr {
229 /// Note that this value is always NULL, as there are no contents in the OK variant
230 pub result: *mut core::ffi::c_void,
231 /// A pointer to the contents in the error state.
232 /// Reading from this pointer when `result_ok` is set is undefined.
233 pub err: *mut crate::lightning::util::errors::APIError,
236 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
237 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
239 pub struct CResult_NoneAPIErrorZ {
240 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
241 /// `err` or `result` depending on the state of `result_ok`.
242 pub contents: CResult_NoneAPIErrorZPtr,
243 /// Whether this CResult_NoneAPIErrorZ represents a success state.
247 /// Creates a new CResult_NoneAPIErrorZ in the success state.
248 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
249 CResult_NoneAPIErrorZ {
250 contents: CResult_NoneAPIErrorZPtr {
251 result: core::ptr::null_mut(),
257 /// Creates a new CResult_NoneAPIErrorZ in the error state.
258 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
259 CResult_NoneAPIErrorZ {
260 contents: CResult_NoneAPIErrorZPtr {
261 err: Box::into_raw(Box::new(e)),
266 /// Checks if the given object is currently in the success state
268 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
272 /// Frees any resources used by the CResult_NoneAPIErrorZ.
273 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
274 impl Drop for CResult_NoneAPIErrorZ {
278 if unsafe { !(self.contents.err as *mut ()).is_null() } {
279 let _ = unsafe { Box::from_raw(self.contents.err) };
284 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
285 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
286 let contents = if o.result_ok {
287 let _ = unsafe { Box::from_raw(o.contents.result) };
288 o.contents.result = core::ptr::null_mut();
289 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
291 let err = unsafe { o.contents.err };
292 unsafe { o.contents.err = core::ptr::null_mut(); }
293 CResult_NoneAPIErrorZPtr { err }
297 result_ok: o.result_ok,
301 impl Clone for CResult_NoneAPIErrorZ {
302 fn clone(&self) -> Self {
304 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
305 result: core::ptr::null_mut()
308 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
309 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
315 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
316 /// but with all dynamically-allocated buffers duplicated in new buffers.
317 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
319 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
320 /// This corresponds to std::vector in C++
321 pub struct CVec_CResult_NoneAPIErrorZZ {
322 /// The elements in the array.
323 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
324 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
325 /// The number of elements pointed to by `data`.
328 impl CVec_CResult_NoneAPIErrorZZ {
329 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
330 if self.datalen == 0 { return Vec::new(); }
331 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
332 self.data = core::ptr::null_mut();
336 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
337 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
340 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
341 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
342 let datalen = v.len();
343 let data = Box::into_raw(v.into_boxed_slice());
344 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
348 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
349 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
350 impl Drop for CVec_CResult_NoneAPIErrorZZ {
352 if self.datalen == 0 { return; }
353 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
356 impl Clone for CVec_CResult_NoneAPIErrorZZ {
357 fn clone(&self) -> Self {
358 let mut res = Vec::new();
359 if self.datalen == 0 { return Self::from(res); }
360 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
365 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
366 /// This corresponds to std::vector in C++
367 pub struct CVec_APIErrorZ {
368 /// The elements in the array.
369 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
370 pub data: *mut crate::lightning::util::errors::APIError,
371 /// The number of elements pointed to by `data`.
374 impl CVec_APIErrorZ {
375 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
376 if self.datalen == 0 { return Vec::new(); }
377 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
378 self.data = core::ptr::null_mut();
382 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
383 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
386 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
387 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
388 let datalen = v.len();
389 let data = Box::into_raw(v.into_boxed_slice());
390 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
394 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
395 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
396 impl Drop for CVec_APIErrorZ {
398 if self.datalen == 0 { return; }
399 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
402 impl Clone for CVec_APIErrorZ {
403 fn clone(&self) -> Self {
404 let mut res = Vec::new();
405 if self.datalen == 0 { return Self::from(res); }
406 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
412 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
413 pub enum COption_PaymentSecretZ {
414 /// When we're in this state, this COption_PaymentSecretZ contains a crate::c_types::ThirtyTwoBytes
415 Some(crate::c_types::ThirtyTwoBytes),
416 /// When we're in this state, this COption_PaymentSecretZ contains nothing
419 impl COption_PaymentSecretZ {
420 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
421 if let Self::None = self { false } else { true }
423 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
426 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
427 if let Self::Some(v) = self { v } else { unreachable!() }
431 /// Constructs a new COption_PaymentSecretZ containing a crate::c_types::ThirtyTwoBytes
432 pub extern "C" fn COption_PaymentSecretZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentSecretZ {
433 COption_PaymentSecretZ::Some(o)
436 /// Constructs a new COption_PaymentSecretZ containing nothing
437 pub extern "C" fn COption_PaymentSecretZ_none() -> COption_PaymentSecretZ {
438 COption_PaymentSecretZ::None
441 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
442 pub extern "C" fn COption_PaymentSecretZ_free(_res: COption_PaymentSecretZ) { }
444 /// Creates a new COption_PaymentSecretZ which has the same data as `orig`
445 /// but with all dynamically-allocated buffers duplicated in new buffers.
446 pub extern "C" fn COption_PaymentSecretZ_clone(orig: &COption_PaymentSecretZ) -> COption_PaymentSecretZ { Clone::clone(&orig) }
448 /// A dynamically-allocated array of u8s of arbitrary size.
449 /// This corresponds to std::vector in C++
450 pub struct CVec_u8Z {
451 /// The elements in the array.
452 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
454 /// The number of elements pointed to by `data`.
458 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
459 if self.datalen == 0 { return Vec::new(); }
460 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
461 self.data = core::ptr::null_mut();
465 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
466 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
469 impl From<Vec<u8>> for CVec_u8Z {
470 fn from(v: Vec<u8>) -> Self {
471 let datalen = v.len();
472 let data = Box::into_raw(v.into_boxed_slice());
473 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
478 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
479 impl Drop for CVec_u8Z {
481 if self.datalen == 0 { return; }
482 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
485 impl Clone for CVec_u8Z {
486 fn clone(&self) -> Self {
487 let mut res = Vec::new();
488 if self.datalen == 0 { return Self::from(res); }
489 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
495 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
496 pub enum COption_CVec_u8ZZ {
497 /// When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
498 Some(crate::c_types::derived::CVec_u8Z),
499 /// When we're in this state, this COption_CVec_u8ZZ contains nothing
502 impl COption_CVec_u8ZZ {
503 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
504 if let Self::None = self { false } else { true }
506 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
509 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
510 if let Self::Some(v) = self { v } else { unreachable!() }
514 /// Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
515 pub extern "C" fn COption_CVec_u8ZZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_CVec_u8ZZ {
516 COption_CVec_u8ZZ::Some(o)
519 /// Constructs a new COption_CVec_u8ZZ containing nothing
520 pub extern "C" fn COption_CVec_u8ZZ_none() -> COption_CVec_u8ZZ {
521 COption_CVec_u8ZZ::None
524 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
525 pub extern "C" fn COption_CVec_u8ZZ_free(_res: COption_CVec_u8ZZ) { }
527 /// Creates a new COption_CVec_u8ZZ which has the same data as `orig`
528 /// but with all dynamically-allocated buffers duplicated in new buffers.
529 pub extern "C" fn COption_CVec_u8ZZ_clone(orig: &COption_CVec_u8ZZ) -> COption_CVec_u8ZZ { Clone::clone(&orig) }
531 /// The contents of CResult_RecipientOnionFieldsDecodeErrorZ
532 pub union CResult_RecipientOnionFieldsDecodeErrorZPtr {
533 /// A pointer to the contents in the success state.
534 /// Reading from this pointer when `result_ok` is not set is undefined.
535 pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
536 /// A pointer to the contents in the error state.
537 /// Reading from this pointer when `result_ok` is set is undefined.
538 pub err: *mut crate::lightning::ln::msgs::DecodeError,
541 /// A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
542 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
544 pub struct CResult_RecipientOnionFieldsDecodeErrorZ {
545 /// The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
546 /// `err` or `result` depending on the state of `result_ok`.
547 pub contents: CResult_RecipientOnionFieldsDecodeErrorZPtr,
548 /// Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
552 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
553 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsDecodeErrorZ {
554 CResult_RecipientOnionFieldsDecodeErrorZ {
555 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
556 result: Box::into_raw(Box::new(o)),
562 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
563 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RecipientOnionFieldsDecodeErrorZ {
564 CResult_RecipientOnionFieldsDecodeErrorZ {
565 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
566 err: Box::into_raw(Box::new(e)),
571 /// Checks if the given object is currently in the success state
573 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o: &CResult_RecipientOnionFieldsDecodeErrorZ) -> bool {
577 /// Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
578 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_free(_res: CResult_RecipientOnionFieldsDecodeErrorZ) { }
579 impl Drop for CResult_RecipientOnionFieldsDecodeErrorZ {
582 if unsafe { !(self.contents.result as *mut ()).is_null() } {
583 let _ = unsafe { Box::from_raw(self.contents.result) };
586 if unsafe { !(self.contents.err as *mut ()).is_null() } {
587 let _ = unsafe { Box::from_raw(self.contents.err) };
592 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>> for CResult_RecipientOnionFieldsDecodeErrorZ {
593 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
594 let contents = if o.result_ok {
595 let result = unsafe { o.contents.result };
596 unsafe { o.contents.result = core::ptr::null_mut() };
597 CResult_RecipientOnionFieldsDecodeErrorZPtr { result }
599 let err = unsafe { o.contents.err };
600 unsafe { o.contents.err = core::ptr::null_mut(); }
601 CResult_RecipientOnionFieldsDecodeErrorZPtr { err }
605 result_ok: o.result_ok,
609 impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ {
610 fn clone(&self) -> Self {
612 Self { result_ok: true, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
613 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
616 Self { result_ok: false, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
617 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
623 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
624 /// but with all dynamically-allocated buffers duplicated in new buffers.
625 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) }
627 /// The contents of CResult_BlindedPayInfoDecodeErrorZ
628 pub union CResult_BlindedPayInfoDecodeErrorZPtr {
629 /// A pointer to the contents in the success state.
630 /// Reading from this pointer when `result_ok` is not set is undefined.
631 pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo,
632 /// A pointer to the contents in the error state.
633 /// Reading from this pointer when `result_ok` is set is undefined.
634 pub err: *mut crate::lightning::ln::msgs::DecodeError,
637 /// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
638 /// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
640 pub struct CResult_BlindedPayInfoDecodeErrorZ {
641 /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
642 /// `err` or `result` depending on the state of `result_ok`.
643 pub contents: CResult_BlindedPayInfoDecodeErrorZPtr,
644 /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
648 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
649 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ {
650 CResult_BlindedPayInfoDecodeErrorZ {
651 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
652 result: Box::into_raw(Box::new(o)),
658 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
659 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ {
660 CResult_BlindedPayInfoDecodeErrorZ {
661 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
662 err: Box::into_raw(Box::new(e)),
667 /// Checks if the given object is currently in the success state
669 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool {
673 /// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
674 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { }
675 impl Drop for CResult_BlindedPayInfoDecodeErrorZ {
678 if unsafe { !(self.contents.result as *mut ()).is_null() } {
679 let _ = unsafe { Box::from_raw(self.contents.result) };
682 if unsafe { !(self.contents.err as *mut ()).is_null() } {
683 let _ = unsafe { Box::from_raw(self.contents.err) };
688 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPayInfoDecodeErrorZ {
689 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
690 let contents = if o.result_ok {
691 let result = unsafe { o.contents.result };
692 unsafe { o.contents.result = core::ptr::null_mut() };
693 CResult_BlindedPayInfoDecodeErrorZPtr { result }
695 let err = unsafe { o.contents.err };
696 unsafe { o.contents.err = core::ptr::null_mut(); }
697 CResult_BlindedPayInfoDecodeErrorZPtr { err }
701 result_ok: o.result_ok,
705 impl Clone for CResult_BlindedPayInfoDecodeErrorZ {
706 fn clone(&self) -> Self {
708 Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
709 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::BlindedPayInfo>::clone(unsafe { &*self.contents.result })))
712 Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
713 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
719 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
720 /// but with all dynamically-allocated buffers duplicated in new buffers.
721 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) }
723 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
724 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
725 /// A pointer to the contents in the success state.
726 /// Reading from this pointer when `result_ok` is not set is undefined.
727 pub result: *mut crate::lightning::sign::DelayedPaymentOutputDescriptor,
728 /// A pointer to the contents in the error state.
729 /// Reading from this pointer when `result_ok` is set is undefined.
730 pub err: *mut crate::lightning::ln::msgs::DecodeError,
733 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
734 /// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
736 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
737 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
738 /// `err` or `result` depending on the state of `result_ok`.
739 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
740 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
744 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
745 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
746 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
747 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
748 result: Box::into_raw(Box::new(o)),
754 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
755 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
756 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
757 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
758 err: Box::into_raw(Box::new(e)),
763 /// Checks if the given object is currently in the success state
765 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
769 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
770 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
771 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
774 if unsafe { !(self.contents.result as *mut ()).is_null() } {
775 let _ = unsafe { Box::from_raw(self.contents.result) };
778 if unsafe { !(self.contents.err as *mut ()).is_null() } {
779 let _ = unsafe { Box::from_raw(self.contents.err) };
784 impl From<crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
785 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
786 let contents = if o.result_ok {
787 let result = unsafe { o.contents.result };
788 unsafe { o.contents.result = core::ptr::null_mut() };
789 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
791 let err = unsafe { o.contents.err };
792 unsafe { o.contents.err = core::ptr::null_mut(); }
793 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
797 result_ok: o.result_ok,
801 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
802 fn clone(&self) -> Self {
804 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
805 result: Box::into_raw(Box::new(<crate::lightning::sign::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
808 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
809 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
815 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
816 /// but with all dynamically-allocated buffers duplicated in new buffers.
817 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
819 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
820 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
821 /// A pointer to the contents in the success state.
822 /// Reading from this pointer when `result_ok` is not set is undefined.
823 pub result: *mut crate::lightning::sign::StaticPaymentOutputDescriptor,
824 /// A pointer to the contents in the error state.
825 /// Reading from this pointer when `result_ok` is set is undefined.
826 pub err: *mut crate::lightning::ln::msgs::DecodeError,
829 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
830 /// containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
832 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
833 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
834 /// `err` or `result` depending on the state of `result_ok`.
835 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
836 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
840 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
841 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
842 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
843 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
844 result: Box::into_raw(Box::new(o)),
850 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
851 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
852 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
853 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
854 err: Box::into_raw(Box::new(e)),
859 /// Checks if the given object is currently in the success state
861 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
865 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
866 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
867 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
870 if unsafe { !(self.contents.result as *mut ()).is_null() } {
871 let _ = unsafe { Box::from_raw(self.contents.result) };
874 if unsafe { !(self.contents.err as *mut ()).is_null() } {
875 let _ = unsafe { Box::from_raw(self.contents.err) };
880 impl From<crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
881 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
882 let contents = if o.result_ok {
883 let result = unsafe { o.contents.result };
884 unsafe { o.contents.result = core::ptr::null_mut() };
885 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
887 let err = unsafe { o.contents.err };
888 unsafe { o.contents.err = core::ptr::null_mut(); }
889 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
893 result_ok: o.result_ok,
897 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
898 fn clone(&self) -> Self {
900 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
901 result: Box::into_raw(Box::new(<crate::lightning::sign::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
904 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
905 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
911 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
912 /// but with all dynamically-allocated buffers duplicated in new buffers.
913 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
915 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
916 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
917 /// A pointer to the contents in the success state.
918 /// Reading from this pointer when `result_ok` is not set is undefined.
919 pub result: *mut crate::lightning::sign::SpendableOutputDescriptor,
920 /// A pointer to the contents in the error state.
921 /// Reading from this pointer when `result_ok` is set is undefined.
922 pub err: *mut crate::lightning::ln::msgs::DecodeError,
925 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
926 /// containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
928 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
929 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
930 /// `err` or `result` depending on the state of `result_ok`.
931 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
932 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
936 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
937 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
938 CResult_SpendableOutputDescriptorDecodeErrorZ {
939 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
940 result: Box::into_raw(Box::new(o)),
946 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
947 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
948 CResult_SpendableOutputDescriptorDecodeErrorZ {
949 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
950 err: Box::into_raw(Box::new(e)),
955 /// Checks if the given object is currently in the success state
957 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
961 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
962 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
963 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
966 if unsafe { !(self.contents.result as *mut ()).is_null() } {
967 let _ = unsafe { Box::from_raw(self.contents.result) };
970 if unsafe { !(self.contents.err as *mut ()).is_null() } {
971 let _ = unsafe { Box::from_raw(self.contents.err) };
976 impl From<crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
977 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
978 let contents = if o.result_ok {
979 let result = unsafe { o.contents.result };
980 unsafe { o.contents.result = core::ptr::null_mut() };
981 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
983 let err = unsafe { o.contents.err };
984 unsafe { o.contents.err = core::ptr::null_mut(); }
985 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
989 result_ok: o.result_ok,
993 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
994 fn clone(&self) -> Self {
996 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
997 result: Box::into_raw(Box::new(<crate::lightning::sign::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1000 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1001 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1007 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
1008 /// but with all dynamically-allocated buffers duplicated in new buffers.
1009 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1011 /// A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size.
1012 /// This corresponds to std::vector in C++
1013 pub struct CVec_SpendableOutputDescriptorZ {
1014 /// The elements in the array.
1015 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1016 pub data: *mut crate::lightning::sign::SpendableOutputDescriptor,
1017 /// The number of elements pointed to by `data`.
1020 impl CVec_SpendableOutputDescriptorZ {
1021 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::SpendableOutputDescriptor> {
1022 if self.datalen == 0 { return Vec::new(); }
1023 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1024 self.data = core::ptr::null_mut();
1028 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::SpendableOutputDescriptor] {
1029 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1032 impl From<Vec<crate::lightning::sign::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
1033 fn from(v: Vec<crate::lightning::sign::SpendableOutputDescriptor>) -> Self {
1034 let datalen = v.len();
1035 let data = Box::into_raw(v.into_boxed_slice());
1036 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1040 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1041 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
1042 impl Drop for CVec_SpendableOutputDescriptorZ {
1043 fn drop(&mut self) {
1044 if self.datalen == 0 { return; }
1045 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1048 impl Clone for CVec_SpendableOutputDescriptorZ {
1049 fn clone(&self) -> Self {
1050 let mut res = Vec::new();
1051 if self.datalen == 0 { return Self::from(res); }
1052 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1057 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
1058 /// This corresponds to std::vector in C++
1059 pub struct CVec_TxOutZ {
1060 /// The elements in the array.
1061 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1062 pub data: *mut crate::c_types::TxOut,
1063 /// The number of elements pointed to by `data`.
1067 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
1068 if self.datalen == 0 { return Vec::new(); }
1069 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1070 self.data = core::ptr::null_mut();
1074 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
1075 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1078 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
1079 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
1080 let datalen = v.len();
1081 let data = Box::into_raw(v.into_boxed_slice());
1082 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1086 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1087 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
1088 impl Drop for CVec_TxOutZ {
1089 fn drop(&mut self) {
1090 if self.datalen == 0 { return; }
1091 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1094 impl Clone for CVec_TxOutZ {
1095 fn clone(&self) -> Self {
1096 let mut res = Vec::new();
1097 if self.datalen == 0 { return Self::from(res); }
1098 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1104 /// An enum which can either contain a u32 or not
1105 pub enum COption_PackedLockTimeZ {
1106 /// When we're in this state, this COption_PackedLockTimeZ contains a u32
1108 /// When we're in this state, this COption_PackedLockTimeZ contains nothing
1111 impl COption_PackedLockTimeZ {
1112 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1113 if let Self::None = self { false } else { true }
1115 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1118 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
1119 if let Self::Some(v) = self { v } else { unreachable!() }
1123 /// Constructs a new COption_PackedLockTimeZ containing a u32
1124 pub extern "C" fn COption_PackedLockTimeZ_some(o: u32) -> COption_PackedLockTimeZ {
1125 COption_PackedLockTimeZ::Some(o)
1128 /// Constructs a new COption_PackedLockTimeZ containing nothing
1129 pub extern "C" fn COption_PackedLockTimeZ_none() -> COption_PackedLockTimeZ {
1130 COption_PackedLockTimeZ::None
1133 /// Frees any resources associated with the u32, if we are in the Some state
1134 pub extern "C" fn COption_PackedLockTimeZ_free(_res: COption_PackedLockTimeZ) { }
1136 /// Creates a new COption_PackedLockTimeZ which has the same data as `orig`
1137 /// but with all dynamically-allocated buffers duplicated in new buffers.
1138 pub extern "C" fn COption_PackedLockTimeZ_clone(orig: &COption_PackedLockTimeZ) -> COption_PackedLockTimeZ { Clone::clone(&orig) }
1140 /// A tuple of 2 elements. See the individual fields for the types contained.
1141 pub struct C2Tuple_PartiallySignedTransactionusizeZ {
1142 /// The element at position 0
1143 pub a: crate::c_types::derived::CVec_u8Z,
1144 /// The element at position 1
1147 impl From<(crate::c_types::derived::CVec_u8Z, usize)> for C2Tuple_PartiallySignedTransactionusizeZ {
1148 fn from (tup: (crate::c_types::derived::CVec_u8Z, usize)) -> Self {
1155 impl C2Tuple_PartiallySignedTransactionusizeZ {
1156 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, usize) {
1160 impl Clone for C2Tuple_PartiallySignedTransactionusizeZ {
1161 fn clone(&self) -> Self {
1163 a: Clone::clone(&self.a),
1164 b: Clone::clone(&self.b),
1169 /// Creates a new tuple which has the same data as `orig`
1170 /// but with all dynamically-allocated buffers duplicated in new buffers.
1171 pub extern "C" fn C2Tuple_PartiallySignedTransactionusizeZ_clone(orig: &C2Tuple_PartiallySignedTransactionusizeZ) -> C2Tuple_PartiallySignedTransactionusizeZ { Clone::clone(&orig) }
1172 /// Creates a new C2Tuple_PartiallySignedTransactionusizeZ from the contained elements.
1174 pub extern "C" fn C2Tuple_PartiallySignedTransactionusizeZ_new(a: crate::c_types::derived::CVec_u8Z, b: usize) -> C2Tuple_PartiallySignedTransactionusizeZ {
1175 C2Tuple_PartiallySignedTransactionusizeZ { a, b, }
1179 /// Frees any resources used by the C2Tuple_PartiallySignedTransactionusizeZ.
1180 pub extern "C" fn C2Tuple_PartiallySignedTransactionusizeZ_free(_res: C2Tuple_PartiallySignedTransactionusizeZ) { }
1182 /// The contents of CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ
1183 pub union CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr {
1184 /// A pointer to the contents in the success state.
1185 /// Reading from this pointer when `result_ok` is not set is undefined.
1186 pub result: *mut crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ,
1187 /// Note that this value is always NULL, as there are no contents in the Err variant
1188 pub err: *mut core::ffi::c_void,
1191 /// A CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents the result of a fallible operation,
1192 /// containing a crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ on success and a () on failure.
1193 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1194 pub struct CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1195 /// The contents of this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ, accessible via either
1196 /// `err` or `result` depending on the state of `result_ok`.
1197 pub contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr,
1198 /// Whether this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents a success state.
1199 pub result_ok: bool,
1202 /// Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the success state.
1203 pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ) -> CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1204 CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1205 contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr {
1206 result: Box::into_raw(Box::new(o)),
1212 /// Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the error state.
1213 pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err() -> CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1214 CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1215 contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr {
1216 err: core::ptr::null_mut(),
1221 /// Checks if the given object is currently in the success state
1223 pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(o: &CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ) -> bool {
1227 /// Frees any resources used by the CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ.
1228 pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(_res: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ) { }
1229 impl Drop for CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1230 fn drop(&mut self) {
1232 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1233 let _ = unsafe { Box::from_raw(self.contents.result) };
1239 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ, ()>> for CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1240 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ, ()>) -> Self {
1241 let contents = if o.result_ok {
1242 let result = unsafe { o.contents.result };
1243 unsafe { o.contents.result = core::ptr::null_mut() };
1244 CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { result }
1246 let _ = unsafe { Box::from_raw(o.contents.err) };
1247 o.contents.err = core::ptr::null_mut();
1248 CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { err: core::ptr::null_mut() }
1252 result_ok: o.result_ok,
1256 impl Clone for CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1257 fn clone(&self) -> Self {
1259 Self { result_ok: true, contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr {
1260 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ>::clone(unsafe { &*self.contents.result })))
1263 Self { result_ok: false, contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr {
1264 err: core::ptr::null_mut()
1270 /// Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ which has the same data as `orig`
1271 /// but with all dynamically-allocated buffers duplicated in new buffers.
1272 pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(orig: &CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ) -> CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { Clone::clone(&orig) }
1274 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1275 /// This corresponds to std::vector in C++
1276 pub struct CVec_PaymentPreimageZ {
1277 /// The elements in the array.
1278 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1279 pub data: *mut crate::c_types::ThirtyTwoBytes,
1280 /// The number of elements pointed to by `data`.
1283 impl CVec_PaymentPreimageZ {
1284 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
1285 if self.datalen == 0 { return Vec::new(); }
1286 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1287 self.data = core::ptr::null_mut();
1291 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
1292 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1295 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
1296 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
1297 let datalen = v.len();
1298 let data = Box::into_raw(v.into_boxed_slice());
1299 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1303 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1304 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
1305 impl Drop for CVec_PaymentPreimageZ {
1306 fn drop(&mut self) {
1307 if self.datalen == 0 { return; }
1308 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1311 impl Clone for CVec_PaymentPreimageZ {
1312 fn clone(&self) -> Self {
1313 let mut res = Vec::new();
1314 if self.datalen == 0 { return Self::from(res); }
1315 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1320 /// The contents of CResult_NoneNoneZ
1321 pub union CResult_NoneNoneZPtr {
1322 /// Note that this value is always NULL, as there are no contents in the OK variant
1323 pub result: *mut core::ffi::c_void,
1324 /// Note that this value is always NULL, as there are no contents in the Err variant
1325 pub err: *mut core::ffi::c_void,
1328 /// A CResult_NoneNoneZ represents the result of a fallible operation,
1329 /// containing a () on success and a () on failure.
1330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1331 pub struct CResult_NoneNoneZ {
1332 /// The contents of this CResult_NoneNoneZ, accessible via either
1333 /// `err` or `result` depending on the state of `result_ok`.
1334 pub contents: CResult_NoneNoneZPtr,
1335 /// Whether this CResult_NoneNoneZ represents a success state.
1336 pub result_ok: bool,
1339 /// Creates a new CResult_NoneNoneZ in the success state.
1340 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
1342 contents: CResult_NoneNoneZPtr {
1343 result: core::ptr::null_mut(),
1349 /// Creates a new CResult_NoneNoneZ in the error state.
1350 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
1352 contents: CResult_NoneNoneZPtr {
1353 err: core::ptr::null_mut(),
1358 /// Checks if the given object is currently in the success state
1360 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
1364 /// Frees any resources used by the CResult_NoneNoneZ.
1365 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
1366 impl Drop for CResult_NoneNoneZ {
1367 fn drop(&mut self) {
1373 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
1374 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
1375 let contents = if o.result_ok {
1376 let _ = unsafe { Box::from_raw(o.contents.result) };
1377 o.contents.result = core::ptr::null_mut();
1378 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
1380 let _ = unsafe { Box::from_raw(o.contents.err) };
1381 o.contents.err = core::ptr::null_mut();
1382 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
1386 result_ok: o.result_ok,
1390 impl Clone for CResult_NoneNoneZ {
1391 fn clone(&self) -> Self {
1393 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
1394 result: core::ptr::null_mut()
1397 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
1398 err: core::ptr::null_mut()
1404 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
1405 /// but with all dynamically-allocated buffers duplicated in new buffers.
1406 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
1408 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1409 /// This corresponds to std::vector in C++
1410 pub struct CVec_SignatureZ {
1411 /// The elements in the array.
1412 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1413 pub data: *mut crate::c_types::Signature,
1414 /// The number of elements pointed to by `data`.
1417 impl CVec_SignatureZ {
1418 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1419 if self.datalen == 0 { return Vec::new(); }
1420 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1421 self.data = core::ptr::null_mut();
1425 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1426 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1429 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1430 fn from(v: Vec<crate::c_types::Signature>) -> Self {
1431 let datalen = v.len();
1432 let data = Box::into_raw(v.into_boxed_slice());
1433 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1437 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1438 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1439 impl Drop for CVec_SignatureZ {
1440 fn drop(&mut self) {
1441 if self.datalen == 0 { return; }
1442 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1445 impl Clone for CVec_SignatureZ {
1446 fn clone(&self) -> Self {
1447 let mut res = Vec::new();
1448 if self.datalen == 0 { return Self::from(res); }
1449 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1454 /// A tuple of 2 elements. See the individual fields for the types contained.
1455 pub struct C2Tuple_SignatureCVec_SignatureZZ {
1456 /// The element at position 0
1457 pub a: crate::c_types::Signature,
1458 /// The element at position 1
1459 pub b: crate::c_types::derived::CVec_SignatureZ,
1461 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
1462 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
1469 impl C2Tuple_SignatureCVec_SignatureZZ {
1470 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
1474 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
1475 fn clone(&self) -> Self {
1477 a: Clone::clone(&self.a),
1478 b: Clone::clone(&self.b),
1483 /// Creates a new tuple which has the same data as `orig`
1484 /// but with all dynamically-allocated buffers duplicated in new buffers.
1485 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
1486 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
1488 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
1489 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
1493 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
1494 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
1496 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
1497 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1498 /// A pointer to the contents in the success state.
1499 /// Reading from this pointer when `result_ok` is not set is undefined.
1500 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
1501 /// Note that this value is always NULL, as there are no contents in the Err variant
1502 pub err: *mut core::ffi::c_void,
1505 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
1506 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
1507 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1508 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1509 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
1510 /// `err` or `result` depending on the state of `result_ok`.
1511 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
1512 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
1513 pub result_ok: bool,
1516 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
1517 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1518 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1519 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1520 result: Box::into_raw(Box::new(o)),
1526 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
1527 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1528 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1529 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1530 err: core::ptr::null_mut(),
1535 /// Checks if the given object is currently in the success state
1537 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
1541 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
1542 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
1543 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1544 fn drop(&mut self) {
1546 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1547 let _ = unsafe { Box::from_raw(self.contents.result) };
1553 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1554 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
1555 let contents = if o.result_ok {
1556 let result = unsafe { o.contents.result };
1557 unsafe { o.contents.result = core::ptr::null_mut() };
1558 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
1560 let _ = unsafe { Box::from_raw(o.contents.err) };
1561 o.contents.err = core::ptr::null_mut();
1562 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
1566 result_ok: o.result_ok,
1570 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1571 fn clone(&self) -> Self {
1573 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1574 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
1577 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1578 err: core::ptr::null_mut()
1584 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
1585 /// but with all dynamically-allocated buffers duplicated in new buffers.
1586 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
1588 /// The contents of CResult_SignatureNoneZ
1589 pub union CResult_SignatureNoneZPtr {
1590 /// A pointer to the contents in the success state.
1591 /// Reading from this pointer when `result_ok` is not set is undefined.
1592 pub result: *mut crate::c_types::Signature,
1593 /// Note that this value is always NULL, as there are no contents in the Err variant
1594 pub err: *mut core::ffi::c_void,
1597 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
1598 /// containing a crate::c_types::Signature on success and a () on failure.
1599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1600 pub struct CResult_SignatureNoneZ {
1601 /// The contents of this CResult_SignatureNoneZ, accessible via either
1602 /// `err` or `result` depending on the state of `result_ok`.
1603 pub contents: CResult_SignatureNoneZPtr,
1604 /// Whether this CResult_SignatureNoneZ represents a success state.
1605 pub result_ok: bool,
1608 /// Creates a new CResult_SignatureNoneZ in the success state.
1609 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
1610 CResult_SignatureNoneZ {
1611 contents: CResult_SignatureNoneZPtr {
1612 result: Box::into_raw(Box::new(o)),
1618 /// Creates a new CResult_SignatureNoneZ in the error state.
1619 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
1620 CResult_SignatureNoneZ {
1621 contents: CResult_SignatureNoneZPtr {
1622 err: core::ptr::null_mut(),
1627 /// Checks if the given object is currently in the success state
1629 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
1633 /// Frees any resources used by the CResult_SignatureNoneZ.
1634 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
1635 impl Drop for CResult_SignatureNoneZ {
1636 fn drop(&mut self) {
1638 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1639 let _ = unsafe { Box::from_raw(self.contents.result) };
1645 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
1646 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
1647 let contents = if o.result_ok {
1648 let result = unsafe { o.contents.result };
1649 unsafe { o.contents.result = core::ptr::null_mut() };
1650 CResult_SignatureNoneZPtr { result }
1652 let _ = unsafe { Box::from_raw(o.contents.err) };
1653 o.contents.err = core::ptr::null_mut();
1654 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
1658 result_ok: o.result_ok,
1662 impl Clone for CResult_SignatureNoneZ {
1663 fn clone(&self) -> Self {
1665 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
1666 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
1669 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
1670 err: core::ptr::null_mut()
1676 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
1677 /// but with all dynamically-allocated buffers duplicated in new buffers.
1678 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
1680 /// The contents of CResult_PublicKeyNoneZ
1681 pub union CResult_PublicKeyNoneZPtr {
1682 /// A pointer to the contents in the success state.
1683 /// Reading from this pointer when `result_ok` is not set is undefined.
1684 pub result: *mut crate::c_types::PublicKey,
1685 /// Note that this value is always NULL, as there are no contents in the Err variant
1686 pub err: *mut core::ffi::c_void,
1689 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
1690 /// containing a crate::c_types::PublicKey on success and a () on failure.
1691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1692 pub struct CResult_PublicKeyNoneZ {
1693 /// The contents of this CResult_PublicKeyNoneZ, accessible via either
1694 /// `err` or `result` depending on the state of `result_ok`.
1695 pub contents: CResult_PublicKeyNoneZPtr,
1696 /// Whether this CResult_PublicKeyNoneZ represents a success state.
1697 pub result_ok: bool,
1700 /// Creates a new CResult_PublicKeyNoneZ in the success state.
1701 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
1702 CResult_PublicKeyNoneZ {
1703 contents: CResult_PublicKeyNoneZPtr {
1704 result: Box::into_raw(Box::new(o)),
1710 /// Creates a new CResult_PublicKeyNoneZ in the error state.
1711 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
1712 CResult_PublicKeyNoneZ {
1713 contents: CResult_PublicKeyNoneZPtr {
1714 err: core::ptr::null_mut(),
1719 /// Checks if the given object is currently in the success state
1721 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
1725 /// Frees any resources used by the CResult_PublicKeyNoneZ.
1726 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
1727 impl Drop for CResult_PublicKeyNoneZ {
1728 fn drop(&mut self) {
1730 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1731 let _ = unsafe { Box::from_raw(self.contents.result) };
1737 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
1738 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
1739 let contents = if o.result_ok {
1740 let result = unsafe { o.contents.result };
1741 unsafe { o.contents.result = core::ptr::null_mut() };
1742 CResult_PublicKeyNoneZPtr { result }
1744 let _ = unsafe { Box::from_raw(o.contents.err) };
1745 o.contents.err = core::ptr::null_mut();
1746 CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
1750 result_ok: o.result_ok,
1754 impl Clone for CResult_PublicKeyNoneZ {
1755 fn clone(&self) -> Self {
1757 Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
1758 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
1761 Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
1762 err: core::ptr::null_mut()
1768 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
1769 /// but with all dynamically-allocated buffers duplicated in new buffers.
1770 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
1773 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
1774 pub enum COption_ScalarZ {
1775 /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
1776 Some(crate::c_types::BigEndianScalar),
1777 /// When we're in this state, this COption_ScalarZ contains nothing
1780 impl COption_ScalarZ {
1781 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1782 if let Self::None = self { false } else { true }
1784 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1787 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
1788 if let Self::Some(v) = self { v } else { unreachable!() }
1792 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
1793 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
1794 COption_ScalarZ::Some(o)
1797 /// Constructs a new COption_ScalarZ containing nothing
1798 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
1799 COption_ScalarZ::None
1802 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
1803 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
1805 /// Creates a new COption_ScalarZ which has the same data as `orig`
1806 /// but with all dynamically-allocated buffers duplicated in new buffers.
1807 pub extern "C" fn COption_ScalarZ_clone(orig: &COption_ScalarZ) -> COption_ScalarZ { Clone::clone(&orig) }
1809 /// The contents of CResult_SharedSecretNoneZ
1810 pub union CResult_SharedSecretNoneZPtr {
1811 /// A pointer to the contents in the success state.
1812 /// Reading from this pointer when `result_ok` is not set is undefined.
1813 pub result: *mut crate::c_types::ThirtyTwoBytes,
1814 /// Note that this value is always NULL, as there are no contents in the Err variant
1815 pub err: *mut core::ffi::c_void,
1818 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
1819 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
1820 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1821 pub struct CResult_SharedSecretNoneZ {
1822 /// The contents of this CResult_SharedSecretNoneZ, accessible via either
1823 /// `err` or `result` depending on the state of `result_ok`.
1824 pub contents: CResult_SharedSecretNoneZPtr,
1825 /// Whether this CResult_SharedSecretNoneZ represents a success state.
1826 pub result_ok: bool,
1829 /// Creates a new CResult_SharedSecretNoneZ in the success state.
1830 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
1831 CResult_SharedSecretNoneZ {
1832 contents: CResult_SharedSecretNoneZPtr {
1833 result: Box::into_raw(Box::new(o)),
1839 /// Creates a new CResult_SharedSecretNoneZ in the error state.
1840 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
1841 CResult_SharedSecretNoneZ {
1842 contents: CResult_SharedSecretNoneZPtr {
1843 err: core::ptr::null_mut(),
1848 /// Checks if the given object is currently in the success state
1850 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
1854 /// Frees any resources used by the CResult_SharedSecretNoneZ.
1855 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
1856 impl Drop for CResult_SharedSecretNoneZ {
1857 fn drop(&mut self) {
1859 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1860 let _ = unsafe { Box::from_raw(self.contents.result) };
1866 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
1867 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
1868 let contents = if o.result_ok {
1869 let result = unsafe { o.contents.result };
1870 unsafe { o.contents.result = core::ptr::null_mut() };
1871 CResult_SharedSecretNoneZPtr { result }
1873 let _ = unsafe { Box::from_raw(o.contents.err) };
1874 o.contents.err = core::ptr::null_mut();
1875 CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
1879 result_ok: o.result_ok,
1883 impl Clone for CResult_SharedSecretNoneZ {
1884 fn clone(&self) -> Self {
1886 Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
1887 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
1890 Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
1891 err: core::ptr::null_mut()
1897 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
1898 /// but with all dynamically-allocated buffers duplicated in new buffers.
1899 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
1901 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
1902 /// This corresponds to std::vector in C++
1903 pub struct CVec_U5Z {
1904 /// The elements in the array.
1905 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1906 pub data: *mut crate::c_types::U5,
1907 /// The number of elements pointed to by `data`.
1911 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
1912 if self.datalen == 0 { return Vec::new(); }
1913 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1914 self.data = core::ptr::null_mut();
1918 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
1919 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1922 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
1923 fn from(v: Vec<crate::c_types::U5>) -> Self {
1924 let datalen = v.len();
1925 let data = Box::into_raw(v.into_boxed_slice());
1926 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1930 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1931 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
1932 impl Drop for CVec_U5Z {
1933 fn drop(&mut self) {
1934 if self.datalen == 0 { return; }
1935 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1938 impl Clone for CVec_U5Z {
1939 fn clone(&self) -> Self {
1940 let mut res = Vec::new();
1941 if self.datalen == 0 { return Self::from(res); }
1942 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1947 /// The contents of CResult_RecoverableSignatureNoneZ
1948 pub union CResult_RecoverableSignatureNoneZPtr {
1949 /// A pointer to the contents in the success state.
1950 /// Reading from this pointer when `result_ok` is not set is undefined.
1951 pub result: *mut crate::c_types::RecoverableSignature,
1952 /// Note that this value is always NULL, as there are no contents in the Err variant
1953 pub err: *mut core::ffi::c_void,
1956 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
1957 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
1958 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1959 pub struct CResult_RecoverableSignatureNoneZ {
1960 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
1961 /// `err` or `result` depending on the state of `result_ok`.
1962 pub contents: CResult_RecoverableSignatureNoneZPtr,
1963 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
1964 pub result_ok: bool,
1967 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
1968 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
1969 CResult_RecoverableSignatureNoneZ {
1970 contents: CResult_RecoverableSignatureNoneZPtr {
1971 result: Box::into_raw(Box::new(o)),
1977 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
1978 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
1979 CResult_RecoverableSignatureNoneZ {
1980 contents: CResult_RecoverableSignatureNoneZPtr {
1981 err: core::ptr::null_mut(),
1986 /// Checks if the given object is currently in the success state
1988 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
1992 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
1993 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
1994 impl Drop for CResult_RecoverableSignatureNoneZ {
1995 fn drop(&mut self) {
1997 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1998 let _ = unsafe { Box::from_raw(self.contents.result) };
2004 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2005 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2006 let contents = if o.result_ok {
2007 let result = unsafe { o.contents.result };
2008 unsafe { o.contents.result = core::ptr::null_mut() };
2009 CResult_RecoverableSignatureNoneZPtr { result }
2011 let _ = unsafe { Box::from_raw(o.contents.err) };
2012 o.contents.err = core::ptr::null_mut();
2013 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2017 result_ok: o.result_ok,
2021 impl Clone for CResult_RecoverableSignatureNoneZ {
2022 fn clone(&self) -> Self {
2024 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2025 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2028 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2029 err: core::ptr::null_mut()
2035 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2036 /// but with all dynamically-allocated buffers duplicated in new buffers.
2037 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2039 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2040 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2041 /// A pointer to the contents in the success state.
2042 /// Reading from this pointer when `result_ok` is not set is undefined.
2043 pub result: *mut crate::lightning::sign::WriteableEcdsaChannelSigner,
2044 /// A pointer to the contents in the error state.
2045 /// Reading from this pointer when `result_ok` is set is undefined.
2046 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2049 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2050 /// containing a crate::lightning::sign::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2052 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2053 /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2054 /// `err` or `result` depending on the state of `result_ok`.
2055 pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2056 /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2057 pub result_ok: bool,
2060 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2061 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2062 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2063 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2064 result: Box::into_raw(Box::new(o)),
2070 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
2071 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2072 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2073 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2074 err: Box::into_raw(Box::new(e)),
2079 /// Checks if the given object is currently in the success state
2081 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
2085 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
2086 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
2087 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2088 fn drop(&mut self) {
2090 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2091 let _ = unsafe { Box::from_raw(self.contents.result) };
2094 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2095 let _ = unsafe { Box::from_raw(self.contents.err) };
2100 impl From<crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2101 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2102 let contents = if o.result_ok {
2103 let result = unsafe { o.contents.result };
2104 unsafe { o.contents.result = core::ptr::null_mut() };
2105 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
2107 let err = unsafe { o.contents.err };
2108 unsafe { o.contents.err = core::ptr::null_mut(); }
2109 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
2113 result_ok: o.result_ok,
2118 /// The contents of CResult_ScriptNoneZ
2119 pub union CResult_ScriptNoneZPtr {
2120 /// A pointer to the contents in the success state.
2121 /// Reading from this pointer when `result_ok` is not set is undefined.
2122 pub result: *mut crate::c_types::derived::CVec_u8Z,
2123 /// Note that this value is always NULL, as there are no contents in the Err variant
2124 pub err: *mut core::ffi::c_void,
2127 /// A CResult_ScriptNoneZ represents the result of a fallible operation,
2128 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2129 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2130 pub struct CResult_ScriptNoneZ {
2131 /// The contents of this CResult_ScriptNoneZ, accessible via either
2132 /// `err` or `result` depending on the state of `result_ok`.
2133 pub contents: CResult_ScriptNoneZPtr,
2134 /// Whether this CResult_ScriptNoneZ represents a success state.
2135 pub result_ok: bool,
2138 /// Creates a new CResult_ScriptNoneZ in the success state.
2139 pub extern "C" fn CResult_ScriptNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_ScriptNoneZ {
2140 CResult_ScriptNoneZ {
2141 contents: CResult_ScriptNoneZPtr {
2142 result: Box::into_raw(Box::new(o)),
2148 /// Creates a new CResult_ScriptNoneZ in the error state.
2149 pub extern "C" fn CResult_ScriptNoneZ_err() -> CResult_ScriptNoneZ {
2150 CResult_ScriptNoneZ {
2151 contents: CResult_ScriptNoneZPtr {
2152 err: core::ptr::null_mut(),
2157 /// Checks if the given object is currently in the success state
2159 pub extern "C" fn CResult_ScriptNoneZ_is_ok(o: &CResult_ScriptNoneZ) -> bool {
2163 /// Frees any resources used by the CResult_ScriptNoneZ.
2164 pub extern "C" fn CResult_ScriptNoneZ_free(_res: CResult_ScriptNoneZ) { }
2165 impl Drop for CResult_ScriptNoneZ {
2166 fn drop(&mut self) {
2168 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2169 let _ = unsafe { Box::from_raw(self.contents.result) };
2175 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_ScriptNoneZ {
2176 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
2177 let contents = if o.result_ok {
2178 let result = unsafe { o.contents.result };
2179 unsafe { o.contents.result = core::ptr::null_mut() };
2180 CResult_ScriptNoneZPtr { result }
2182 let _ = unsafe { Box::from_raw(o.contents.err) };
2183 o.contents.err = core::ptr::null_mut();
2184 CResult_ScriptNoneZPtr { err: core::ptr::null_mut() }
2188 result_ok: o.result_ok,
2192 impl Clone for CResult_ScriptNoneZ {
2193 fn clone(&self) -> Self {
2195 Self { result_ok: true, contents: CResult_ScriptNoneZPtr {
2196 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
2199 Self { result_ok: false, contents: CResult_ScriptNoneZPtr {
2200 err: core::ptr::null_mut()
2206 /// Creates a new CResult_ScriptNoneZ which has the same data as `orig`
2207 /// but with all dynamically-allocated buffers duplicated in new buffers.
2208 pub extern "C" fn CResult_ScriptNoneZ_clone(orig: &CResult_ScriptNoneZ) -> CResult_ScriptNoneZ { Clone::clone(&orig) }
2210 /// The contents of CResult_ShutdownScriptNoneZ
2211 pub union CResult_ShutdownScriptNoneZPtr {
2212 /// A pointer to the contents in the success state.
2213 /// Reading from this pointer when `result_ok` is not set is undefined.
2214 pub result: *mut crate::lightning::ln::script::ShutdownScript,
2215 /// Note that this value is always NULL, as there are no contents in the Err variant
2216 pub err: *mut core::ffi::c_void,
2219 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
2220 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
2221 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2222 pub struct CResult_ShutdownScriptNoneZ {
2223 /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
2224 /// `err` or `result` depending on the state of `result_ok`.
2225 pub contents: CResult_ShutdownScriptNoneZPtr,
2226 /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
2227 pub result_ok: bool,
2230 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
2231 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
2232 CResult_ShutdownScriptNoneZ {
2233 contents: CResult_ShutdownScriptNoneZPtr {
2234 result: Box::into_raw(Box::new(o)),
2240 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
2241 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
2242 CResult_ShutdownScriptNoneZ {
2243 contents: CResult_ShutdownScriptNoneZPtr {
2244 err: core::ptr::null_mut(),
2249 /// Checks if the given object is currently in the success state
2251 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
2255 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
2256 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
2257 impl Drop for CResult_ShutdownScriptNoneZ {
2258 fn drop(&mut self) {
2260 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2261 let _ = unsafe { Box::from_raw(self.contents.result) };
2267 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
2268 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
2269 let contents = if o.result_ok {
2270 let result = unsafe { o.contents.result };
2271 unsafe { o.contents.result = core::ptr::null_mut() };
2272 CResult_ShutdownScriptNoneZPtr { result }
2274 let _ = unsafe { Box::from_raw(o.contents.err) };
2275 o.contents.err = core::ptr::null_mut();
2276 CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
2280 result_ok: o.result_ok,
2284 impl Clone for CResult_ShutdownScriptNoneZ {
2285 fn clone(&self) -> Self {
2287 Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
2288 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2291 Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
2292 err: core::ptr::null_mut()
2298 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
2299 /// but with all dynamically-allocated buffers duplicated in new buffers.
2300 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
2302 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
2303 /// This corresponds to std::vector in C++
2304 pub struct CVec_CVec_u8ZZ {
2305 /// The elements in the array.
2306 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2307 pub data: *mut crate::c_types::derived::CVec_u8Z,
2308 /// The number of elements pointed to by `data`.
2311 impl CVec_CVec_u8ZZ {
2312 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
2313 if self.datalen == 0 { return Vec::new(); }
2314 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2315 self.data = core::ptr::null_mut();
2319 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
2320 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2323 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
2324 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
2325 let datalen = v.len();
2326 let data = Box::into_raw(v.into_boxed_slice());
2327 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2331 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2332 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
2333 impl Drop for CVec_CVec_u8ZZ {
2334 fn drop(&mut self) {
2335 if self.datalen == 0 { return; }
2336 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2339 impl Clone for CVec_CVec_u8ZZ {
2340 fn clone(&self) -> Self {
2341 let mut res = Vec::new();
2342 if self.datalen == 0 { return Self::from(res); }
2343 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2348 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
2349 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
2350 /// A pointer to the contents in the success state.
2351 /// Reading from this pointer when `result_ok` is not set is undefined.
2352 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
2353 /// Note that this value is always NULL, as there are no contents in the Err variant
2354 pub err: *mut core::ffi::c_void,
2357 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
2358 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
2359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2360 pub struct CResult_CVec_CVec_u8ZZNoneZ {
2361 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
2362 /// `err` or `result` depending on the state of `result_ok`.
2363 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
2364 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
2365 pub result_ok: bool,
2368 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
2369 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
2370 CResult_CVec_CVec_u8ZZNoneZ {
2371 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2372 result: Box::into_raw(Box::new(o)),
2378 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
2379 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
2380 CResult_CVec_CVec_u8ZZNoneZ {
2381 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2382 err: core::ptr::null_mut(),
2387 /// Checks if the given object is currently in the success state
2389 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
2393 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
2394 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
2395 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
2396 fn drop(&mut self) {
2398 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2399 let _ = unsafe { Box::from_raw(self.contents.result) };
2405 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
2406 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
2407 let contents = if o.result_ok {
2408 let result = unsafe { o.contents.result };
2409 unsafe { o.contents.result = core::ptr::null_mut() };
2410 CResult_CVec_CVec_u8ZZNoneZPtr { result }
2412 let _ = unsafe { Box::from_raw(o.contents.err) };
2413 o.contents.err = core::ptr::null_mut();
2414 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
2418 result_ok: o.result_ok,
2422 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
2423 fn clone(&self) -> Self {
2425 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2426 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
2429 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
2430 err: core::ptr::null_mut()
2436 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
2437 /// but with all dynamically-allocated buffers duplicated in new buffers.
2438 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
2440 /// The contents of CResult_InMemorySignerDecodeErrorZ
2441 pub union CResult_InMemorySignerDecodeErrorZPtr {
2442 /// A pointer to the contents in the success state.
2443 /// Reading from this pointer when `result_ok` is not set is undefined.
2444 pub result: *mut crate::lightning::sign::InMemorySigner,
2445 /// A pointer to the contents in the error state.
2446 /// Reading from this pointer when `result_ok` is set is undefined.
2447 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2450 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
2451 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2452 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2453 pub struct CResult_InMemorySignerDecodeErrorZ {
2454 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
2455 /// `err` or `result` depending on the state of `result_ok`.
2456 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
2457 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
2458 pub result_ok: bool,
2461 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
2462 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
2463 CResult_InMemorySignerDecodeErrorZ {
2464 contents: CResult_InMemorySignerDecodeErrorZPtr {
2465 result: Box::into_raw(Box::new(o)),
2471 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
2472 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
2473 CResult_InMemorySignerDecodeErrorZ {
2474 contents: CResult_InMemorySignerDecodeErrorZPtr {
2475 err: Box::into_raw(Box::new(e)),
2480 /// Checks if the given object is currently in the success state
2482 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
2486 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
2487 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
2488 impl Drop for CResult_InMemorySignerDecodeErrorZ {
2489 fn drop(&mut self) {
2491 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2492 let _ = unsafe { Box::from_raw(self.contents.result) };
2495 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2496 let _ = unsafe { Box::from_raw(self.contents.err) };
2501 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
2502 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2503 let contents = if o.result_ok {
2504 let result = unsafe { o.contents.result };
2505 unsafe { o.contents.result = core::ptr::null_mut() };
2506 CResult_InMemorySignerDecodeErrorZPtr { result }
2508 let err = unsafe { o.contents.err };
2509 unsafe { o.contents.err = core::ptr::null_mut(); }
2510 CResult_InMemorySignerDecodeErrorZPtr { err }
2514 result_ok: o.result_ok,
2518 impl Clone for CResult_InMemorySignerDecodeErrorZ {
2519 fn clone(&self) -> Self {
2521 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
2522 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
2525 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
2526 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2532 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
2533 /// but with all dynamically-allocated buffers duplicated in new buffers.
2534 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
2536 /// The contents of CResult_PartiallySignedTransactionNoneZ
2537 pub union CResult_PartiallySignedTransactionNoneZPtr {
2538 /// A pointer to the contents in the success state.
2539 /// Reading from this pointer when `result_ok` is not set is undefined.
2540 pub result: *mut crate::c_types::derived::CVec_u8Z,
2541 /// Note that this value is always NULL, as there are no contents in the Err variant
2542 pub err: *mut core::ffi::c_void,
2545 /// A CResult_PartiallySignedTransactionNoneZ represents the result of a fallible operation,
2546 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2548 pub struct CResult_PartiallySignedTransactionNoneZ {
2549 /// The contents of this CResult_PartiallySignedTransactionNoneZ, accessible via either
2550 /// `err` or `result` depending on the state of `result_ok`.
2551 pub contents: CResult_PartiallySignedTransactionNoneZPtr,
2552 /// Whether this CResult_PartiallySignedTransactionNoneZ represents a success state.
2553 pub result_ok: bool,
2556 /// Creates a new CResult_PartiallySignedTransactionNoneZ in the success state.
2557 pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_PartiallySignedTransactionNoneZ {
2558 CResult_PartiallySignedTransactionNoneZ {
2559 contents: CResult_PartiallySignedTransactionNoneZPtr {
2560 result: Box::into_raw(Box::new(o)),
2566 /// Creates a new CResult_PartiallySignedTransactionNoneZ in the error state.
2567 pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_err() -> CResult_PartiallySignedTransactionNoneZ {
2568 CResult_PartiallySignedTransactionNoneZ {
2569 contents: CResult_PartiallySignedTransactionNoneZPtr {
2570 err: core::ptr::null_mut(),
2575 /// Checks if the given object is currently in the success state
2577 pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_is_ok(o: &CResult_PartiallySignedTransactionNoneZ) -> bool {
2581 /// Frees any resources used by the CResult_PartiallySignedTransactionNoneZ.
2582 pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_free(_res: CResult_PartiallySignedTransactionNoneZ) { }
2583 impl Drop for CResult_PartiallySignedTransactionNoneZ {
2584 fn drop(&mut self) {
2586 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2587 let _ = unsafe { Box::from_raw(self.contents.result) };
2593 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_PartiallySignedTransactionNoneZ {
2594 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
2595 let contents = if o.result_ok {
2596 let result = unsafe { o.contents.result };
2597 unsafe { o.contents.result = core::ptr::null_mut() };
2598 CResult_PartiallySignedTransactionNoneZPtr { result }
2600 let _ = unsafe { Box::from_raw(o.contents.err) };
2601 o.contents.err = core::ptr::null_mut();
2602 CResult_PartiallySignedTransactionNoneZPtr { err: core::ptr::null_mut() }
2606 result_ok: o.result_ok,
2610 impl Clone for CResult_PartiallySignedTransactionNoneZ {
2611 fn clone(&self) -> Self {
2613 Self { result_ok: true, contents: CResult_PartiallySignedTransactionNoneZPtr {
2614 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
2617 Self { result_ok: false, contents: CResult_PartiallySignedTransactionNoneZPtr {
2618 err: core::ptr::null_mut()
2624 /// Creates a new CResult_PartiallySignedTransactionNoneZ which has the same data as `orig`
2625 /// but with all dynamically-allocated buffers duplicated in new buffers.
2626 pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_clone(orig: &CResult_PartiallySignedTransactionNoneZ) -> CResult_PartiallySignedTransactionNoneZ { Clone::clone(&orig) }
2628 /// The contents of CResult_TransactionNoneZ
2629 pub union CResult_TransactionNoneZPtr {
2630 /// A pointer to the contents in the success state.
2631 /// Reading from this pointer when `result_ok` is not set is undefined.
2632 pub result: *mut crate::c_types::Transaction,
2633 /// Note that this value is always NULL, as there are no contents in the Err variant
2634 pub err: *mut core::ffi::c_void,
2637 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
2638 /// containing a crate::c_types::Transaction on success and a () on failure.
2639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2640 pub struct CResult_TransactionNoneZ {
2641 /// The contents of this CResult_TransactionNoneZ, accessible via either
2642 /// `err` or `result` depending on the state of `result_ok`.
2643 pub contents: CResult_TransactionNoneZPtr,
2644 /// Whether this CResult_TransactionNoneZ represents a success state.
2645 pub result_ok: bool,
2648 /// Creates a new CResult_TransactionNoneZ in the success state.
2649 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
2650 CResult_TransactionNoneZ {
2651 contents: CResult_TransactionNoneZPtr {
2652 result: Box::into_raw(Box::new(o)),
2658 /// Creates a new CResult_TransactionNoneZ in the error state.
2659 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
2660 CResult_TransactionNoneZ {
2661 contents: CResult_TransactionNoneZPtr {
2662 err: core::ptr::null_mut(),
2667 /// Checks if the given object is currently in the success state
2669 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
2673 /// Frees any resources used by the CResult_TransactionNoneZ.
2674 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
2675 impl Drop for CResult_TransactionNoneZ {
2676 fn drop(&mut self) {
2678 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2679 let _ = unsafe { Box::from_raw(self.contents.result) };
2685 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
2686 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
2687 let contents = if o.result_ok {
2688 let result = unsafe { o.contents.result };
2689 unsafe { o.contents.result = core::ptr::null_mut() };
2690 CResult_TransactionNoneZPtr { result }
2692 let _ = unsafe { Box::from_raw(o.contents.err) };
2693 o.contents.err = core::ptr::null_mut();
2694 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
2698 result_ok: o.result_ok,
2702 impl Clone for CResult_TransactionNoneZ {
2703 fn clone(&self) -> Self {
2705 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
2706 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
2709 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
2710 err: core::ptr::null_mut()
2716 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
2717 /// but with all dynamically-allocated buffers duplicated in new buffers.
2718 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
2720 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
2721 pub enum COption_WriteableScoreZ {
2722 /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
2723 Some(crate::lightning::routing::scoring::WriteableScore),
2724 /// When we're in this state, this COption_WriteableScoreZ contains nothing
2727 impl COption_WriteableScoreZ {
2728 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2729 if let Self::None = self { false } else { true }
2731 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2734 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
2735 if let Self::Some(v) = self { v } else { unreachable!() }
2739 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
2740 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
2741 COption_WriteableScoreZ::Some(o)
2744 /// Constructs a new COption_WriteableScoreZ containing nothing
2745 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
2746 COption_WriteableScoreZ::None
2749 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
2750 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
2752 /// The contents of CResult_NoneErrorZ
2753 pub union CResult_NoneErrorZPtr {
2754 /// Note that this value is always NULL, as there are no contents in the OK variant
2755 pub result: *mut core::ffi::c_void,
2756 /// A pointer to the contents in the error state.
2757 /// Reading from this pointer when `result_ok` is set is undefined.
2758 pub err: *mut crate::c_types::IOError,
2761 /// A CResult_NoneErrorZ represents the result of a fallible operation,
2762 /// containing a () on success and a crate::c_types::IOError on failure.
2763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2764 pub struct CResult_NoneErrorZ {
2765 /// The contents of this CResult_NoneErrorZ, accessible via either
2766 /// `err` or `result` depending on the state of `result_ok`.
2767 pub contents: CResult_NoneErrorZPtr,
2768 /// Whether this CResult_NoneErrorZ represents a success state.
2769 pub result_ok: bool,
2772 /// Creates a new CResult_NoneErrorZ in the success state.
2773 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
2774 CResult_NoneErrorZ {
2775 contents: CResult_NoneErrorZPtr {
2776 result: core::ptr::null_mut(),
2782 /// Creates a new CResult_NoneErrorZ in the error state.
2783 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
2784 CResult_NoneErrorZ {
2785 contents: CResult_NoneErrorZPtr {
2786 err: Box::into_raw(Box::new(e)),
2791 /// Checks if the given object is currently in the success state
2793 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
2797 /// Frees any resources used by the CResult_NoneErrorZ.
2798 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
2799 impl Drop for CResult_NoneErrorZ {
2800 fn drop(&mut self) {
2803 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2804 let _ = unsafe { Box::from_raw(self.contents.err) };
2809 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
2810 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
2811 let contents = if o.result_ok {
2812 let _ = unsafe { Box::from_raw(o.contents.result) };
2813 o.contents.result = core::ptr::null_mut();
2814 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
2816 let err = unsafe { o.contents.err };
2817 unsafe { o.contents.err = core::ptr::null_mut(); }
2818 CResult_NoneErrorZPtr { err }
2822 result_ok: o.result_ok,
2826 impl Clone for CResult_NoneErrorZ {
2827 fn clone(&self) -> Self {
2829 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
2830 result: core::ptr::null_mut()
2833 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
2834 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
2840 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
2841 /// but with all dynamically-allocated buffers duplicated in new buffers.
2842 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
2844 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2845 /// This corresponds to std::vector in C++
2846 pub struct CVec_ChannelDetailsZ {
2847 /// The elements in the array.
2848 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2849 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2850 /// The number of elements pointed to by `data`.
2853 impl CVec_ChannelDetailsZ {
2854 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2855 if self.datalen == 0 { return Vec::new(); }
2856 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2857 self.data = core::ptr::null_mut();
2861 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2862 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2865 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2866 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2867 let datalen = v.len();
2868 let data = Box::into_raw(v.into_boxed_slice());
2869 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2873 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2874 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2875 impl Drop for CVec_ChannelDetailsZ {
2876 fn drop(&mut self) {
2877 if self.datalen == 0 { return; }
2878 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2881 impl Clone for CVec_ChannelDetailsZ {
2882 fn clone(&self) -> Self {
2883 let mut res = Vec::new();
2884 if self.datalen == 0 { return Self::from(res); }
2885 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2890 /// The contents of CResult_RouteLightningErrorZ
2891 pub union CResult_RouteLightningErrorZPtr {
2892 /// A pointer to the contents in the success state.
2893 /// Reading from this pointer when `result_ok` is not set is undefined.
2894 pub result: *mut crate::lightning::routing::router::Route,
2895 /// A pointer to the contents in the error state.
2896 /// Reading from this pointer when `result_ok` is set is undefined.
2897 pub err: *mut crate::lightning::ln::msgs::LightningError,
2900 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2901 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2903 pub struct CResult_RouteLightningErrorZ {
2904 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2905 /// `err` or `result` depending on the state of `result_ok`.
2906 pub contents: CResult_RouteLightningErrorZPtr,
2907 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2908 pub result_ok: bool,
2911 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2912 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2913 CResult_RouteLightningErrorZ {
2914 contents: CResult_RouteLightningErrorZPtr {
2915 result: Box::into_raw(Box::new(o)),
2921 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2922 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2923 CResult_RouteLightningErrorZ {
2924 contents: CResult_RouteLightningErrorZPtr {
2925 err: Box::into_raw(Box::new(e)),
2930 /// Checks if the given object is currently in the success state
2932 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2936 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2937 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2938 impl Drop for CResult_RouteLightningErrorZ {
2939 fn drop(&mut self) {
2941 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2942 let _ = unsafe { Box::from_raw(self.contents.result) };
2945 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2946 let _ = unsafe { Box::from_raw(self.contents.err) };
2951 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2952 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2953 let contents = if o.result_ok {
2954 let result = unsafe { o.contents.result };
2955 unsafe { o.contents.result = core::ptr::null_mut() };
2956 CResult_RouteLightningErrorZPtr { result }
2958 let err = unsafe { o.contents.err };
2959 unsafe { o.contents.err = core::ptr::null_mut(); }
2960 CResult_RouteLightningErrorZPtr { err }
2964 result_ok: o.result_ok,
2968 impl Clone for CResult_RouteLightningErrorZ {
2969 fn clone(&self) -> Self {
2971 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2972 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2975 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2976 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2982 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2983 /// but with all dynamically-allocated buffers duplicated in new buffers.
2984 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2986 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
2987 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
2988 /// A pointer to the contents in the success state.
2989 /// Reading from this pointer when `result_ok` is not set is undefined.
2990 pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
2991 /// A pointer to the contents in the error state.
2992 /// Reading from this pointer when `result_ok` is set is undefined.
2993 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2996 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2997 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2999 pub struct CResult_InFlightHtlcsDecodeErrorZ {
3000 /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
3001 /// `err` or `result` depending on the state of `result_ok`.
3002 pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
3003 /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
3004 pub result_ok: bool,
3007 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
3008 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
3009 CResult_InFlightHtlcsDecodeErrorZ {
3010 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3011 result: Box::into_raw(Box::new(o)),
3017 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
3018 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
3019 CResult_InFlightHtlcsDecodeErrorZ {
3020 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3021 err: Box::into_raw(Box::new(e)),
3026 /// Checks if the given object is currently in the success state
3028 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
3032 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
3033 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
3034 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
3035 fn drop(&mut self) {
3037 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3038 let _ = unsafe { Box::from_raw(self.contents.result) };
3041 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3042 let _ = unsafe { Box::from_raw(self.contents.err) };
3047 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
3048 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
3049 let contents = if o.result_ok {
3050 let result = unsafe { o.contents.result };
3051 unsafe { o.contents.result = core::ptr::null_mut() };
3052 CResult_InFlightHtlcsDecodeErrorZPtr { result }
3054 let err = unsafe { o.contents.err };
3055 unsafe { o.contents.err = core::ptr::null_mut(); }
3056 CResult_InFlightHtlcsDecodeErrorZPtr { err }
3060 result_ok: o.result_ok,
3064 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
3065 fn clone(&self) -> Self {
3067 Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3068 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
3071 Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
3072 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3078 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
3079 /// but with all dynamically-allocated buffers duplicated in new buffers.
3080 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
3082 /// The contents of CResult_RouteHopDecodeErrorZ
3083 pub union CResult_RouteHopDecodeErrorZPtr {
3084 /// A pointer to the contents in the success state.
3085 /// Reading from this pointer when `result_ok` is not set is undefined.
3086 pub result: *mut crate::lightning::routing::router::RouteHop,
3087 /// A pointer to the contents in the error state.
3088 /// Reading from this pointer when `result_ok` is set is undefined.
3089 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3092 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
3093 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3095 pub struct CResult_RouteHopDecodeErrorZ {
3096 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
3097 /// `err` or `result` depending on the state of `result_ok`.
3098 pub contents: CResult_RouteHopDecodeErrorZPtr,
3099 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
3100 pub result_ok: bool,
3103 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
3104 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
3105 CResult_RouteHopDecodeErrorZ {
3106 contents: CResult_RouteHopDecodeErrorZPtr {
3107 result: Box::into_raw(Box::new(o)),
3113 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
3114 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
3115 CResult_RouteHopDecodeErrorZ {
3116 contents: CResult_RouteHopDecodeErrorZPtr {
3117 err: Box::into_raw(Box::new(e)),
3122 /// Checks if the given object is currently in the success state
3124 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
3128 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
3129 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
3130 impl Drop for CResult_RouteHopDecodeErrorZ {
3131 fn drop(&mut self) {
3133 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3134 let _ = unsafe { Box::from_raw(self.contents.result) };
3137 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3138 let _ = unsafe { Box::from_raw(self.contents.err) };
3143 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
3144 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3145 let contents = if o.result_ok {
3146 let result = unsafe { o.contents.result };
3147 unsafe { o.contents.result = core::ptr::null_mut() };
3148 CResult_RouteHopDecodeErrorZPtr { result }
3150 let err = unsafe { o.contents.err };
3151 unsafe { o.contents.err = core::ptr::null_mut(); }
3152 CResult_RouteHopDecodeErrorZPtr { err }
3156 result_ok: o.result_ok,
3160 impl Clone for CResult_RouteHopDecodeErrorZ {
3161 fn clone(&self) -> Self {
3163 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
3164 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
3167 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
3168 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3174 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
3175 /// but with all dynamically-allocated buffers duplicated in new buffers.
3176 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
3178 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
3179 /// This corresponds to std::vector in C++
3180 pub struct CVec_BlindedHopZ {
3181 /// The elements in the array.
3182 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3183 pub data: *mut crate::lightning::blinded_path::BlindedHop,
3184 /// The number of elements pointed to by `data`.
3187 impl CVec_BlindedHopZ {
3188 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
3189 if self.datalen == 0 { return Vec::new(); }
3190 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3191 self.data = core::ptr::null_mut();
3195 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
3196 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3199 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
3200 fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
3201 let datalen = v.len();
3202 let data = Box::into_raw(v.into_boxed_slice());
3203 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3207 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3208 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
3209 impl Drop for CVec_BlindedHopZ {
3210 fn drop(&mut self) {
3211 if self.datalen == 0 { return; }
3212 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3215 impl Clone for CVec_BlindedHopZ {
3216 fn clone(&self) -> Self {
3217 let mut res = Vec::new();
3218 if self.datalen == 0 { return Self::from(res); }
3219 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3224 /// The contents of CResult_BlindedTailDecodeErrorZ
3225 pub union CResult_BlindedTailDecodeErrorZPtr {
3226 /// A pointer to the contents in the success state.
3227 /// Reading from this pointer when `result_ok` is not set is undefined.
3228 pub result: *mut crate::lightning::routing::router::BlindedTail,
3229 /// A pointer to the contents in the error state.
3230 /// Reading from this pointer when `result_ok` is set is undefined.
3231 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3234 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
3235 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
3236 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3237 pub struct CResult_BlindedTailDecodeErrorZ {
3238 /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
3239 /// `err` or `result` depending on the state of `result_ok`.
3240 pub contents: CResult_BlindedTailDecodeErrorZPtr,
3241 /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
3242 pub result_ok: bool,
3245 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
3246 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
3247 CResult_BlindedTailDecodeErrorZ {
3248 contents: CResult_BlindedTailDecodeErrorZPtr {
3249 result: Box::into_raw(Box::new(o)),
3255 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
3256 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
3257 CResult_BlindedTailDecodeErrorZ {
3258 contents: CResult_BlindedTailDecodeErrorZPtr {
3259 err: Box::into_raw(Box::new(e)),
3264 /// Checks if the given object is currently in the success state
3266 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
3270 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
3271 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
3272 impl Drop for CResult_BlindedTailDecodeErrorZ {
3273 fn drop(&mut self) {
3275 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3276 let _ = unsafe { Box::from_raw(self.contents.result) };
3279 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3280 let _ = unsafe { Box::from_raw(self.contents.err) };
3285 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
3286 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
3287 let contents = if o.result_ok {
3288 let result = unsafe { o.contents.result };
3289 unsafe { o.contents.result = core::ptr::null_mut() };
3290 CResult_BlindedTailDecodeErrorZPtr { result }
3292 let err = unsafe { o.contents.err };
3293 unsafe { o.contents.err = core::ptr::null_mut(); }
3294 CResult_BlindedTailDecodeErrorZPtr { err }
3298 result_ok: o.result_ok,
3302 impl Clone for CResult_BlindedTailDecodeErrorZ {
3303 fn clone(&self) -> Self {
3305 Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
3306 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
3309 Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
3310 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3316 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
3317 /// but with all dynamically-allocated buffers duplicated in new buffers.
3318 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
3320 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3321 /// This corresponds to std::vector in C++
3322 pub struct CVec_RouteHopZ {
3323 /// The elements in the array.
3324 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3325 pub data: *mut crate::lightning::routing::router::RouteHop,
3326 /// The number of elements pointed to by `data`.
3329 impl CVec_RouteHopZ {
3330 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
3331 if self.datalen == 0 { return Vec::new(); }
3332 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3333 self.data = core::ptr::null_mut();
3337 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
3338 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3341 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
3342 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
3343 let datalen = v.len();
3344 let data = Box::into_raw(v.into_boxed_slice());
3345 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3349 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3350 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3351 impl Drop for CVec_RouteHopZ {
3352 fn drop(&mut self) {
3353 if self.datalen == 0 { return; }
3354 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3357 impl Clone for CVec_RouteHopZ {
3358 fn clone(&self) -> Self {
3359 let mut res = Vec::new();
3360 if self.datalen == 0 { return Self::from(res); }
3361 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3367 /// An enum which can either contain a u32 or not
3368 pub enum COption_u32Z {
3369 /// When we're in this state, this COption_u32Z contains a u32
3371 /// When we're in this state, this COption_u32Z contains nothing
3375 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3376 if let Self::None = self { false } else { true }
3378 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3381 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
3382 if let Self::Some(v) = self { v } else { unreachable!() }
3386 /// Constructs a new COption_u32Z containing a u32
3387 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
3388 COption_u32Z::Some(o)
3391 /// Constructs a new COption_u32Z containing nothing
3392 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
3396 /// Frees any resources associated with the u32, if we are in the Some state
3397 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
3399 /// Creates a new COption_u32Z which has the same data as `orig`
3400 /// but with all dynamically-allocated buffers duplicated in new buffers.
3401 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
3403 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
3404 /// This corresponds to std::vector in C++
3405 pub struct CVec_PathZ {
3406 /// The elements in the array.
3407 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3408 pub data: *mut crate::lightning::routing::router::Path,
3409 /// The number of elements pointed to by `data`.
3413 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
3414 if self.datalen == 0 { return Vec::new(); }
3415 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3416 self.data = core::ptr::null_mut();
3420 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
3421 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3424 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
3425 fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
3426 let datalen = v.len();
3427 let data = Box::into_raw(v.into_boxed_slice());
3428 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3433 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
3434 impl Drop for CVec_PathZ {
3435 fn drop(&mut self) {
3436 if self.datalen == 0 { return; }
3437 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3440 impl Clone for CVec_PathZ {
3441 fn clone(&self) -> Self {
3442 let mut res = Vec::new();
3443 if self.datalen == 0 { return Self::from(res); }
3444 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3449 /// The contents of CResult_RouteDecodeErrorZ
3450 pub union CResult_RouteDecodeErrorZPtr {
3451 /// A pointer to the contents in the success state.
3452 /// Reading from this pointer when `result_ok` is not set is undefined.
3453 pub result: *mut crate::lightning::routing::router::Route,
3454 /// A pointer to the contents in the error state.
3455 /// Reading from this pointer when `result_ok` is set is undefined.
3456 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3459 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3460 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3462 pub struct CResult_RouteDecodeErrorZ {
3463 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
3464 /// `err` or `result` depending on the state of `result_ok`.
3465 pub contents: CResult_RouteDecodeErrorZPtr,
3466 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
3467 pub result_ok: bool,
3470 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
3471 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3472 CResult_RouteDecodeErrorZ {
3473 contents: CResult_RouteDecodeErrorZPtr {
3474 result: Box::into_raw(Box::new(o)),
3480 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
3481 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3482 CResult_RouteDecodeErrorZ {
3483 contents: CResult_RouteDecodeErrorZPtr {
3484 err: Box::into_raw(Box::new(e)),
3489 /// Checks if the given object is currently in the success state
3491 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
3495 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
3496 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3497 impl Drop for CResult_RouteDecodeErrorZ {
3498 fn drop(&mut self) {
3500 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3501 let _ = unsafe { Box::from_raw(self.contents.result) };
3504 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3505 let _ = unsafe { Box::from_raw(self.contents.err) };
3510 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3511 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
3512 let contents = if o.result_ok {
3513 let result = unsafe { o.contents.result };
3514 unsafe { o.contents.result = core::ptr::null_mut() };
3515 CResult_RouteDecodeErrorZPtr { result }
3517 let err = unsafe { o.contents.err };
3518 unsafe { o.contents.err = core::ptr::null_mut(); }
3519 CResult_RouteDecodeErrorZPtr { err }
3523 result_ok: o.result_ok,
3527 impl Clone for CResult_RouteDecodeErrorZ {
3528 fn clone(&self) -> Self {
3530 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3531 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3534 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3535 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3541 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
3542 /// but with all dynamically-allocated buffers duplicated in new buffers.
3543 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
3545 /// The contents of CResult_RouteParametersDecodeErrorZ
3546 pub union CResult_RouteParametersDecodeErrorZPtr {
3547 /// A pointer to the contents in the success state.
3548 /// Reading from this pointer when `result_ok` is not set is undefined.
3549 pub result: *mut crate::lightning::routing::router::RouteParameters,
3550 /// A pointer to the contents in the error state.
3551 /// Reading from this pointer when `result_ok` is set is undefined.
3552 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3555 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
3556 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3558 pub struct CResult_RouteParametersDecodeErrorZ {
3559 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
3560 /// `err` or `result` depending on the state of `result_ok`.
3561 pub contents: CResult_RouteParametersDecodeErrorZPtr,
3562 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
3563 pub result_ok: bool,
3566 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
3567 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
3568 CResult_RouteParametersDecodeErrorZ {
3569 contents: CResult_RouteParametersDecodeErrorZPtr {
3570 result: Box::into_raw(Box::new(o)),
3576 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
3577 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
3578 CResult_RouteParametersDecodeErrorZ {
3579 contents: CResult_RouteParametersDecodeErrorZPtr {
3580 err: Box::into_raw(Box::new(e)),
3585 /// Checks if the given object is currently in the success state
3587 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
3591 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
3592 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
3593 impl Drop for CResult_RouteParametersDecodeErrorZ {
3594 fn drop(&mut self) {
3596 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3597 let _ = unsafe { Box::from_raw(self.contents.result) };
3600 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3601 let _ = unsafe { Box::from_raw(self.contents.err) };
3606 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
3607 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3608 let contents = if o.result_ok {
3609 let result = unsafe { o.contents.result };
3610 unsafe { o.contents.result = core::ptr::null_mut() };
3611 CResult_RouteParametersDecodeErrorZPtr { result }
3613 let err = unsafe { o.contents.err };
3614 unsafe { o.contents.err = core::ptr::null_mut(); }
3615 CResult_RouteParametersDecodeErrorZPtr { err }
3619 result_ok: o.result_ok,
3623 impl Clone for CResult_RouteParametersDecodeErrorZ {
3624 fn clone(&self) -> Self {
3626 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
3627 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
3630 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
3631 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3637 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
3638 /// but with all dynamically-allocated buffers duplicated in new buffers.
3639 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
3641 /// A dynamically-allocated array of u64s of arbitrary size.
3642 /// This corresponds to std::vector in C++
3643 pub struct CVec_u64Z {
3644 /// The elements in the array.
3645 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3647 /// The number of elements pointed to by `data`.
3651 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
3652 if self.datalen == 0 { return Vec::new(); }
3653 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3654 self.data = core::ptr::null_mut();
3658 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
3659 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3662 impl From<Vec<u64>> for CVec_u64Z {
3663 fn from(v: Vec<u64>) -> Self {
3664 let datalen = v.len();
3665 let data = Box::into_raw(v.into_boxed_slice());
3666 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3670 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3671 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
3672 impl Drop for CVec_u64Z {
3673 fn drop(&mut self) {
3674 if self.datalen == 0 { return; }
3675 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3678 impl Clone for CVec_u64Z {
3679 fn clone(&self) -> Self {
3680 let mut res = Vec::new();
3681 if self.datalen == 0 { return Self::from(res); }
3682 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3687 /// The contents of CResult_PaymentParametersDecodeErrorZ
3688 pub union CResult_PaymentParametersDecodeErrorZPtr {
3689 /// A pointer to the contents in the success state.
3690 /// Reading from this pointer when `result_ok` is not set is undefined.
3691 pub result: *mut crate::lightning::routing::router::PaymentParameters,
3692 /// A pointer to the contents in the error state.
3693 /// Reading from this pointer when `result_ok` is set is undefined.
3694 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3697 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
3698 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3699 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3700 pub struct CResult_PaymentParametersDecodeErrorZ {
3701 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
3702 /// `err` or `result` depending on the state of `result_ok`.
3703 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
3704 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
3705 pub result_ok: bool,
3708 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
3709 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
3710 CResult_PaymentParametersDecodeErrorZ {
3711 contents: CResult_PaymentParametersDecodeErrorZPtr {
3712 result: Box::into_raw(Box::new(o)),
3718 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
3719 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
3720 CResult_PaymentParametersDecodeErrorZ {
3721 contents: CResult_PaymentParametersDecodeErrorZPtr {
3722 err: Box::into_raw(Box::new(e)),
3727 /// Checks if the given object is currently in the success state
3729 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
3733 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
3734 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
3735 impl Drop for CResult_PaymentParametersDecodeErrorZ {
3736 fn drop(&mut self) {
3738 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3739 let _ = unsafe { Box::from_raw(self.contents.result) };
3742 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3743 let _ = unsafe { Box::from_raw(self.contents.err) };
3748 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
3749 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3750 let contents = if o.result_ok {
3751 let result = unsafe { o.contents.result };
3752 unsafe { o.contents.result = core::ptr::null_mut() };
3753 CResult_PaymentParametersDecodeErrorZPtr { result }
3755 let err = unsafe { o.contents.err };
3756 unsafe { o.contents.err = core::ptr::null_mut(); }
3757 CResult_PaymentParametersDecodeErrorZPtr { err }
3761 result_ok: o.result_ok,
3765 impl Clone for CResult_PaymentParametersDecodeErrorZ {
3766 fn clone(&self) -> Self {
3768 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
3769 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
3772 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
3773 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3779 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
3780 /// but with all dynamically-allocated buffers duplicated in new buffers.
3781 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
3783 /// A tuple of 2 elements. See the individual fields for the types contained.
3784 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
3785 /// The element at position 0
3786 pub a: crate::lightning::offers::invoice::BlindedPayInfo,
3787 /// The element at position 1
3788 pub b: crate::lightning::blinded_path::BlindedPath,
3790 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
3791 fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
3798 impl C2Tuple_BlindedPayInfoBlindedPathZ {
3799 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
3803 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
3804 fn clone(&self) -> Self {
3806 a: Clone::clone(&self.a),
3807 b: Clone::clone(&self.b),
3812 /// Creates a new tuple which has the same data as `orig`
3813 /// but with all dynamically-allocated buffers duplicated in new buffers.
3814 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
3815 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
3817 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
3818 C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
3822 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
3823 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
3825 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
3826 /// This corresponds to std::vector in C++
3827 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3828 /// The elements in the array.
3829 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3830 pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
3831 /// The number of elements pointed to by `data`.
3834 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3835 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
3836 if self.datalen == 0 { return Vec::new(); }
3837 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3838 self.data = core::ptr::null_mut();
3842 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
3843 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3846 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3847 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
3848 let datalen = v.len();
3849 let data = Box::into_raw(v.into_boxed_slice());
3850 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3854 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3855 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
3856 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3857 fn drop(&mut self) {
3858 if self.datalen == 0 { return; }
3859 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3862 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3863 fn clone(&self) -> Self {
3864 let mut res = Vec::new();
3865 if self.datalen == 0 { return Self::from(res); }
3866 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3871 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
3872 /// This corresponds to std::vector in C++
3873 pub struct CVec_RouteHintZ {
3874 /// The elements in the array.
3875 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3876 pub data: *mut crate::lightning::routing::router::RouteHint,
3877 /// The number of elements pointed to by `data`.
3880 impl CVec_RouteHintZ {
3881 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
3882 if self.datalen == 0 { return Vec::new(); }
3883 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3884 self.data = core::ptr::null_mut();
3888 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
3889 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3892 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
3893 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
3894 let datalen = v.len();
3895 let data = Box::into_raw(v.into_boxed_slice());
3896 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3900 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3901 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
3902 impl Drop for CVec_RouteHintZ {
3903 fn drop(&mut self) {
3904 if self.datalen == 0 { return; }
3905 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3908 impl Clone for CVec_RouteHintZ {
3909 fn clone(&self) -> Self {
3910 let mut res = Vec::new();
3911 if self.datalen == 0 { return Self::from(res); }
3912 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3917 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
3918 /// This corresponds to std::vector in C++
3919 pub struct CVec_RouteHintHopZ {
3920 /// The elements in the array.
3921 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3922 pub data: *mut crate::lightning::routing::router::RouteHintHop,
3923 /// The number of elements pointed to by `data`.
3926 impl CVec_RouteHintHopZ {
3927 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
3928 if self.datalen == 0 { return Vec::new(); }
3929 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3930 self.data = core::ptr::null_mut();
3934 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
3935 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3938 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
3939 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
3940 let datalen = v.len();
3941 let data = Box::into_raw(v.into_boxed_slice());
3942 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3946 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3947 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
3948 impl Drop for CVec_RouteHintHopZ {
3949 fn drop(&mut self) {
3950 if self.datalen == 0 { return; }
3951 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3954 impl Clone for CVec_RouteHintHopZ {
3955 fn clone(&self) -> Self {
3956 let mut res = Vec::new();
3957 if self.datalen == 0 { return Self::from(res); }
3958 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3963 /// The contents of CResult_RouteHintDecodeErrorZ
3964 pub union CResult_RouteHintDecodeErrorZPtr {
3965 /// A pointer to the contents in the success state.
3966 /// Reading from this pointer when `result_ok` is not set is undefined.
3967 pub result: *mut crate::lightning::routing::router::RouteHint,
3968 /// A pointer to the contents in the error state.
3969 /// Reading from this pointer when `result_ok` is set is undefined.
3970 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3973 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
3974 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
3975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3976 pub struct CResult_RouteHintDecodeErrorZ {
3977 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
3978 /// `err` or `result` depending on the state of `result_ok`.
3979 pub contents: CResult_RouteHintDecodeErrorZPtr,
3980 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
3981 pub result_ok: bool,
3984 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
3985 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
3986 CResult_RouteHintDecodeErrorZ {
3987 contents: CResult_RouteHintDecodeErrorZPtr {
3988 result: Box::into_raw(Box::new(o)),
3994 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
3995 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
3996 CResult_RouteHintDecodeErrorZ {
3997 contents: CResult_RouteHintDecodeErrorZPtr {
3998 err: Box::into_raw(Box::new(e)),
4003 /// Checks if the given object is currently in the success state
4005 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
4009 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
4010 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
4011 impl Drop for CResult_RouteHintDecodeErrorZ {
4012 fn drop(&mut self) {
4014 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4015 let _ = unsafe { Box::from_raw(self.contents.result) };
4018 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4019 let _ = unsafe { Box::from_raw(self.contents.err) };
4024 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
4025 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
4026 let contents = if o.result_ok {
4027 let result = unsafe { o.contents.result };
4028 unsafe { o.contents.result = core::ptr::null_mut() };
4029 CResult_RouteHintDecodeErrorZPtr { result }
4031 let err = unsafe { o.contents.err };
4032 unsafe { o.contents.err = core::ptr::null_mut(); }
4033 CResult_RouteHintDecodeErrorZPtr { err }
4037 result_ok: o.result_ok,
4041 impl Clone for CResult_RouteHintDecodeErrorZ {
4042 fn clone(&self) -> Self {
4044 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
4045 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
4048 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
4049 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4055 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
4056 /// but with all dynamically-allocated buffers duplicated in new buffers.
4057 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
4059 /// The contents of CResult_RouteHintHopDecodeErrorZ
4060 pub union CResult_RouteHintHopDecodeErrorZPtr {
4061 /// A pointer to the contents in the success state.
4062 /// Reading from this pointer when `result_ok` is not set is undefined.
4063 pub result: *mut crate::lightning::routing::router::RouteHintHop,
4064 /// A pointer to the contents in the error state.
4065 /// Reading from this pointer when `result_ok` is set is undefined.
4066 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4069 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
4070 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4072 pub struct CResult_RouteHintHopDecodeErrorZ {
4073 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
4074 /// `err` or `result` depending on the state of `result_ok`.
4075 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
4076 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
4077 pub result_ok: bool,
4080 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
4081 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
4082 CResult_RouteHintHopDecodeErrorZ {
4083 contents: CResult_RouteHintHopDecodeErrorZPtr {
4084 result: Box::into_raw(Box::new(o)),
4090 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
4091 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
4092 CResult_RouteHintHopDecodeErrorZ {
4093 contents: CResult_RouteHintHopDecodeErrorZPtr {
4094 err: Box::into_raw(Box::new(e)),
4099 /// Checks if the given object is currently in the success state
4101 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
4105 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
4106 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
4107 impl Drop for CResult_RouteHintHopDecodeErrorZ {
4108 fn drop(&mut self) {
4110 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4111 let _ = unsafe { Box::from_raw(self.contents.result) };
4114 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4115 let _ = unsafe { Box::from_raw(self.contents.err) };
4120 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
4121 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4122 let contents = if o.result_ok {
4123 let result = unsafe { o.contents.result };
4124 unsafe { o.contents.result = core::ptr::null_mut() };
4125 CResult_RouteHintHopDecodeErrorZPtr { result }
4127 let err = unsafe { o.contents.err };
4128 unsafe { o.contents.err = core::ptr::null_mut(); }
4129 CResult_RouteHintHopDecodeErrorZPtr { err }
4133 result_ok: o.result_ok,
4137 impl Clone for CResult_RouteHintHopDecodeErrorZ {
4138 fn clone(&self) -> Self {
4140 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
4141 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
4144 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
4145 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4151 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
4152 /// but with all dynamically-allocated buffers duplicated in new buffers.
4153 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
4155 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4156 /// This corresponds to std::vector in C++
4157 pub struct CVec_PublicKeyZ {
4158 /// The elements in the array.
4159 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4160 pub data: *mut crate::c_types::PublicKey,
4161 /// The number of elements pointed to by `data`.
4164 impl CVec_PublicKeyZ {
4165 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4166 if self.datalen == 0 { return Vec::new(); }
4167 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4168 self.data = core::ptr::null_mut();
4172 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4173 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4176 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4177 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4178 let datalen = v.len();
4179 let data = Box::into_raw(v.into_boxed_slice());
4180 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4184 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4185 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4186 impl Drop for CVec_PublicKeyZ {
4187 fn drop(&mut self) {
4188 if self.datalen == 0 { return; }
4189 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4192 impl Clone for CVec_PublicKeyZ {
4193 fn clone(&self) -> Self {
4194 let mut res = Vec::new();
4195 if self.datalen == 0 { return Self::from(res); }
4196 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4201 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4202 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4203 /// A pointer to the contents in the success state.
4204 /// Reading from this pointer when `result_ok` is not set is undefined.
4205 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4206 /// A pointer to the contents in the error state.
4207 /// Reading from this pointer when `result_ok` is set is undefined.
4208 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4211 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4212 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4214 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4215 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4216 /// `err` or `result` depending on the state of `result_ok`.
4217 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4218 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4219 pub result_ok: bool,
4222 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4223 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4224 CResult_FixedPenaltyScorerDecodeErrorZ {
4225 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4226 result: Box::into_raw(Box::new(o)),
4232 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4233 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4234 CResult_FixedPenaltyScorerDecodeErrorZ {
4235 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4236 err: Box::into_raw(Box::new(e)),
4241 /// Checks if the given object is currently in the success state
4243 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4247 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4248 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4249 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4250 fn drop(&mut self) {
4252 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4253 let _ = unsafe { Box::from_raw(self.contents.result) };
4256 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4257 let _ = unsafe { Box::from_raw(self.contents.err) };
4262 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4263 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4264 let contents = if o.result_ok {
4265 let result = unsafe { o.contents.result };
4266 unsafe { o.contents.result = core::ptr::null_mut() };
4267 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4269 let err = unsafe { o.contents.err };
4270 unsafe { o.contents.err = core::ptr::null_mut(); }
4271 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4275 result_ok: o.result_ok,
4279 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4280 fn clone(&self) -> Self {
4282 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4283 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4286 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4287 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4293 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4294 /// but with all dynamically-allocated buffers duplicated in new buffers.
4295 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4297 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4298 /// This corresponds to std::vector in C++
4299 pub struct CVec_NodeIdZ {
4300 /// The elements in the array.
4301 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4302 pub data: *mut crate::lightning::routing::gossip::NodeId,
4303 /// The number of elements pointed to by `data`.
4307 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4308 if self.datalen == 0 { return Vec::new(); }
4309 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4310 self.data = core::ptr::null_mut();
4314 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4315 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4318 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4319 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4320 let datalen = v.len();
4321 let data = Box::into_raw(v.into_boxed_slice());
4322 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4326 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4327 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4328 impl Drop for CVec_NodeIdZ {
4329 fn drop(&mut self) {
4330 if self.datalen == 0 { return; }
4331 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4334 impl Clone for CVec_NodeIdZ {
4335 fn clone(&self) -> Self {
4336 let mut res = Vec::new();
4337 if self.datalen == 0 { return Self::from(res); }
4338 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4343 /// A tuple of 2 elements. See the individual fields for the types contained.
4344 pub struct C2Tuple_u64u64Z {
4345 /// The element at position 0
4347 /// The element at position 1
4350 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4351 fn from (tup: (u64, u64)) -> Self {
4358 impl C2Tuple_u64u64Z {
4359 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4363 impl Clone for C2Tuple_u64u64Z {
4364 fn clone(&self) -> Self {
4366 a: Clone::clone(&self.a),
4367 b: Clone::clone(&self.b),
4372 /// Creates a new tuple which has the same data as `orig`
4373 /// but with all dynamically-allocated buffers duplicated in new buffers.
4374 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4375 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4377 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4378 C2Tuple_u64u64Z { a, b, }
4382 /// Frees any resources used by the C2Tuple_u64u64Z.
4383 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4386 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4387 pub enum COption_C2Tuple_u64u64ZZ {
4388 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4389 Some(crate::c_types::derived::C2Tuple_u64u64Z),
4390 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4393 impl COption_C2Tuple_u64u64ZZ {
4394 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4395 if let Self::None = self { false } else { true }
4397 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4400 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4401 if let Self::Some(v) = self { v } else { unreachable!() }
4405 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4406 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4407 COption_C2Tuple_u64u64ZZ::Some(o)
4410 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4411 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4412 COption_C2Tuple_u64u64ZZ::None
4415 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4416 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4418 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4419 /// but with all dynamically-allocated buffers duplicated in new buffers.
4420 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4422 /// A tuple of 2 elements. See the individual fields for the types contained.
4423 pub struct C2Tuple_Z {
4424 /// The element at position 0
4425 pub a: crate::c_types::EightU16s,
4426 /// The element at position 1
4427 pub b: crate::c_types::EightU16s,
4429 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple_Z {
4430 fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4438 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4442 impl Clone for C2Tuple_Z {
4443 fn clone(&self) -> Self {
4445 a: Clone::clone(&self.a),
4446 b: Clone::clone(&self.b),
4451 /// Creates a new tuple which has the same data as `orig`
4452 /// but with all dynamically-allocated buffers duplicated in new buffers.
4453 pub extern "C" fn C2Tuple_Z_clone(orig: &C2Tuple_Z) -> C2Tuple_Z { Clone::clone(&orig) }
4454 /// Creates a new C2Tuple_Z from the contained elements.
4456 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple_Z {
4461 /// Frees any resources used by the C2Tuple_Z.
4462 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
4464 /// A tuple of 2 elements. See the individual fields for the types contained.
4465 pub struct C2Tuple__u168_u168Z {
4466 /// The element at position 0
4467 pub a: crate::c_types::EightU16s,
4468 /// The element at position 1
4469 pub b: crate::c_types::EightU16s,
4471 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple__u168_u168Z {
4472 fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4479 impl C2Tuple__u168_u168Z {
4480 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4484 impl Clone for C2Tuple__u168_u168Z {
4485 fn clone(&self) -> Self {
4487 a: Clone::clone(&self.a),
4488 b: Clone::clone(&self.b),
4493 /// Creates a new tuple which has the same data as `orig`
4494 /// but with all dynamically-allocated buffers duplicated in new buffers.
4495 pub extern "C" fn C2Tuple__u168_u168Z_clone(orig: &C2Tuple__u168_u168Z) -> C2Tuple__u168_u168Z { Clone::clone(&orig) }
4496 /// Creates a new C2Tuple__u168_u168Z from the contained elements.
4498 pub extern "C" fn C2Tuple__u168_u168Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple__u168_u168Z {
4499 C2Tuple__u168_u168Z { a, b, }
4503 /// Frees any resources used by the C2Tuple__u168_u168Z.
4504 pub extern "C" fn C2Tuple__u168_u168Z_free(_res: C2Tuple__u168_u168Z) { }
4507 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
4508 pub enum COption_C2Tuple_EightU16sEightU16sZZ {
4509 /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
4510 Some(crate::c_types::derived::C2Tuple__u168_u168Z),
4511 /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
4514 impl COption_C2Tuple_EightU16sEightU16sZZ {
4515 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4516 if let Self::None = self { false } else { true }
4518 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4521 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u168_u168Z {
4522 if let Self::Some(v) = self { v } else { unreachable!() }
4526 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z
4527 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_some(o: crate::c_types::derived::C2Tuple__u168_u168Z) -> COption_C2Tuple_EightU16sEightU16sZZ {
4528 COption_C2Tuple_EightU16sEightU16sZZ::Some(o)
4531 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing
4532 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_none() -> COption_C2Tuple_EightU16sEightU16sZZ {
4533 COption_C2Tuple_EightU16sEightU16sZZ::None
4536 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state
4537 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_free(_res: COption_C2Tuple_EightU16sEightU16sZZ) { }
4539 /// Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig`
4540 /// but with all dynamically-allocated buffers duplicated in new buffers.
4541 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_clone(orig: &COption_C2Tuple_EightU16sEightU16sZZ) -> COption_C2Tuple_EightU16sEightU16sZZ { Clone::clone(&orig) }
4543 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4544 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4545 /// A pointer to the contents in the success state.
4546 /// Reading from this pointer when `result_ok` is not set is undefined.
4547 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4548 /// A pointer to the contents in the error state.
4549 /// Reading from this pointer when `result_ok` is set is undefined.
4550 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4553 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4554 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4556 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4557 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4558 /// `err` or `result` depending on the state of `result_ok`.
4559 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4560 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4561 pub result_ok: bool,
4564 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4565 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4566 CResult_ProbabilisticScorerDecodeErrorZ {
4567 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4568 result: Box::into_raw(Box::new(o)),
4574 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4575 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4576 CResult_ProbabilisticScorerDecodeErrorZ {
4577 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4578 err: Box::into_raw(Box::new(e)),
4583 /// Checks if the given object is currently in the success state
4585 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4589 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4590 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4591 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4592 fn drop(&mut self) {
4594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4595 let _ = unsafe { Box::from_raw(self.contents.result) };
4598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4599 let _ = unsafe { Box::from_raw(self.contents.err) };
4604 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4605 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4606 let contents = if o.result_ok {
4607 let result = unsafe { o.contents.result };
4608 unsafe { o.contents.result = core::ptr::null_mut() };
4609 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4611 let err = unsafe { o.contents.err };
4612 unsafe { o.contents.err = core::ptr::null_mut(); }
4613 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4617 result_ok: o.result_ok,
4622 /// A tuple of 2 elements. See the individual fields for the types contained.
4623 pub struct C2Tuple_usizeTransactionZ {
4624 /// The element at position 0
4626 /// The element at position 1
4627 pub b: crate::c_types::Transaction,
4629 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
4630 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
4637 impl C2Tuple_usizeTransactionZ {
4638 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
4642 impl Clone for C2Tuple_usizeTransactionZ {
4643 fn clone(&self) -> Self {
4645 a: Clone::clone(&self.a),
4646 b: Clone::clone(&self.b),
4651 /// Creates a new tuple which has the same data as `orig`
4652 /// but with all dynamically-allocated buffers duplicated in new buffers.
4653 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
4654 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
4656 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
4657 C2Tuple_usizeTransactionZ { a, b, }
4661 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
4662 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
4664 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4665 /// This corresponds to std::vector in C++
4666 pub struct CVec_C2Tuple_usizeTransactionZZ {
4667 /// The elements in the array.
4668 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4669 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
4670 /// The number of elements pointed to by `data`.
4673 impl CVec_C2Tuple_usizeTransactionZZ {
4674 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
4675 if self.datalen == 0 { return Vec::new(); }
4676 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4677 self.data = core::ptr::null_mut();
4681 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
4682 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4685 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
4686 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
4687 let datalen = v.len();
4688 let data = Box::into_raw(v.into_boxed_slice());
4689 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4693 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4694 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
4695 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
4696 fn drop(&mut self) {
4697 if self.datalen == 0 { return; }
4698 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4701 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
4702 fn clone(&self) -> Self {
4703 let mut res = Vec::new();
4704 if self.datalen == 0 { return Self::from(res); }
4705 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4711 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
4712 pub enum COption_BlockHashZ {
4713 /// When we're in this state, this COption_BlockHashZ contains a crate::c_types::ThirtyTwoBytes
4714 Some(crate::c_types::ThirtyTwoBytes),
4715 /// When we're in this state, this COption_BlockHashZ contains nothing
4718 impl COption_BlockHashZ {
4719 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4720 if let Self::None = self { false } else { true }
4722 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4725 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
4726 if let Self::Some(v) = self { v } else { unreachable!() }
4730 /// Constructs a new COption_BlockHashZ containing a crate::c_types::ThirtyTwoBytes
4731 pub extern "C" fn COption_BlockHashZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_BlockHashZ {
4732 COption_BlockHashZ::Some(o)
4735 /// Constructs a new COption_BlockHashZ containing nothing
4736 pub extern "C" fn COption_BlockHashZ_none() -> COption_BlockHashZ {
4737 COption_BlockHashZ::None
4740 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
4741 pub extern "C" fn COption_BlockHashZ_free(_res: COption_BlockHashZ) { }
4743 /// Creates a new COption_BlockHashZ which has the same data as `orig`
4744 /// but with all dynamically-allocated buffers duplicated in new buffers.
4745 pub extern "C" fn COption_BlockHashZ_clone(orig: &COption_BlockHashZ) -> COption_BlockHashZ { Clone::clone(&orig) }
4747 /// A tuple of 2 elements. See the individual fields for the types contained.
4748 pub struct C2Tuple_TxidCOption_BlockHashZZ {
4749 /// The element at position 0
4750 pub a: crate::c_types::ThirtyTwoBytes,
4751 /// The element at position 1
4752 pub b: crate::c_types::derived::COption_BlockHashZ,
4754 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_BlockHashZ)> for C2Tuple_TxidCOption_BlockHashZZ {
4755 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_BlockHashZ)) -> Self {
4762 impl C2Tuple_TxidCOption_BlockHashZZ {
4763 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_BlockHashZ) {
4767 impl Clone for C2Tuple_TxidCOption_BlockHashZZ {
4768 fn clone(&self) -> Self {
4770 a: Clone::clone(&self.a),
4771 b: Clone::clone(&self.b),
4776 /// Creates a new tuple which has the same data as `orig`
4777 /// but with all dynamically-allocated buffers duplicated in new buffers.
4778 pub extern "C" fn C2Tuple_TxidCOption_BlockHashZZ_clone(orig: &C2Tuple_TxidCOption_BlockHashZZ) -> C2Tuple_TxidCOption_BlockHashZZ { Clone::clone(&orig) }
4779 /// Creates a new C2Tuple_TxidCOption_BlockHashZZ from the contained elements.
4781 pub extern "C" fn C2Tuple_TxidCOption_BlockHashZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::COption_BlockHashZ) -> C2Tuple_TxidCOption_BlockHashZZ {
4782 C2Tuple_TxidCOption_BlockHashZZ { a, b, }
4786 /// Frees any resources used by the C2Tuple_TxidCOption_BlockHashZZ.
4787 pub extern "C" fn C2Tuple_TxidCOption_BlockHashZZ_free(_res: C2Tuple_TxidCOption_BlockHashZZ) { }
4789 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZs of arbitrary size.
4790 /// This corresponds to std::vector in C++
4791 pub struct CVec_C2Tuple_TxidCOption_BlockHashZZZ {
4792 /// The elements in the array.
4793 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4794 pub data: *mut crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ,
4795 /// The number of elements pointed to by `data`.
4798 impl CVec_C2Tuple_TxidCOption_BlockHashZZZ {
4799 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ> {
4800 if self.datalen == 0 { return Vec::new(); }
4801 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4802 self.data = core::ptr::null_mut();
4806 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ] {
4807 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4810 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ>> for CVec_C2Tuple_TxidCOption_BlockHashZZZ {
4811 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ>) -> Self {
4812 let datalen = v.len();
4813 let data = Box::into_raw(v.into_boxed_slice());
4814 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4818 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4819 pub extern "C" fn CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(_res: CVec_C2Tuple_TxidCOption_BlockHashZZZ) { }
4820 impl Drop for CVec_C2Tuple_TxidCOption_BlockHashZZZ {
4821 fn drop(&mut self) {
4822 if self.datalen == 0 { return; }
4823 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4826 impl Clone for CVec_C2Tuple_TxidCOption_BlockHashZZZ {
4827 fn clone(&self) -> Self {
4828 let mut res = Vec::new();
4829 if self.datalen == 0 { return Self::from(res); }
4830 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4835 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4836 /// This corresponds to std::vector in C++
4837 pub struct CVec_MonitorEventZ {
4838 /// The elements in the array.
4839 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4840 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
4841 /// The number of elements pointed to by `data`.
4844 impl CVec_MonitorEventZ {
4845 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
4846 if self.datalen == 0 { return Vec::new(); }
4847 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4848 self.data = core::ptr::null_mut();
4852 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
4853 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4856 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
4857 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
4858 let datalen = v.len();
4859 let data = Box::into_raw(v.into_boxed_slice());
4860 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4864 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4865 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
4866 impl Drop for CVec_MonitorEventZ {
4867 fn drop(&mut self) {
4868 if self.datalen == 0 { return; }
4869 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4872 impl Clone for CVec_MonitorEventZ {
4873 fn clone(&self) -> Self {
4874 let mut res = Vec::new();
4875 if self.datalen == 0 { return Self::from(res); }
4876 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4881 /// A tuple of 3 elements. See the individual fields for the types contained.
4882 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4883 /// The element at position 0
4884 pub a: crate::lightning::chain::transaction::OutPoint,
4885 /// The element at position 1
4886 pub b: crate::c_types::derived::CVec_MonitorEventZ,
4887 /// The element at position 2
4888 pub c: crate::c_types::PublicKey,
4890 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4891 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
4899 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4900 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
4901 (self.a, self.b, self.c)
4904 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4905 fn clone(&self) -> Self {
4907 a: Clone::clone(&self.a),
4908 b: Clone::clone(&self.b),
4909 c: Clone::clone(&self.c),
4914 /// Creates a new tuple which has the same data as `orig`
4915 /// but with all dynamically-allocated buffers duplicated in new buffers.
4916 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
4917 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
4919 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 {
4920 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
4924 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
4925 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
4927 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4928 /// This corresponds to std::vector in C++
4929 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4930 /// The elements in the array.
4931 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4932 pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
4933 /// The number of elements pointed to by `data`.
4936 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4937 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
4938 if self.datalen == 0 { return Vec::new(); }
4939 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4940 self.data = core::ptr::null_mut();
4944 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
4945 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4948 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4949 fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
4950 let datalen = v.len();
4951 let data = Box::into_raw(v.into_boxed_slice());
4952 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4956 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4957 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
4958 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4959 fn drop(&mut self) {
4960 if self.datalen == 0 { return; }
4961 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4964 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4965 fn clone(&self) -> Self {
4966 let mut res = Vec::new();
4967 if self.datalen == 0 { return Self::from(res); }
4968 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4973 /// The contents of CResult_InitFeaturesDecodeErrorZ
4974 pub union CResult_InitFeaturesDecodeErrorZPtr {
4975 /// A pointer to the contents in the success state.
4976 /// Reading from this pointer when `result_ok` is not set is undefined.
4977 pub result: *mut crate::lightning::ln::features::InitFeatures,
4978 /// A pointer to the contents in the error state.
4979 /// Reading from this pointer when `result_ok` is set is undefined.
4980 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4983 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4984 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4986 pub struct CResult_InitFeaturesDecodeErrorZ {
4987 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4988 /// `err` or `result` depending on the state of `result_ok`.
4989 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4990 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4991 pub result_ok: bool,
4994 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4995 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4996 CResult_InitFeaturesDecodeErrorZ {
4997 contents: CResult_InitFeaturesDecodeErrorZPtr {
4998 result: Box::into_raw(Box::new(o)),
5004 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
5005 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
5006 CResult_InitFeaturesDecodeErrorZ {
5007 contents: CResult_InitFeaturesDecodeErrorZPtr {
5008 err: Box::into_raw(Box::new(e)),
5013 /// Checks if the given object is currently in the success state
5015 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
5019 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
5020 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
5021 impl Drop for CResult_InitFeaturesDecodeErrorZ {
5022 fn drop(&mut self) {
5024 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5025 let _ = unsafe { Box::from_raw(self.contents.result) };
5028 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5029 let _ = unsafe { Box::from_raw(self.contents.err) };
5034 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
5035 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5036 let contents = if o.result_ok {
5037 let result = unsafe { o.contents.result };
5038 unsafe { o.contents.result = core::ptr::null_mut() };
5039 CResult_InitFeaturesDecodeErrorZPtr { result }
5041 let err = unsafe { o.contents.err };
5042 unsafe { o.contents.err = core::ptr::null_mut(); }
5043 CResult_InitFeaturesDecodeErrorZPtr { err }
5047 result_ok: o.result_ok,
5051 impl Clone for CResult_InitFeaturesDecodeErrorZ {
5052 fn clone(&self) -> Self {
5054 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
5055 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
5058 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
5059 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5065 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
5066 /// but with all dynamically-allocated buffers duplicated in new buffers.
5067 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
5069 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
5070 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
5071 /// A pointer to the contents in the success state.
5072 /// Reading from this pointer when `result_ok` is not set is undefined.
5073 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
5074 /// A pointer to the contents in the error state.
5075 /// Reading from this pointer when `result_ok` is set is undefined.
5076 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5079 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5080 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5082 pub struct CResult_ChannelFeaturesDecodeErrorZ {
5083 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5084 /// `err` or `result` depending on the state of `result_ok`.
5085 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
5086 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5087 pub result_ok: bool,
5090 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
5091 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
5092 CResult_ChannelFeaturesDecodeErrorZ {
5093 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5094 result: Box::into_raw(Box::new(o)),
5100 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
5101 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
5102 CResult_ChannelFeaturesDecodeErrorZ {
5103 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5104 err: Box::into_raw(Box::new(e)),
5109 /// Checks if the given object is currently in the success state
5111 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
5115 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
5116 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
5117 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
5118 fn drop(&mut self) {
5120 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5121 let _ = unsafe { Box::from_raw(self.contents.result) };
5124 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5125 let _ = unsafe { Box::from_raw(self.contents.err) };
5130 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
5131 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5132 let contents = if o.result_ok {
5133 let result = unsafe { o.contents.result };
5134 unsafe { o.contents.result = core::ptr::null_mut() };
5135 CResult_ChannelFeaturesDecodeErrorZPtr { result }
5137 let err = unsafe { o.contents.err };
5138 unsafe { o.contents.err = core::ptr::null_mut(); }
5139 CResult_ChannelFeaturesDecodeErrorZPtr { err }
5143 result_ok: o.result_ok,
5147 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
5148 fn clone(&self) -> Self {
5150 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5151 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
5154 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
5155 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5161 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
5162 /// but with all dynamically-allocated buffers duplicated in new buffers.
5163 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
5165 /// The contents of CResult_NodeFeaturesDecodeErrorZ
5166 pub union CResult_NodeFeaturesDecodeErrorZPtr {
5167 /// A pointer to the contents in the success state.
5168 /// Reading from this pointer when `result_ok` is not set is undefined.
5169 pub result: *mut crate::lightning::ln::features::NodeFeatures,
5170 /// A pointer to the contents in the error state.
5171 /// Reading from this pointer when `result_ok` is set is undefined.
5172 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5175 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5176 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5178 pub struct CResult_NodeFeaturesDecodeErrorZ {
5179 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5180 /// `err` or `result` depending on the state of `result_ok`.
5181 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
5182 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5183 pub result_ok: bool,
5186 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5187 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5188 CResult_NodeFeaturesDecodeErrorZ {
5189 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5190 result: Box::into_raw(Box::new(o)),
5196 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5197 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5198 CResult_NodeFeaturesDecodeErrorZ {
5199 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5200 err: Box::into_raw(Box::new(e)),
5205 /// Checks if the given object is currently in the success state
5207 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
5211 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5212 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5213 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
5214 fn drop(&mut self) {
5216 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5217 let _ = unsafe { Box::from_raw(self.contents.result) };
5220 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5221 let _ = unsafe { Box::from_raw(self.contents.err) };
5226 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5227 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5228 let contents = if o.result_ok {
5229 let result = unsafe { o.contents.result };
5230 unsafe { o.contents.result = core::ptr::null_mut() };
5231 CResult_NodeFeaturesDecodeErrorZPtr { result }
5233 let err = unsafe { o.contents.err };
5234 unsafe { o.contents.err = core::ptr::null_mut(); }
5235 CResult_NodeFeaturesDecodeErrorZPtr { err }
5239 result_ok: o.result_ok,
5243 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
5244 fn clone(&self) -> Self {
5246 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5247 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
5250 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5251 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5257 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
5258 /// but with all dynamically-allocated buffers duplicated in new buffers.
5259 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5261 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
5262 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5263 /// A pointer to the contents in the success state.
5264 /// Reading from this pointer when `result_ok` is not set is undefined.
5265 pub result: *mut crate::lightning::ln::features::Bolt11InvoiceFeatures,
5266 /// A pointer to the contents in the error state.
5267 /// Reading from this pointer when `result_ok` is set is undefined.
5268 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5271 /// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5272 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5274 pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5275 /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
5276 /// `err` or `result` depending on the state of `result_ok`.
5277 pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
5278 /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
5279 pub result_ok: bool,
5282 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
5283 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5284 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5285 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5286 result: Box::into_raw(Box::new(o)),
5292 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
5293 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5294 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5295 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5296 err: Box::into_raw(Box::new(e)),
5301 /// Checks if the given object is currently in the success state
5303 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
5307 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
5308 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
5309 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5310 fn drop(&mut self) {
5312 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5313 let _ = unsafe { Box::from_raw(self.contents.result) };
5316 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5317 let _ = unsafe { Box::from_raw(self.contents.err) };
5322 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5323 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5324 let contents = if o.result_ok {
5325 let result = unsafe { o.contents.result };
5326 unsafe { o.contents.result = core::ptr::null_mut() };
5327 CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
5329 let err = unsafe { o.contents.err };
5330 unsafe { o.contents.err = core::ptr::null_mut(); }
5331 CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
5335 result_ok: o.result_ok,
5339 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
5340 fn clone(&self) -> Self {
5342 Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5343 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5346 Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
5347 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5353 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5354 /// but with all dynamically-allocated buffers duplicated in new buffers.
5355 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5357 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
5358 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5359 /// A pointer to the contents in the success state.
5360 /// Reading from this pointer when `result_ok` is not set is undefined.
5361 pub result: *mut crate::lightning::ln::features::Bolt12InvoiceFeatures,
5362 /// A pointer to the contents in the error state.
5363 /// Reading from this pointer when `result_ok` is set is undefined.
5364 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5367 /// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5368 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5369 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5370 pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5371 /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
5372 /// `err` or `result` depending on the state of `result_ok`.
5373 pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
5374 /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
5375 pub result_ok: bool,
5378 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
5379 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5380 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5381 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5382 result: Box::into_raw(Box::new(o)),
5388 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
5389 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5390 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5391 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5392 err: Box::into_raw(Box::new(e)),
5397 /// Checks if the given object is currently in the success state
5399 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
5403 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
5404 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
5405 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5406 fn drop(&mut self) {
5408 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5409 let _ = unsafe { Box::from_raw(self.contents.result) };
5412 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5413 let _ = unsafe { Box::from_raw(self.contents.err) };
5418 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5419 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5420 let contents = if o.result_ok {
5421 let result = unsafe { o.contents.result };
5422 unsafe { o.contents.result = core::ptr::null_mut() };
5423 CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
5425 let err = unsafe { o.contents.err };
5426 unsafe { o.contents.err = core::ptr::null_mut(); }
5427 CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
5431 result_ok: o.result_ok,
5435 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
5436 fn clone(&self) -> Self {
5438 Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5439 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5442 Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
5443 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5449 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5450 /// but with all dynamically-allocated buffers duplicated in new buffers.
5451 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5453 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
5454 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
5455 /// A pointer to the contents in the success state.
5456 /// Reading from this pointer when `result_ok` is not set is undefined.
5457 pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
5458 /// A pointer to the contents in the error state.
5459 /// Reading from this pointer when `result_ok` is set is undefined.
5460 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5463 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
5464 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5465 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5466 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
5467 /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
5468 /// `err` or `result` depending on the state of `result_ok`.
5469 pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
5470 /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
5471 pub result_ok: bool,
5474 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
5475 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5476 CResult_BlindedHopFeaturesDecodeErrorZ {
5477 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5478 result: Box::into_raw(Box::new(o)),
5484 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
5485 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5486 CResult_BlindedHopFeaturesDecodeErrorZ {
5487 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5488 err: Box::into_raw(Box::new(e)),
5493 /// Checks if the given object is currently in the success state
5495 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
5499 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
5500 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
5501 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
5502 fn drop(&mut self) {
5504 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5505 let _ = unsafe { Box::from_raw(self.contents.result) };
5508 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5509 let _ = unsafe { Box::from_raw(self.contents.err) };
5514 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
5515 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5516 let contents = if o.result_ok {
5517 let result = unsafe { o.contents.result };
5518 unsafe { o.contents.result = core::ptr::null_mut() };
5519 CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
5521 let err = unsafe { o.contents.err };
5522 unsafe { o.contents.err = core::ptr::null_mut(); }
5523 CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
5527 result_ok: o.result_ok,
5531 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
5532 fn clone(&self) -> Self {
5534 Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5535 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
5538 Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5539 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5545 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
5546 /// but with all dynamically-allocated buffers duplicated in new buffers.
5547 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
5549 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
5550 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5551 /// A pointer to the contents in the success state.
5552 /// Reading from this pointer when `result_ok` is not set is undefined.
5553 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
5554 /// A pointer to the contents in the error state.
5555 /// Reading from this pointer when `result_ok` is set is undefined.
5556 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5559 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
5560 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5561 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5562 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
5563 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
5564 /// `err` or `result` depending on the state of `result_ok`.
5565 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
5566 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
5567 pub result_ok: bool,
5570 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
5571 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5572 CResult_ChannelTypeFeaturesDecodeErrorZ {
5573 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5574 result: Box::into_raw(Box::new(o)),
5580 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
5581 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5582 CResult_ChannelTypeFeaturesDecodeErrorZ {
5583 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5584 err: Box::into_raw(Box::new(e)),
5589 /// Checks if the given object is currently in the success state
5591 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
5595 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
5596 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
5597 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
5598 fn drop(&mut self) {
5600 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5601 let _ = unsafe { Box::from_raw(self.contents.result) };
5604 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5605 let _ = unsafe { Box::from_raw(self.contents.err) };
5610 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
5611 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5612 let contents = if o.result_ok {
5613 let result = unsafe { o.contents.result };
5614 unsafe { o.contents.result = core::ptr::null_mut() };
5615 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
5617 let err = unsafe { o.contents.err };
5618 unsafe { o.contents.err = core::ptr::null_mut(); }
5619 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
5623 result_ok: o.result_ok,
5627 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
5628 fn clone(&self) -> Self {
5630 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5631 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
5634 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5635 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5641 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
5642 /// but with all dynamically-allocated buffers duplicated in new buffers.
5643 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5645 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
5646 /// This corresponds to std::vector in C++
5647 pub struct CVec_ChainHashZ {
5648 /// The elements in the array.
5649 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5650 pub data: *mut crate::c_types::ThirtyTwoBytes,
5651 /// The number of elements pointed to by `data`.
5654 impl CVec_ChainHashZ {
5655 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
5656 if self.datalen == 0 { return Vec::new(); }
5657 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5658 self.data = core::ptr::null_mut();
5662 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
5663 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5666 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ChainHashZ {
5667 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
5668 let datalen = v.len();
5669 let data = Box::into_raw(v.into_boxed_slice());
5670 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5674 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5675 pub extern "C" fn CVec_ChainHashZ_free(_res: CVec_ChainHashZ) { }
5676 impl Drop for CVec_ChainHashZ {
5677 fn drop(&mut self) {
5678 if self.datalen == 0 { return; }
5679 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5682 impl Clone for CVec_ChainHashZ {
5683 fn clone(&self) -> Self {
5684 let mut res = Vec::new();
5685 if self.datalen == 0 { return Self::from(res); }
5686 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5691 /// The contents of CResult_OfferBolt12ParseErrorZ
5692 pub union CResult_OfferBolt12ParseErrorZPtr {
5693 /// A pointer to the contents in the success state.
5694 /// Reading from this pointer when `result_ok` is not set is undefined.
5695 pub result: *mut crate::lightning::offers::offer::Offer,
5696 /// A pointer to the contents in the error state.
5697 /// Reading from this pointer when `result_ok` is set is undefined.
5698 pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
5701 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
5702 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
5703 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5704 pub struct CResult_OfferBolt12ParseErrorZ {
5705 /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
5706 /// `err` or `result` depending on the state of `result_ok`.
5707 pub contents: CResult_OfferBolt12ParseErrorZPtr,
5708 /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
5709 pub result_ok: bool,
5712 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
5713 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
5714 CResult_OfferBolt12ParseErrorZ {
5715 contents: CResult_OfferBolt12ParseErrorZPtr {
5716 result: Box::into_raw(Box::new(o)),
5722 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
5723 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
5724 CResult_OfferBolt12ParseErrorZ {
5725 contents: CResult_OfferBolt12ParseErrorZPtr {
5726 err: Box::into_raw(Box::new(e)),
5731 /// Checks if the given object is currently in the success state
5733 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
5737 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
5738 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
5739 impl Drop for CResult_OfferBolt12ParseErrorZ {
5740 fn drop(&mut self) {
5742 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5743 let _ = unsafe { Box::from_raw(self.contents.result) };
5746 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5747 let _ = unsafe { Box::from_raw(self.contents.err) };
5752 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
5753 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
5754 let contents = if o.result_ok {
5755 let result = unsafe { o.contents.result };
5756 unsafe { o.contents.result = core::ptr::null_mut() };
5757 CResult_OfferBolt12ParseErrorZPtr { result }
5759 let err = unsafe { o.contents.err };
5760 unsafe { o.contents.err = core::ptr::null_mut(); }
5761 CResult_OfferBolt12ParseErrorZPtr { err }
5765 result_ok: o.result_ok,
5769 impl Clone for CResult_OfferBolt12ParseErrorZ {
5770 fn clone(&self) -> Self {
5772 Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
5773 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
5776 Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
5777 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
5783 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
5784 /// but with all dynamically-allocated buffers duplicated in new buffers.
5785 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
5787 /// The contents of CResult_PublicKeyErrorZ
5788 pub union CResult_PublicKeyErrorZPtr {
5789 /// A pointer to the contents in the success state.
5790 /// Reading from this pointer when `result_ok` is not set is undefined.
5791 pub result: *mut crate::c_types::PublicKey,
5792 /// A pointer to the contents in the error state.
5793 /// Reading from this pointer when `result_ok` is set is undefined.
5794 pub err: *mut crate::c_types::Secp256k1Error,
5797 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
5798 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
5799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5800 pub struct CResult_PublicKeyErrorZ {
5801 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
5802 /// `err` or `result` depending on the state of `result_ok`.
5803 pub contents: CResult_PublicKeyErrorZPtr,
5804 /// Whether this CResult_PublicKeyErrorZ represents a success state.
5805 pub result_ok: bool,
5808 /// Creates a new CResult_PublicKeyErrorZ in the success state.
5809 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
5810 CResult_PublicKeyErrorZ {
5811 contents: CResult_PublicKeyErrorZPtr {
5812 result: Box::into_raw(Box::new(o)),
5818 /// Creates a new CResult_PublicKeyErrorZ in the error state.
5819 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
5820 CResult_PublicKeyErrorZ {
5821 contents: CResult_PublicKeyErrorZPtr {
5822 err: Box::into_raw(Box::new(e)),
5827 /// Checks if the given object is currently in the success state
5829 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
5833 /// Frees any resources used by the CResult_PublicKeyErrorZ.
5834 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
5835 impl Drop for CResult_PublicKeyErrorZ {
5836 fn drop(&mut self) {
5838 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5839 let _ = unsafe { Box::from_raw(self.contents.result) };
5842 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5843 let _ = unsafe { Box::from_raw(self.contents.err) };
5848 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
5849 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
5850 let contents = if o.result_ok {
5851 let result = unsafe { o.contents.result };
5852 unsafe { o.contents.result = core::ptr::null_mut() };
5853 CResult_PublicKeyErrorZPtr { result }
5855 let err = unsafe { o.contents.err };
5856 unsafe { o.contents.err = core::ptr::null_mut(); }
5857 CResult_PublicKeyErrorZPtr { err }
5861 result_ok: o.result_ok,
5865 impl Clone for CResult_PublicKeyErrorZ {
5866 fn clone(&self) -> Self {
5868 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
5869 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
5872 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
5873 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5879 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
5880 /// but with all dynamically-allocated buffers duplicated in new buffers.
5881 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
5883 /// The contents of CResult_NodeIdDecodeErrorZ
5884 pub union CResult_NodeIdDecodeErrorZPtr {
5885 /// A pointer to the contents in the success state.
5886 /// Reading from this pointer when `result_ok` is not set is undefined.
5887 pub result: *mut crate::lightning::routing::gossip::NodeId,
5888 /// A pointer to the contents in the error state.
5889 /// Reading from this pointer when `result_ok` is set is undefined.
5890 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5893 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5894 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5896 pub struct CResult_NodeIdDecodeErrorZ {
5897 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5898 /// `err` or `result` depending on the state of `result_ok`.
5899 pub contents: CResult_NodeIdDecodeErrorZPtr,
5900 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5901 pub result_ok: bool,
5904 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
5905 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
5906 CResult_NodeIdDecodeErrorZ {
5907 contents: CResult_NodeIdDecodeErrorZPtr {
5908 result: Box::into_raw(Box::new(o)),
5914 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
5915 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
5916 CResult_NodeIdDecodeErrorZ {
5917 contents: CResult_NodeIdDecodeErrorZPtr {
5918 err: Box::into_raw(Box::new(e)),
5923 /// Checks if the given object is currently in the success state
5925 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5929 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5930 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5931 impl Drop for CResult_NodeIdDecodeErrorZ {
5932 fn drop(&mut self) {
5934 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5935 let _ = unsafe { Box::from_raw(self.contents.result) };
5938 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5939 let _ = unsafe { Box::from_raw(self.contents.err) };
5944 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
5945 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
5946 let contents = if o.result_ok {
5947 let result = unsafe { o.contents.result };
5948 unsafe { o.contents.result = core::ptr::null_mut() };
5949 CResult_NodeIdDecodeErrorZPtr { result }
5951 let err = unsafe { o.contents.err };
5952 unsafe { o.contents.err = core::ptr::null_mut(); }
5953 CResult_NodeIdDecodeErrorZPtr { err }
5957 result_ok: o.result_ok,
5961 impl Clone for CResult_NodeIdDecodeErrorZ {
5962 fn clone(&self) -> Self {
5964 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
5965 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
5968 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
5969 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5975 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
5976 /// but with all dynamically-allocated buffers duplicated in new buffers.
5977 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
5980 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
5981 pub enum COption_NetworkUpdateZ {
5982 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
5983 Some(crate::lightning::routing::gossip::NetworkUpdate),
5984 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
5987 impl COption_NetworkUpdateZ {
5988 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5989 if let Self::None = self { false } else { true }
5991 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5994 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
5995 if let Self::Some(v) = self { v } else { unreachable!() }
5999 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
6000 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
6001 COption_NetworkUpdateZ::Some(o)
6004 /// Constructs a new COption_NetworkUpdateZ containing nothing
6005 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
6006 COption_NetworkUpdateZ::None
6009 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
6010 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
6012 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
6013 /// but with all dynamically-allocated buffers duplicated in new buffers.
6014 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
6016 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6017 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6018 /// A pointer to the contents in the success state.
6019 /// Reading from this pointer when `result_ok` is not set is undefined.
6020 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
6021 /// A pointer to the contents in the error state.
6022 /// Reading from this pointer when `result_ok` is set is undefined.
6023 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6026 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6027 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6028 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6029 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
6030 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6031 /// `err` or `result` depending on the state of `result_ok`.
6032 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
6033 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6034 pub result_ok: bool,
6037 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
6038 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6039 CResult_COption_NetworkUpdateZDecodeErrorZ {
6040 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6041 result: Box::into_raw(Box::new(o)),
6047 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
6048 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6049 CResult_COption_NetworkUpdateZDecodeErrorZ {
6050 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6051 err: Box::into_raw(Box::new(e)),
6056 /// Checks if the given object is currently in the success state
6058 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
6062 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
6063 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
6064 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
6065 fn drop(&mut self) {
6067 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6068 let _ = unsafe { Box::from_raw(self.contents.result) };
6071 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6072 let _ = unsafe { Box::from_raw(self.contents.err) };
6077 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
6078 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6079 let contents = if o.result_ok {
6080 let result = unsafe { o.contents.result };
6081 unsafe { o.contents.result = core::ptr::null_mut() };
6082 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
6084 let err = unsafe { o.contents.err };
6085 unsafe { o.contents.err = core::ptr::null_mut(); }
6086 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
6090 result_ok: o.result_ok,
6094 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
6095 fn clone(&self) -> Self {
6097 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6098 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
6101 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6102 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6108 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
6109 /// but with all dynamically-allocated buffers duplicated in new buffers.
6110 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
6112 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6113 pub enum COption_UtxoLookupZ {
6114 /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6115 Some(crate::lightning::routing::utxo::UtxoLookup),
6116 /// When we're in this state, this COption_UtxoLookupZ contains nothing
6119 impl COption_UtxoLookupZ {
6120 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6121 if let Self::None = self { false } else { true }
6123 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6126 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
6127 if let Self::Some(v) = self { v } else { unreachable!() }
6131 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
6132 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
6133 COption_UtxoLookupZ::Some(o)
6136 /// Constructs a new COption_UtxoLookupZ containing nothing
6137 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
6138 COption_UtxoLookupZ::None
6141 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
6142 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
6144 /// The contents of CResult_NoneLightningErrorZ
6145 pub union CResult_NoneLightningErrorZPtr {
6146 /// Note that this value is always NULL, as there are no contents in the OK variant
6147 pub result: *mut core::ffi::c_void,
6148 /// A pointer to the contents in the error state.
6149 /// Reading from this pointer when `result_ok` is set is undefined.
6150 pub err: *mut crate::lightning::ln::msgs::LightningError,
6153 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6154 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6156 pub struct CResult_NoneLightningErrorZ {
6157 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6158 /// `err` or `result` depending on the state of `result_ok`.
6159 pub contents: CResult_NoneLightningErrorZPtr,
6160 /// Whether this CResult_NoneLightningErrorZ represents a success state.
6161 pub result_ok: bool,
6164 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6165 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6166 CResult_NoneLightningErrorZ {
6167 contents: CResult_NoneLightningErrorZPtr {
6168 result: core::ptr::null_mut(),
6174 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6175 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6176 CResult_NoneLightningErrorZ {
6177 contents: CResult_NoneLightningErrorZPtr {
6178 err: Box::into_raw(Box::new(e)),
6183 /// Checks if the given object is currently in the success state
6185 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
6189 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6190 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6191 impl Drop for CResult_NoneLightningErrorZ {
6192 fn drop(&mut self) {
6195 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6196 let _ = unsafe { Box::from_raw(self.contents.err) };
6201 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6202 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6203 let contents = if o.result_ok {
6204 let _ = unsafe { Box::from_raw(o.contents.result) };
6205 o.contents.result = core::ptr::null_mut();
6206 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
6208 let err = unsafe { o.contents.err };
6209 unsafe { o.contents.err = core::ptr::null_mut(); }
6210 CResult_NoneLightningErrorZPtr { err }
6214 result_ok: o.result_ok,
6218 impl Clone for CResult_NoneLightningErrorZ {
6219 fn clone(&self) -> Self {
6221 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6222 result: core::ptr::null_mut()
6225 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6226 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6232 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6233 /// but with all dynamically-allocated buffers duplicated in new buffers.
6234 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
6236 /// The contents of CResult_boolLightningErrorZ
6237 pub union CResult_boolLightningErrorZPtr {
6238 /// A pointer to the contents in the success state.
6239 /// Reading from this pointer when `result_ok` is not set is undefined.
6240 pub result: *mut bool,
6241 /// A pointer to the contents in the error state.
6242 /// Reading from this pointer when `result_ok` is set is undefined.
6243 pub err: *mut crate::lightning::ln::msgs::LightningError,
6246 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6247 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6249 pub struct CResult_boolLightningErrorZ {
6250 /// The contents of this CResult_boolLightningErrorZ, accessible via either
6251 /// `err` or `result` depending on the state of `result_ok`.
6252 pub contents: CResult_boolLightningErrorZPtr,
6253 /// Whether this CResult_boolLightningErrorZ represents a success state.
6254 pub result_ok: bool,
6257 /// Creates a new CResult_boolLightningErrorZ in the success state.
6258 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6259 CResult_boolLightningErrorZ {
6260 contents: CResult_boolLightningErrorZPtr {
6261 result: Box::into_raw(Box::new(o)),
6267 /// Creates a new CResult_boolLightningErrorZ in the error state.
6268 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6269 CResult_boolLightningErrorZ {
6270 contents: CResult_boolLightningErrorZPtr {
6271 err: Box::into_raw(Box::new(e)),
6276 /// Checks if the given object is currently in the success state
6278 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
6282 /// Frees any resources used by the CResult_boolLightningErrorZ.
6283 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6284 impl Drop for CResult_boolLightningErrorZ {
6285 fn drop(&mut self) {
6287 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6288 let _ = unsafe { Box::from_raw(self.contents.result) };
6291 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6292 let _ = unsafe { Box::from_raw(self.contents.err) };
6297 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6298 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6299 let contents = if o.result_ok {
6300 let result = unsafe { o.contents.result };
6301 unsafe { o.contents.result = core::ptr::null_mut() };
6302 CResult_boolLightningErrorZPtr { result }
6304 let err = unsafe { o.contents.err };
6305 unsafe { o.contents.err = core::ptr::null_mut(); }
6306 CResult_boolLightningErrorZPtr { err }
6310 result_ok: o.result_ok,
6314 impl Clone for CResult_boolLightningErrorZ {
6315 fn clone(&self) -> Self {
6317 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6318 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6321 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6322 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6328 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6329 /// but with all dynamically-allocated buffers duplicated in new buffers.
6330 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
6332 /// A tuple of 3 elements. See the individual fields for the types contained.
6333 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6334 /// The element at position 0
6335 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6336 /// The element at position 1
6337 pub b: crate::lightning::ln::msgs::ChannelUpdate,
6338 /// The element at position 2
6339 pub c: crate::lightning::ln::msgs::ChannelUpdate,
6341 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6342 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6350 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6351 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6352 (self.a, self.b, self.c)
6355 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6356 fn clone(&self) -> Self {
6358 a: Clone::clone(&self.a),
6359 b: Clone::clone(&self.b),
6360 c: Clone::clone(&self.c),
6365 /// Creates a new tuple which has the same data as `orig`
6366 /// but with all dynamically-allocated buffers duplicated in new buffers.
6367 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
6368 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6370 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 {
6371 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6375 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6376 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6379 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
6380 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6381 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6382 Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
6383 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
6386 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6387 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6388 if let Self::None = self { false } else { true }
6390 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6393 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6394 if let Self::Some(v) = self { v } else { unreachable!() }
6398 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6399 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6400 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
6403 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
6404 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6405 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
6408 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
6409 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6411 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
6412 /// but with all dynamically-allocated buffers duplicated in new buffers.
6413 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
6415 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
6416 /// This corresponds to std::vector in C++
6417 pub struct CVec_MessageSendEventZ {
6418 /// The elements in the array.
6419 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6420 pub data: *mut crate::lightning::events::MessageSendEvent,
6421 /// The number of elements pointed to by `data`.
6424 impl CVec_MessageSendEventZ {
6425 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
6426 if self.datalen == 0 { return Vec::new(); }
6427 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6428 self.data = core::ptr::null_mut();
6432 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
6433 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6436 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
6437 fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
6438 let datalen = v.len();
6439 let data = Box::into_raw(v.into_boxed_slice());
6440 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6444 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6445 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
6446 impl Drop for CVec_MessageSendEventZ {
6447 fn drop(&mut self) {
6448 if self.datalen == 0 { return; }
6449 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6452 impl Clone for CVec_MessageSendEventZ {
6453 fn clone(&self) -> Self {
6454 let mut res = Vec::new();
6455 if self.datalen == 0 { return Self::from(res); }
6456 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6461 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
6462 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
6463 /// A pointer to the contents in the success state.
6464 /// Reading from this pointer when `result_ok` is not set is undefined.
6465 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
6466 /// A pointer to the contents in the error state.
6467 /// Reading from this pointer when `result_ok` is set is undefined.
6468 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6471 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
6472 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6474 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
6475 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
6476 /// `err` or `result` depending on the state of `result_ok`.
6477 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
6478 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
6479 pub result_ok: bool,
6482 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
6483 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6484 CResult_ChannelUpdateInfoDecodeErrorZ {
6485 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6486 result: Box::into_raw(Box::new(o)),
6492 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
6493 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6494 CResult_ChannelUpdateInfoDecodeErrorZ {
6495 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6496 err: Box::into_raw(Box::new(e)),
6501 /// Checks if the given object is currently in the success state
6503 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
6507 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
6508 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
6509 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
6510 fn drop(&mut self) {
6512 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6513 let _ = unsafe { Box::from_raw(self.contents.result) };
6516 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6517 let _ = unsafe { Box::from_raw(self.contents.err) };
6522 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
6523 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6524 let contents = if o.result_ok {
6525 let result = unsafe { o.contents.result };
6526 unsafe { o.contents.result = core::ptr::null_mut() };
6527 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
6529 let err = unsafe { o.contents.err };
6530 unsafe { o.contents.err = core::ptr::null_mut(); }
6531 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
6535 result_ok: o.result_ok,
6539 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
6540 fn clone(&self) -> Self {
6542 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6543 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
6546 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6547 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6553 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
6554 /// but with all dynamically-allocated buffers duplicated in new buffers.
6555 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
6557 /// The contents of CResult_ChannelInfoDecodeErrorZ
6558 pub union CResult_ChannelInfoDecodeErrorZPtr {
6559 /// A pointer to the contents in the success state.
6560 /// Reading from this pointer when `result_ok` is not set is undefined.
6561 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
6562 /// A pointer to the contents in the error state.
6563 /// Reading from this pointer when `result_ok` is set is undefined.
6564 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6567 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6568 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6569 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6570 pub struct CResult_ChannelInfoDecodeErrorZ {
6571 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6572 /// `err` or `result` depending on the state of `result_ok`.
6573 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
6574 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6575 pub result_ok: bool,
6578 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
6579 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
6580 CResult_ChannelInfoDecodeErrorZ {
6581 contents: CResult_ChannelInfoDecodeErrorZPtr {
6582 result: Box::into_raw(Box::new(o)),
6588 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
6589 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
6590 CResult_ChannelInfoDecodeErrorZ {
6591 contents: CResult_ChannelInfoDecodeErrorZPtr {
6592 err: Box::into_raw(Box::new(e)),
6597 /// Checks if the given object is currently in the success state
6599 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
6603 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
6604 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
6605 impl Drop for CResult_ChannelInfoDecodeErrorZ {
6606 fn drop(&mut self) {
6608 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6609 let _ = unsafe { Box::from_raw(self.contents.result) };
6612 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6613 let _ = unsafe { Box::from_raw(self.contents.err) };
6618 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
6619 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6620 let contents = if o.result_ok {
6621 let result = unsafe { o.contents.result };
6622 unsafe { o.contents.result = core::ptr::null_mut() };
6623 CResult_ChannelInfoDecodeErrorZPtr { result }
6625 let err = unsafe { o.contents.err };
6626 unsafe { o.contents.err = core::ptr::null_mut(); }
6627 CResult_ChannelInfoDecodeErrorZPtr { err }
6631 result_ok: o.result_ok,
6635 impl Clone for CResult_ChannelInfoDecodeErrorZ {
6636 fn clone(&self) -> Self {
6638 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
6639 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
6642 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
6643 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6649 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
6650 /// but with all dynamically-allocated buffers duplicated in new buffers.
6651 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
6653 /// The contents of CResult_RoutingFeesDecodeErrorZ
6654 pub union CResult_RoutingFeesDecodeErrorZPtr {
6655 /// A pointer to the contents in the success state.
6656 /// Reading from this pointer when `result_ok` is not set is undefined.
6657 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
6658 /// A pointer to the contents in the error state.
6659 /// Reading from this pointer when `result_ok` is set is undefined.
6660 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6663 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6664 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6665 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6666 pub struct CResult_RoutingFeesDecodeErrorZ {
6667 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6668 /// `err` or `result` depending on the state of `result_ok`.
6669 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
6670 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6671 pub result_ok: bool,
6674 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
6675 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
6676 CResult_RoutingFeesDecodeErrorZ {
6677 contents: CResult_RoutingFeesDecodeErrorZPtr {
6678 result: Box::into_raw(Box::new(o)),
6684 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
6685 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
6686 CResult_RoutingFeesDecodeErrorZ {
6687 contents: CResult_RoutingFeesDecodeErrorZPtr {
6688 err: Box::into_raw(Box::new(e)),
6693 /// Checks if the given object is currently in the success state
6695 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
6699 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
6700 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
6701 impl Drop for CResult_RoutingFeesDecodeErrorZ {
6702 fn drop(&mut self) {
6704 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6705 let _ = unsafe { Box::from_raw(self.contents.result) };
6708 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6709 let _ = unsafe { Box::from_raw(self.contents.err) };
6714 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
6715 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
6716 let contents = if o.result_ok {
6717 let result = unsafe { o.contents.result };
6718 unsafe { o.contents.result = core::ptr::null_mut() };
6719 CResult_RoutingFeesDecodeErrorZPtr { result }
6721 let err = unsafe { o.contents.err };
6722 unsafe { o.contents.err = core::ptr::null_mut(); }
6723 CResult_RoutingFeesDecodeErrorZPtr { err }
6727 result_ok: o.result_ok,
6731 impl Clone for CResult_RoutingFeesDecodeErrorZ {
6732 fn clone(&self) -> Self {
6734 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
6735 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
6738 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
6739 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6745 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
6746 /// but with all dynamically-allocated buffers duplicated in new buffers.
6747 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
6749 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6750 /// This corresponds to std::vector in C++
6751 pub struct CVec_NetAddressZ {
6752 /// The elements in the array.
6753 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6754 pub data: *mut crate::lightning::ln::msgs::NetAddress,
6755 /// The number of elements pointed to by `data`.
6758 impl CVec_NetAddressZ {
6759 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6760 if self.datalen == 0 { return Vec::new(); }
6761 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6762 self.data = core::ptr::null_mut();
6766 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6767 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6770 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6771 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6772 let datalen = v.len();
6773 let data = Box::into_raw(v.into_boxed_slice());
6774 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6778 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6779 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6780 impl Drop for CVec_NetAddressZ {
6781 fn drop(&mut self) {
6782 if self.datalen == 0 { return; }
6783 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6786 impl Clone for CVec_NetAddressZ {
6787 fn clone(&self) -> Self {
6788 let mut res = Vec::new();
6789 if self.datalen == 0 { return Self::from(res); }
6790 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6795 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6796 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6797 /// A pointer to the contents in the success state.
6798 /// Reading from this pointer when `result_ok` is not set is undefined.
6799 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
6800 /// A pointer to the contents in the error state.
6801 /// Reading from this pointer when `result_ok` is set is undefined.
6802 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6805 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6806 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6807 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6808 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
6809 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6810 /// `err` or `result` depending on the state of `result_ok`.
6811 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
6812 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6813 pub result_ok: bool,
6816 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
6817 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6818 CResult_NodeAnnouncementInfoDecodeErrorZ {
6819 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6820 result: Box::into_raw(Box::new(o)),
6826 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
6827 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6828 CResult_NodeAnnouncementInfoDecodeErrorZ {
6829 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6830 err: Box::into_raw(Box::new(e)),
6835 /// Checks if the given object is currently in the success state
6837 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
6841 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
6842 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
6843 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
6844 fn drop(&mut self) {
6846 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6847 let _ = unsafe { Box::from_raw(self.contents.result) };
6850 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6851 let _ = unsafe { Box::from_raw(self.contents.err) };
6856 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
6857 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6858 let contents = if o.result_ok {
6859 let result = unsafe { o.contents.result };
6860 unsafe { o.contents.result = core::ptr::null_mut() };
6861 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
6863 let err = unsafe { o.contents.err };
6864 unsafe { o.contents.err = core::ptr::null_mut(); }
6865 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
6869 result_ok: o.result_ok,
6873 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
6874 fn clone(&self) -> Self {
6876 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6877 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
6880 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6881 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6887 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
6888 /// but with all dynamically-allocated buffers duplicated in new buffers.
6889 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
6891 /// The contents of CResult_NodeAliasDecodeErrorZ
6892 pub union CResult_NodeAliasDecodeErrorZPtr {
6893 /// A pointer to the contents in the success state.
6894 /// Reading from this pointer when `result_ok` is not set is undefined.
6895 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
6896 /// A pointer to the contents in the error state.
6897 /// Reading from this pointer when `result_ok` is set is undefined.
6898 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6901 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6902 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6903 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6904 pub struct CResult_NodeAliasDecodeErrorZ {
6905 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6906 /// `err` or `result` depending on the state of `result_ok`.
6907 pub contents: CResult_NodeAliasDecodeErrorZPtr,
6908 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6909 pub result_ok: bool,
6912 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
6913 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
6914 CResult_NodeAliasDecodeErrorZ {
6915 contents: CResult_NodeAliasDecodeErrorZPtr {
6916 result: Box::into_raw(Box::new(o)),
6922 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
6923 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
6924 CResult_NodeAliasDecodeErrorZ {
6925 contents: CResult_NodeAliasDecodeErrorZPtr {
6926 err: Box::into_raw(Box::new(e)),
6931 /// Checks if the given object is currently in the success state
6933 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
6937 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
6938 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
6939 impl Drop for CResult_NodeAliasDecodeErrorZ {
6940 fn drop(&mut self) {
6942 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6943 let _ = unsafe { Box::from_raw(self.contents.result) };
6946 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6947 let _ = unsafe { Box::from_raw(self.contents.err) };
6952 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
6953 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
6954 let contents = if o.result_ok {
6955 let result = unsafe { o.contents.result };
6956 unsafe { o.contents.result = core::ptr::null_mut() };
6957 CResult_NodeAliasDecodeErrorZPtr { result }
6959 let err = unsafe { o.contents.err };
6960 unsafe { o.contents.err = core::ptr::null_mut(); }
6961 CResult_NodeAliasDecodeErrorZPtr { err }
6965 result_ok: o.result_ok,
6969 impl Clone for CResult_NodeAliasDecodeErrorZ {
6970 fn clone(&self) -> Self {
6972 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
6973 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
6976 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
6977 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6983 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
6984 /// but with all dynamically-allocated buffers duplicated in new buffers.
6985 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
6987 /// The contents of CResult_NodeInfoDecodeErrorZ
6988 pub union CResult_NodeInfoDecodeErrorZPtr {
6989 /// A pointer to the contents in the success state.
6990 /// Reading from this pointer when `result_ok` is not set is undefined.
6991 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
6992 /// A pointer to the contents in the error state.
6993 /// Reading from this pointer when `result_ok` is set is undefined.
6994 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6997 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6998 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6999 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7000 pub struct CResult_NodeInfoDecodeErrorZ {
7001 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7002 /// `err` or `result` depending on the state of `result_ok`.
7003 pub contents: CResult_NodeInfoDecodeErrorZPtr,
7004 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7005 pub result_ok: bool,
7008 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
7009 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
7010 CResult_NodeInfoDecodeErrorZ {
7011 contents: CResult_NodeInfoDecodeErrorZPtr {
7012 result: Box::into_raw(Box::new(o)),
7018 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
7019 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
7020 CResult_NodeInfoDecodeErrorZ {
7021 contents: CResult_NodeInfoDecodeErrorZPtr {
7022 err: Box::into_raw(Box::new(e)),
7027 /// Checks if the given object is currently in the success state
7029 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
7033 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7034 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7035 impl Drop for CResult_NodeInfoDecodeErrorZ {
7036 fn drop(&mut self) {
7038 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7039 let _ = unsafe { Box::from_raw(self.contents.result) };
7042 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7043 let _ = unsafe { Box::from_raw(self.contents.err) };
7048 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7049 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7050 let contents = if o.result_ok {
7051 let result = unsafe { o.contents.result };
7052 unsafe { o.contents.result = core::ptr::null_mut() };
7053 CResult_NodeInfoDecodeErrorZPtr { result }
7055 let err = unsafe { o.contents.err };
7056 unsafe { o.contents.err = core::ptr::null_mut(); }
7057 CResult_NodeInfoDecodeErrorZPtr { err }
7061 result_ok: o.result_ok,
7065 impl Clone for CResult_NodeInfoDecodeErrorZ {
7066 fn clone(&self) -> Self {
7068 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7069 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
7072 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7073 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7079 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7080 /// but with all dynamically-allocated buffers duplicated in new buffers.
7081 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
7083 /// The contents of CResult_NetworkGraphDecodeErrorZ
7084 pub union CResult_NetworkGraphDecodeErrorZPtr {
7085 /// A pointer to the contents in the success state.
7086 /// Reading from this pointer when `result_ok` is not set is undefined.
7087 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
7088 /// A pointer to the contents in the error state.
7089 /// Reading from this pointer when `result_ok` is set is undefined.
7090 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7093 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7094 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7096 pub struct CResult_NetworkGraphDecodeErrorZ {
7097 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7098 /// `err` or `result` depending on the state of `result_ok`.
7099 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7100 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7101 pub result_ok: bool,
7104 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7105 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7106 CResult_NetworkGraphDecodeErrorZ {
7107 contents: CResult_NetworkGraphDecodeErrorZPtr {
7108 result: Box::into_raw(Box::new(o)),
7114 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7115 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7116 CResult_NetworkGraphDecodeErrorZ {
7117 contents: CResult_NetworkGraphDecodeErrorZPtr {
7118 err: Box::into_raw(Box::new(e)),
7123 /// Checks if the given object is currently in the success state
7125 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
7129 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7130 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7131 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7132 fn drop(&mut self) {
7134 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7135 let _ = unsafe { Box::from_raw(self.contents.result) };
7138 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7139 let _ = unsafe { Box::from_raw(self.contents.err) };
7144 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7145 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7146 let contents = if o.result_ok {
7147 let result = unsafe { o.contents.result };
7148 unsafe { o.contents.result = core::ptr::null_mut() };
7149 CResult_NetworkGraphDecodeErrorZPtr { result }
7151 let err = unsafe { o.contents.err };
7152 unsafe { o.contents.err = core::ptr::null_mut(); }
7153 CResult_NetworkGraphDecodeErrorZPtr { err }
7157 result_ok: o.result_ok,
7163 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
7164 pub enum COption_CVec_NetAddressZZ {
7165 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
7166 Some(crate::c_types::derived::CVec_NetAddressZ),
7167 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
7170 impl COption_CVec_NetAddressZZ {
7171 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7172 if let Self::None = self { false } else { true }
7174 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7177 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
7178 if let Self::Some(v) = self { v } else { unreachable!() }
7182 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
7183 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
7184 COption_CVec_NetAddressZZ::Some(o)
7187 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
7188 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
7189 COption_CVec_NetAddressZZ::None
7192 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
7193 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
7195 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
7196 /// but with all dynamically-allocated buffers duplicated in new buffers.
7197 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
7200 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
7201 pub enum COption_PaymentPreimageZ {
7202 /// When we're in this state, this COption_PaymentPreimageZ contains a crate::c_types::ThirtyTwoBytes
7203 Some(crate::c_types::ThirtyTwoBytes),
7204 /// When we're in this state, this COption_PaymentPreimageZ contains nothing
7207 impl COption_PaymentPreimageZ {
7208 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7209 if let Self::None = self { false } else { true }
7211 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7214 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
7215 if let Self::Some(v) = self { v } else { unreachable!() }
7219 /// Constructs a new COption_PaymentPreimageZ containing a crate::c_types::ThirtyTwoBytes
7220 pub extern "C" fn COption_PaymentPreimageZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentPreimageZ {
7221 COption_PaymentPreimageZ::Some(o)
7224 /// Constructs a new COption_PaymentPreimageZ containing nothing
7225 pub extern "C" fn COption_PaymentPreimageZ_none() -> COption_PaymentPreimageZ {
7226 COption_PaymentPreimageZ::None
7229 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
7230 pub extern "C" fn COption_PaymentPreimageZ_free(_res: COption_PaymentPreimageZ) { }
7232 /// Creates a new COption_PaymentPreimageZ which has the same data as `orig`
7233 /// but with all dynamically-allocated buffers duplicated in new buffers.
7234 pub extern "C" fn COption_PaymentPreimageZ_clone(orig: &COption_PaymentPreimageZ) -> COption_PaymentPreimageZ { Clone::clone(&orig) }
7236 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
7237 /// This corresponds to std::vector in C++
7238 pub struct CVec_HTLCOutputInCommitmentZ {
7239 /// The elements in the array.
7240 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7241 pub data: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
7242 /// The number of elements pointed to by `data`.
7245 impl CVec_HTLCOutputInCommitmentZ {
7246 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment> {
7247 if self.datalen == 0 { return Vec::new(); }
7248 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7249 self.data = core::ptr::null_mut();
7253 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::HTLCOutputInCommitment] {
7254 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7257 impl From<Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>> for CVec_HTLCOutputInCommitmentZ {
7258 fn from(v: Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>) -> Self {
7259 let datalen = v.len();
7260 let data = Box::into_raw(v.into_boxed_slice());
7261 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7265 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7266 pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { }
7267 impl Drop for CVec_HTLCOutputInCommitmentZ {
7268 fn drop(&mut self) {
7269 if self.datalen == 0 { return; }
7270 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7273 impl Clone for CVec_HTLCOutputInCommitmentZ {
7274 fn clone(&self) -> Self {
7275 let mut res = Vec::new();
7276 if self.datalen == 0 { return Self::from(res); }
7277 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7282 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::HTLCDescriptors of arbitrary size.
7283 /// This corresponds to std::vector in C++
7284 pub struct CVec_HTLCDescriptorZ {
7285 /// The elements in the array.
7286 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7287 pub data: *mut crate::lightning::events::bump_transaction::HTLCDescriptor,
7288 /// The number of elements pointed to by `data`.
7291 impl CVec_HTLCDescriptorZ {
7292 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::HTLCDescriptor> {
7293 if self.datalen == 0 { return Vec::new(); }
7294 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7295 self.data = core::ptr::null_mut();
7299 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::HTLCDescriptor] {
7300 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7303 impl From<Vec<crate::lightning::events::bump_transaction::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
7304 fn from(v: Vec<crate::lightning::events::bump_transaction::HTLCDescriptor>) -> Self {
7305 let datalen = v.len();
7306 let data = Box::into_raw(v.into_boxed_slice());
7307 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7311 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7312 pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { }
7313 impl Drop for CVec_HTLCDescriptorZ {
7314 fn drop(&mut self) {
7315 if self.datalen == 0 { return; }
7316 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7319 impl Clone for CVec_HTLCDescriptorZ {
7320 fn clone(&self) -> Self {
7321 let mut res = Vec::new();
7322 if self.datalen == 0 { return Self::from(res); }
7323 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7328 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
7329 /// This corresponds to std::vector in C++
7330 pub struct CVec_UtxoZ {
7331 /// The elements in the array.
7332 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7333 pub data: *mut crate::lightning::events::bump_transaction::Utxo,
7334 /// The number of elements pointed to by `data`.
7338 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Utxo> {
7339 if self.datalen == 0 { return Vec::new(); }
7340 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7341 self.data = core::ptr::null_mut();
7345 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Utxo] {
7346 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7349 impl From<Vec<crate::lightning::events::bump_transaction::Utxo>> for CVec_UtxoZ {
7350 fn from(v: Vec<crate::lightning::events::bump_transaction::Utxo>) -> Self {
7351 let datalen = v.len();
7352 let data = Box::into_raw(v.into_boxed_slice());
7353 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7357 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7358 pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { }
7359 impl Drop for CVec_UtxoZ {
7360 fn drop(&mut self) {
7361 if self.datalen == 0 { return; }
7362 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7365 impl Clone for CVec_UtxoZ {
7366 fn clone(&self) -> Self {
7367 let mut res = Vec::new();
7368 if self.datalen == 0 { return Self::from(res); }
7369 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7375 /// An enum which can either contain a crate::c_types::TxOut or not
7376 pub enum COption_TxOutZ {
7377 /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
7378 Some(crate::c_types::TxOut),
7379 /// When we're in this state, this COption_TxOutZ contains nothing
7382 impl COption_TxOutZ {
7383 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7384 if let Self::None = self { false } else { true }
7386 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7389 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut {
7390 if let Self::Some(v) = self { v } else { unreachable!() }
7394 /// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
7395 pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ {
7396 COption_TxOutZ::Some(o)
7399 /// Constructs a new COption_TxOutZ containing nothing
7400 pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ {
7401 COption_TxOutZ::None
7404 /// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
7405 pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { }
7407 /// Creates a new COption_TxOutZ which has the same data as `orig`
7408 /// but with all dynamically-allocated buffers duplicated in new buffers.
7409 pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) }
7411 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
7412 /// This corresponds to std::vector in C++
7413 pub struct CVec_InputZ {
7414 /// The elements in the array.
7415 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7416 pub data: *mut crate::lightning::events::bump_transaction::Input,
7417 /// The number of elements pointed to by `data`.
7421 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Input> {
7422 if self.datalen == 0 { return Vec::new(); }
7423 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7424 self.data = core::ptr::null_mut();
7428 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Input] {
7429 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7432 impl From<Vec<crate::lightning::events::bump_transaction::Input>> for CVec_InputZ {
7433 fn from(v: Vec<crate::lightning::events::bump_transaction::Input>) -> Self {
7434 let datalen = v.len();
7435 let data = Box::into_raw(v.into_boxed_slice());
7436 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7440 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7441 pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { }
7442 impl Drop for CVec_InputZ {
7443 fn drop(&mut self) {
7444 if self.datalen == 0 { return; }
7445 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7448 impl Clone for CVec_InputZ {
7449 fn clone(&self) -> Self {
7450 let mut res = Vec::new();
7451 if self.datalen == 0 { return Self::from(res); }
7452 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7457 /// The contents of CResult_CoinSelectionNoneZ
7458 pub union CResult_CoinSelectionNoneZPtr {
7459 /// A pointer to the contents in the success state.
7460 /// Reading from this pointer when `result_ok` is not set is undefined.
7461 pub result: *mut crate::lightning::events::bump_transaction::CoinSelection,
7462 /// Note that this value is always NULL, as there are no contents in the Err variant
7463 pub err: *mut core::ffi::c_void,
7466 /// A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
7467 /// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
7468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7469 pub struct CResult_CoinSelectionNoneZ {
7470 /// The contents of this CResult_CoinSelectionNoneZ, accessible via either
7471 /// `err` or `result` depending on the state of `result_ok`.
7472 pub contents: CResult_CoinSelectionNoneZPtr,
7473 /// Whether this CResult_CoinSelectionNoneZ represents a success state.
7474 pub result_ok: bool,
7477 /// Creates a new CResult_CoinSelectionNoneZ in the success state.
7478 pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ {
7479 CResult_CoinSelectionNoneZ {
7480 contents: CResult_CoinSelectionNoneZPtr {
7481 result: Box::into_raw(Box::new(o)),
7487 /// Creates a new CResult_CoinSelectionNoneZ in the error state.
7488 pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ {
7489 CResult_CoinSelectionNoneZ {
7490 contents: CResult_CoinSelectionNoneZPtr {
7491 err: core::ptr::null_mut(),
7496 /// Checks if the given object is currently in the success state
7498 pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool {
7502 /// Frees any resources used by the CResult_CoinSelectionNoneZ.
7503 pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { }
7504 impl Drop for CResult_CoinSelectionNoneZ {
7505 fn drop(&mut self) {
7507 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7508 let _ = unsafe { Box::from_raw(self.contents.result) };
7514 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>> for CResult_CoinSelectionNoneZ {
7515 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>) -> Self {
7516 let contents = if o.result_ok {
7517 let result = unsafe { o.contents.result };
7518 unsafe { o.contents.result = core::ptr::null_mut() };
7519 CResult_CoinSelectionNoneZPtr { result }
7521 let _ = unsafe { Box::from_raw(o.contents.err) };
7522 o.contents.err = core::ptr::null_mut();
7523 CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() }
7527 result_ok: o.result_ok,
7531 impl Clone for CResult_CoinSelectionNoneZ {
7532 fn clone(&self) -> Self {
7534 Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr {
7535 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::CoinSelection>::clone(unsafe { &*self.contents.result })))
7538 Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr {
7539 err: core::ptr::null_mut()
7545 /// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
7546 /// but with all dynamically-allocated buffers duplicated in new buffers.
7547 pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) }
7549 /// The contents of CResult_CVec_UtxoZNoneZ
7550 pub union CResult_CVec_UtxoZNoneZPtr {
7551 /// A pointer to the contents in the success state.
7552 /// Reading from this pointer when `result_ok` is not set is undefined.
7553 pub result: *mut crate::c_types::derived::CVec_UtxoZ,
7554 /// Note that this value is always NULL, as there are no contents in the Err variant
7555 pub err: *mut core::ffi::c_void,
7558 /// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
7559 /// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
7560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7561 pub struct CResult_CVec_UtxoZNoneZ {
7562 /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
7563 /// `err` or `result` depending on the state of `result_ok`.
7564 pub contents: CResult_CVec_UtxoZNoneZPtr,
7565 /// Whether this CResult_CVec_UtxoZNoneZ represents a success state.
7566 pub result_ok: bool,
7569 /// Creates a new CResult_CVec_UtxoZNoneZ in the success state.
7570 pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ {
7571 CResult_CVec_UtxoZNoneZ {
7572 contents: CResult_CVec_UtxoZNoneZPtr {
7573 result: Box::into_raw(Box::new(o)),
7579 /// Creates a new CResult_CVec_UtxoZNoneZ in the error state.
7580 pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ {
7581 CResult_CVec_UtxoZNoneZ {
7582 contents: CResult_CVec_UtxoZNoneZPtr {
7583 err: core::ptr::null_mut(),
7588 /// Checks if the given object is currently in the success state
7590 pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool {
7594 /// Frees any resources used by the CResult_CVec_UtxoZNoneZ.
7595 pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { }
7596 impl Drop for CResult_CVec_UtxoZNoneZ {
7597 fn drop(&mut self) {
7599 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7600 let _ = unsafe { Box::from_raw(self.contents.result) };
7606 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>> for CResult_CVec_UtxoZNoneZ {
7607 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>) -> Self {
7608 let contents = if o.result_ok {
7609 let result = unsafe { o.contents.result };
7610 unsafe { o.contents.result = core::ptr::null_mut() };
7611 CResult_CVec_UtxoZNoneZPtr { result }
7613 let _ = unsafe { Box::from_raw(o.contents.err) };
7614 o.contents.err = core::ptr::null_mut();
7615 CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() }
7619 result_ok: o.result_ok,
7623 impl Clone for CResult_CVec_UtxoZNoneZ {
7624 fn clone(&self) -> Self {
7626 Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr {
7627 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_UtxoZ>::clone(unsafe { &*self.contents.result })))
7630 Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr {
7631 err: core::ptr::null_mut()
7637 /// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
7638 /// but with all dynamically-allocated buffers duplicated in new buffers.
7639 pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) }
7642 /// An enum which can either contain a u16 or not
7643 pub enum COption_u16Z {
7644 /// When we're in this state, this COption_u16Z contains a u16
7646 /// When we're in this state, this COption_u16Z contains nothing
7650 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7651 if let Self::None = self { false } else { true }
7653 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7656 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
7657 if let Self::Some(v) = self { v } else { unreachable!() }
7661 /// Constructs a new COption_u16Z containing a u16
7662 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
7663 COption_u16Z::Some(o)
7666 /// Constructs a new COption_u16Z containing nothing
7667 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
7671 /// Frees any resources associated with the u16, if we are in the Some state
7672 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
7674 /// Creates a new COption_u16Z which has the same data as `orig`
7675 /// but with all dynamically-allocated buffers duplicated in new buffers.
7676 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
7679 /// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
7680 pub enum COption_ChannelShutdownStateZ {
7681 /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
7682 Some(crate::lightning::ln::channelmanager::ChannelShutdownState),
7683 /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
7686 impl COption_ChannelShutdownStateZ {
7687 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7688 if let Self::None = self { false } else { true }
7690 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7693 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channelmanager::ChannelShutdownState {
7694 if let Self::Some(v) = self { v } else { unreachable!() }
7698 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
7699 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
7700 COption_ChannelShutdownStateZ::Some(o)
7703 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
7704 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
7705 COption_ChannelShutdownStateZ::None
7708 /// Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
7709 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
7711 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
7712 /// but with all dynamically-allocated buffers duplicated in new buffers.
7713 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
7716 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
7717 pub enum COption_PaymentHashZ {
7718 /// When we're in this state, this COption_PaymentHashZ contains a crate::c_types::ThirtyTwoBytes
7719 Some(crate::c_types::ThirtyTwoBytes),
7720 /// When we're in this state, this COption_PaymentHashZ contains nothing
7723 impl COption_PaymentHashZ {
7724 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7725 if let Self::None = self { false } else { true }
7727 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7730 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
7731 if let Self::Some(v) = self { v } else { unreachable!() }
7735 /// Constructs a new COption_PaymentHashZ containing a crate::c_types::ThirtyTwoBytes
7736 pub extern "C" fn COption_PaymentHashZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentHashZ {
7737 COption_PaymentHashZ::Some(o)
7740 /// Constructs a new COption_PaymentHashZ containing nothing
7741 pub extern "C" fn COption_PaymentHashZ_none() -> COption_PaymentHashZ {
7742 COption_PaymentHashZ::None
7745 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
7746 pub extern "C" fn COption_PaymentHashZ_free(_res: COption_PaymentHashZ) { }
7748 /// Creates a new COption_PaymentHashZ which has the same data as `orig`
7749 /// but with all dynamically-allocated buffers duplicated in new buffers.
7750 pub extern "C" fn COption_PaymentHashZ_clone(orig: &COption_PaymentHashZ) -> COption_PaymentHashZ { Clone::clone(&orig) }
7752 /// The contents of CResult__u832APIErrorZ
7753 pub union CResult__u832APIErrorZPtr {
7754 /// A pointer to the contents in the success state.
7755 /// Reading from this pointer when `result_ok` is not set is undefined.
7756 pub result: *mut crate::c_types::ThirtyTwoBytes,
7757 /// A pointer to the contents in the error state.
7758 /// Reading from this pointer when `result_ok` is set is undefined.
7759 pub err: *mut crate::lightning::util::errors::APIError,
7762 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
7763 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7764 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7765 pub struct CResult__u832APIErrorZ {
7766 /// The contents of this CResult__u832APIErrorZ, accessible via either
7767 /// `err` or `result` depending on the state of `result_ok`.
7768 pub contents: CResult__u832APIErrorZPtr,
7769 /// Whether this CResult__u832APIErrorZ represents a success state.
7770 pub result_ok: bool,
7773 /// Creates a new CResult__u832APIErrorZ in the success state.
7774 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
7775 CResult__u832APIErrorZ {
7776 contents: CResult__u832APIErrorZPtr {
7777 result: Box::into_raw(Box::new(o)),
7783 /// Creates a new CResult__u832APIErrorZ in the error state.
7784 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
7785 CResult__u832APIErrorZ {
7786 contents: CResult__u832APIErrorZPtr {
7787 err: Box::into_raw(Box::new(e)),
7792 /// Checks if the given object is currently in the success state
7794 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
7798 /// Frees any resources used by the CResult__u832APIErrorZ.
7799 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
7800 impl Drop for CResult__u832APIErrorZ {
7801 fn drop(&mut self) {
7803 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7804 let _ = unsafe { Box::from_raw(self.contents.result) };
7807 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7808 let _ = unsafe { Box::from_raw(self.contents.err) };
7813 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
7814 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7815 let contents = if o.result_ok {
7816 let result = unsafe { o.contents.result };
7817 unsafe { o.contents.result = core::ptr::null_mut() };
7818 CResult__u832APIErrorZPtr { result }
7820 let err = unsafe { o.contents.err };
7821 unsafe { o.contents.err = core::ptr::null_mut(); }
7822 CResult__u832APIErrorZPtr { err }
7826 result_ok: o.result_ok,
7830 impl Clone for CResult__u832APIErrorZ {
7831 fn clone(&self) -> Self {
7833 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
7834 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7837 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
7838 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7844 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
7845 /// but with all dynamically-allocated buffers duplicated in new buffers.
7846 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
7848 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
7849 /// This corresponds to std::vector in C++
7850 pub struct CVec_RecentPaymentDetailsZ {
7851 /// The elements in the array.
7852 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7853 pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
7854 /// The number of elements pointed to by `data`.
7857 impl CVec_RecentPaymentDetailsZ {
7858 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
7859 if self.datalen == 0 { return Vec::new(); }
7860 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7861 self.data = core::ptr::null_mut();
7865 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
7866 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7869 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
7870 fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
7871 let datalen = v.len();
7872 let data = Box::into_raw(v.into_boxed_slice());
7873 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7877 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7878 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
7879 impl Drop for CVec_RecentPaymentDetailsZ {
7880 fn drop(&mut self) {
7881 if self.datalen == 0 { return; }
7882 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7886 /// The contents of CResult_NonePaymentSendFailureZ
7887 pub union CResult_NonePaymentSendFailureZPtr {
7888 /// Note that this value is always NULL, as there are no contents in the OK variant
7889 pub result: *mut core::ffi::c_void,
7890 /// A pointer to the contents in the error state.
7891 /// Reading from this pointer when `result_ok` is set is undefined.
7892 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
7895 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7896 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
7897 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7898 pub struct CResult_NonePaymentSendFailureZ {
7899 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7900 /// `err` or `result` depending on the state of `result_ok`.
7901 pub contents: CResult_NonePaymentSendFailureZPtr,
7902 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
7903 pub result_ok: bool,
7906 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
7907 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
7908 CResult_NonePaymentSendFailureZ {
7909 contents: CResult_NonePaymentSendFailureZPtr {
7910 result: core::ptr::null_mut(),
7916 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
7917 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
7918 CResult_NonePaymentSendFailureZ {
7919 contents: CResult_NonePaymentSendFailureZPtr {
7920 err: Box::into_raw(Box::new(e)),
7925 /// Checks if the given object is currently in the success state
7927 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
7931 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
7932 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
7933 impl Drop for CResult_NonePaymentSendFailureZ {
7934 fn drop(&mut self) {
7937 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7938 let _ = unsafe { Box::from_raw(self.contents.err) };
7943 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
7944 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
7945 let contents = if o.result_ok {
7946 let _ = unsafe { Box::from_raw(o.contents.result) };
7947 o.contents.result = core::ptr::null_mut();
7948 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
7950 let err = unsafe { o.contents.err };
7951 unsafe { o.contents.err = core::ptr::null_mut(); }
7952 CResult_NonePaymentSendFailureZPtr { err }
7956 result_ok: o.result_ok,
7960 impl Clone for CResult_NonePaymentSendFailureZ {
7961 fn clone(&self) -> Self {
7963 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
7964 result: core::ptr::null_mut()
7967 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
7968 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7974 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
7975 /// but with all dynamically-allocated buffers duplicated in new buffers.
7976 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
7978 /// The contents of CResult_NoneRetryableSendFailureZ
7979 pub union CResult_NoneRetryableSendFailureZPtr {
7980 /// Note that this value is always NULL, as there are no contents in the OK variant
7981 pub result: *mut core::ffi::c_void,
7982 /// A pointer to the contents in the error state.
7983 /// Reading from this pointer when `result_ok` is set is undefined.
7984 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
7987 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
7988 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
7989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7990 pub struct CResult_NoneRetryableSendFailureZ {
7991 /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
7992 /// `err` or `result` depending on the state of `result_ok`.
7993 pub contents: CResult_NoneRetryableSendFailureZPtr,
7994 /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
7995 pub result_ok: bool,
7998 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
7999 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8000 CResult_NoneRetryableSendFailureZ {
8001 contents: CResult_NoneRetryableSendFailureZPtr {
8002 result: core::ptr::null_mut(),
8008 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8009 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8010 CResult_NoneRetryableSendFailureZ {
8011 contents: CResult_NoneRetryableSendFailureZPtr {
8012 err: Box::into_raw(Box::new(e)),
8017 /// Checks if the given object is currently in the success state
8019 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
8023 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
8024 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
8025 impl Drop for CResult_NoneRetryableSendFailureZ {
8026 fn drop(&mut self) {
8029 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8030 let _ = unsafe { Box::from_raw(self.contents.err) };
8035 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
8036 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8037 let contents = if o.result_ok {
8038 let _ = unsafe { Box::from_raw(o.contents.result) };
8039 o.contents.result = core::ptr::null_mut();
8040 CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
8042 let err = unsafe { o.contents.err };
8043 unsafe { o.contents.err = core::ptr::null_mut(); }
8044 CResult_NoneRetryableSendFailureZPtr { err }
8048 result_ok: o.result_ok,
8052 impl Clone for CResult_NoneRetryableSendFailureZ {
8053 fn clone(&self) -> Self {
8055 Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
8056 result: core::ptr::null_mut()
8059 Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
8060 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8066 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
8067 /// but with all dynamically-allocated buffers duplicated in new buffers.
8068 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
8070 /// The contents of CResult_PaymentHashPaymentSendFailureZ
8071 pub union CResult_PaymentHashPaymentSendFailureZPtr {
8072 /// A pointer to the contents in the success state.
8073 /// Reading from this pointer when `result_ok` is not set is undefined.
8074 pub result: *mut crate::c_types::ThirtyTwoBytes,
8075 /// A pointer to the contents in the error state.
8076 /// Reading from this pointer when `result_ok` is set is undefined.
8077 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8080 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
8081 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8083 pub struct CResult_PaymentHashPaymentSendFailureZ {
8084 /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
8085 /// `err` or `result` depending on the state of `result_ok`.
8086 pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
8087 /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
8088 pub result_ok: bool,
8091 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
8092 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
8093 CResult_PaymentHashPaymentSendFailureZ {
8094 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8095 result: Box::into_raw(Box::new(o)),
8101 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
8102 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
8103 CResult_PaymentHashPaymentSendFailureZ {
8104 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8105 err: Box::into_raw(Box::new(e)),
8110 /// Checks if the given object is currently in the success state
8112 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool {
8116 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
8117 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
8118 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
8119 fn drop(&mut self) {
8121 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8122 let _ = unsafe { Box::from_raw(self.contents.result) };
8125 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8126 let _ = unsafe { Box::from_raw(self.contents.err) };
8131 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
8132 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8133 let contents = if o.result_ok {
8134 let result = unsafe { o.contents.result };
8135 unsafe { o.contents.result = core::ptr::null_mut() };
8136 CResult_PaymentHashPaymentSendFailureZPtr { result }
8138 let err = unsafe { o.contents.err };
8139 unsafe { o.contents.err = core::ptr::null_mut(); }
8140 CResult_PaymentHashPaymentSendFailureZPtr { err }
8144 result_ok: o.result_ok,
8148 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
8149 fn clone(&self) -> Self {
8151 Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8152 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8155 Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8156 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8162 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
8163 /// but with all dynamically-allocated buffers duplicated in new buffers.
8164 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
8166 /// The contents of CResult_PaymentHashRetryableSendFailureZ
8167 pub union CResult_PaymentHashRetryableSendFailureZPtr {
8168 /// A pointer to the contents in the success state.
8169 /// Reading from this pointer when `result_ok` is not set is undefined.
8170 pub result: *mut crate::c_types::ThirtyTwoBytes,
8171 /// A pointer to the contents in the error state.
8172 /// Reading from this pointer when `result_ok` is set is undefined.
8173 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8176 /// A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation,
8177 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8179 pub struct CResult_PaymentHashRetryableSendFailureZ {
8180 /// The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either
8181 /// `err` or `result` depending on the state of `result_ok`.
8182 pub contents: CResult_PaymentHashRetryableSendFailureZPtr,
8183 /// Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state.
8184 pub result_ok: bool,
8187 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state.
8188 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashRetryableSendFailureZ {
8189 CResult_PaymentHashRetryableSendFailureZ {
8190 contents: CResult_PaymentHashRetryableSendFailureZPtr {
8191 result: Box::into_raw(Box::new(o)),
8197 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state.
8198 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_PaymentHashRetryableSendFailureZ {
8199 CResult_PaymentHashRetryableSendFailureZ {
8200 contents: CResult_PaymentHashRetryableSendFailureZPtr {
8201 err: Box::into_raw(Box::new(e)),
8206 /// Checks if the given object is currently in the success state
8208 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_is_ok(o: &CResult_PaymentHashRetryableSendFailureZ) -> bool {
8212 /// Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ.
8213 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_free(_res: CResult_PaymentHashRetryableSendFailureZ) { }
8214 impl Drop for CResult_PaymentHashRetryableSendFailureZ {
8215 fn drop(&mut self) {
8217 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8218 let _ = unsafe { Box::from_raw(self.contents.result) };
8221 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8222 let _ = unsafe { Box::from_raw(self.contents.err) };
8227 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_PaymentHashRetryableSendFailureZ {
8228 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8229 let contents = if o.result_ok {
8230 let result = unsafe { o.contents.result };
8231 unsafe { o.contents.result = core::ptr::null_mut() };
8232 CResult_PaymentHashRetryableSendFailureZPtr { result }
8234 let err = unsafe { o.contents.err };
8235 unsafe { o.contents.err = core::ptr::null_mut(); }
8236 CResult_PaymentHashRetryableSendFailureZPtr { err }
8240 result_ok: o.result_ok,
8244 impl Clone for CResult_PaymentHashRetryableSendFailureZ {
8245 fn clone(&self) -> Self {
8247 Self { result_ok: true, contents: CResult_PaymentHashRetryableSendFailureZPtr {
8248 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8251 Self { result_ok: false, contents: CResult_PaymentHashRetryableSendFailureZPtr {
8252 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8258 /// Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig`
8259 /// but with all dynamically-allocated buffers duplicated in new buffers.
8260 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_clone(orig: &CResult_PaymentHashRetryableSendFailureZ) -> CResult_PaymentHashRetryableSendFailureZ { Clone::clone(&orig) }
8262 /// A tuple of 2 elements. See the individual fields for the types contained.
8263 pub struct C2Tuple_PaymentHashPaymentIdZ {
8264 /// The element at position 0
8265 pub a: crate::c_types::ThirtyTwoBytes,
8266 /// The element at position 1
8267 pub b: crate::c_types::ThirtyTwoBytes,
8269 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8270 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8277 impl C2Tuple_PaymentHashPaymentIdZ {
8278 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8282 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8283 fn clone(&self) -> Self {
8285 a: Clone::clone(&self.a),
8286 b: Clone::clone(&self.b),
8291 /// Creates a new tuple which has the same data as `orig`
8292 /// but with all dynamically-allocated buffers duplicated in new buffers.
8293 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8294 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8296 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8297 C2Tuple_PaymentHashPaymentIdZ { a, b, }
8301 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8302 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8304 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8305 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8306 /// A pointer to the contents in the success state.
8307 /// Reading from this pointer when `result_ok` is not set is undefined.
8308 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8309 /// A pointer to the contents in the error state.
8310 /// Reading from this pointer when `result_ok` is set is undefined.
8311 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8314 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8315 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8316 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8317 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8318 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8319 /// `err` or `result` depending on the state of `result_ok`.
8320 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8321 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8322 pub result_ok: bool,
8325 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8326 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8327 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8328 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8329 result: Box::into_raw(Box::new(o)),
8335 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8336 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8337 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8338 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8339 err: Box::into_raw(Box::new(e)),
8344 /// Checks if the given object is currently in the success state
8346 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8350 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8351 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8352 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8353 fn drop(&mut self) {
8355 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8356 let _ = unsafe { Box::from_raw(self.contents.result) };
8359 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8360 let _ = unsafe { Box::from_raw(self.contents.err) };
8365 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8366 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8367 let contents = if o.result_ok {
8368 let result = unsafe { o.contents.result };
8369 unsafe { o.contents.result = core::ptr::null_mut() };
8370 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8372 let err = unsafe { o.contents.err };
8373 unsafe { o.contents.err = core::ptr::null_mut(); }
8374 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8378 result_ok: o.result_ok,
8382 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8383 fn clone(&self) -> Self {
8385 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8386 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8389 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8390 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8396 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8397 /// but with all dynamically-allocated buffers duplicated in new buffers.
8398 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8400 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8401 /// This corresponds to std::vector in C++
8402 pub struct CVec_ThirtyTwoBytesZ {
8403 /// The elements in the array.
8404 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8405 pub data: *mut crate::c_types::ThirtyTwoBytes,
8406 /// The number of elements pointed to by `data`.
8409 impl CVec_ThirtyTwoBytesZ {
8410 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8411 if self.datalen == 0 { return Vec::new(); }
8412 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8413 self.data = core::ptr::null_mut();
8417 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8418 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8421 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8422 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8423 let datalen = v.len();
8424 let data = Box::into_raw(v.into_boxed_slice());
8425 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8429 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8430 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8431 impl Drop for CVec_ThirtyTwoBytesZ {
8432 fn drop(&mut self) {
8433 if self.datalen == 0 { return; }
8434 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8437 impl Clone for CVec_ThirtyTwoBytesZ {
8438 fn clone(&self) -> Self {
8439 let mut res = Vec::new();
8440 if self.datalen == 0 { return Self::from(res); }
8441 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8446 /// A tuple of 2 elements. See the individual fields for the types contained.
8447 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8448 /// The element at position 0
8449 pub a: crate::c_types::ThirtyTwoBytes,
8450 /// The element at position 1
8451 pub b: crate::c_types::ThirtyTwoBytes,
8453 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8454 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8461 impl C2Tuple_PaymentHashPaymentSecretZ {
8462 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8466 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8467 fn clone(&self) -> Self {
8469 a: Clone::clone(&self.a),
8470 b: Clone::clone(&self.b),
8475 /// Creates a new tuple which has the same data as `orig`
8476 /// but with all dynamically-allocated buffers duplicated in new buffers.
8477 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8478 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8480 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8481 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8485 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8486 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8488 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8489 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8490 /// A pointer to the contents in the success state.
8491 /// Reading from this pointer when `result_ok` is not set is undefined.
8492 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8493 /// Note that this value is always NULL, as there are no contents in the Err variant
8494 pub err: *mut core::ffi::c_void,
8497 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8498 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8500 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8501 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8502 /// `err` or `result` depending on the state of `result_ok`.
8503 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8504 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8505 pub result_ok: bool,
8508 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8509 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8510 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8511 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8512 result: Box::into_raw(Box::new(o)),
8518 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8519 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8520 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8521 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8522 err: core::ptr::null_mut(),
8527 /// Checks if the given object is currently in the success state
8529 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8533 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8534 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8535 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8536 fn drop(&mut self) {
8538 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8539 let _ = unsafe { Box::from_raw(self.contents.result) };
8545 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8546 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8547 let contents = if o.result_ok {
8548 let result = unsafe { o.contents.result };
8549 unsafe { o.contents.result = core::ptr::null_mut() };
8550 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8552 let _ = unsafe { Box::from_raw(o.contents.err) };
8553 o.contents.err = core::ptr::null_mut();
8554 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8558 result_ok: o.result_ok,
8562 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8563 fn clone(&self) -> Self {
8565 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8566 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8569 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8570 err: core::ptr::null_mut()
8576 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8577 /// but with all dynamically-allocated buffers duplicated in new buffers.
8578 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8580 /// The contents of CResult_PaymentSecretNoneZ
8581 pub union CResult_PaymentSecretNoneZPtr {
8582 /// A pointer to the contents in the success state.
8583 /// Reading from this pointer when `result_ok` is not set is undefined.
8584 pub result: *mut crate::c_types::ThirtyTwoBytes,
8585 /// Note that this value is always NULL, as there are no contents in the Err variant
8586 pub err: *mut core::ffi::c_void,
8589 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8590 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8592 pub struct CResult_PaymentSecretNoneZ {
8593 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8594 /// `err` or `result` depending on the state of `result_ok`.
8595 pub contents: CResult_PaymentSecretNoneZPtr,
8596 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8597 pub result_ok: bool,
8600 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8601 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8602 CResult_PaymentSecretNoneZ {
8603 contents: CResult_PaymentSecretNoneZPtr {
8604 result: Box::into_raw(Box::new(o)),
8610 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8611 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8612 CResult_PaymentSecretNoneZ {
8613 contents: CResult_PaymentSecretNoneZPtr {
8614 err: core::ptr::null_mut(),
8619 /// Checks if the given object is currently in the success state
8621 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8625 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8626 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8627 impl Drop for CResult_PaymentSecretNoneZ {
8628 fn drop(&mut self) {
8630 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8631 let _ = unsafe { Box::from_raw(self.contents.result) };
8637 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8638 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8639 let contents = if o.result_ok {
8640 let result = unsafe { o.contents.result };
8641 unsafe { o.contents.result = core::ptr::null_mut() };
8642 CResult_PaymentSecretNoneZPtr { result }
8644 let _ = unsafe { Box::from_raw(o.contents.err) };
8645 o.contents.err = core::ptr::null_mut();
8646 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8650 result_ok: o.result_ok,
8654 impl Clone for CResult_PaymentSecretNoneZ {
8655 fn clone(&self) -> Self {
8657 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8658 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8661 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8662 err: core::ptr::null_mut()
8668 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8669 /// but with all dynamically-allocated buffers duplicated in new buffers.
8670 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
8672 /// The contents of CResult_PaymentPreimageAPIErrorZ
8673 pub union CResult_PaymentPreimageAPIErrorZPtr {
8674 /// A pointer to the contents in the success state.
8675 /// Reading from this pointer when `result_ok` is not set is undefined.
8676 pub result: *mut crate::c_types::ThirtyTwoBytes,
8677 /// A pointer to the contents in the error state.
8678 /// Reading from this pointer when `result_ok` is set is undefined.
8679 pub err: *mut crate::lightning::util::errors::APIError,
8682 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8683 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8684 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8685 pub struct CResult_PaymentPreimageAPIErrorZ {
8686 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8687 /// `err` or `result` depending on the state of `result_ok`.
8688 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
8689 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8690 pub result_ok: bool,
8693 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
8694 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
8695 CResult_PaymentPreimageAPIErrorZ {
8696 contents: CResult_PaymentPreimageAPIErrorZPtr {
8697 result: Box::into_raw(Box::new(o)),
8703 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
8704 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
8705 CResult_PaymentPreimageAPIErrorZ {
8706 contents: CResult_PaymentPreimageAPIErrorZPtr {
8707 err: Box::into_raw(Box::new(e)),
8712 /// Checks if the given object is currently in the success state
8714 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
8718 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
8719 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
8720 impl Drop for CResult_PaymentPreimageAPIErrorZ {
8721 fn drop(&mut self) {
8723 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8724 let _ = unsafe { Box::from_raw(self.contents.result) };
8727 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8728 let _ = unsafe { Box::from_raw(self.contents.err) };
8733 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
8734 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8735 let contents = if o.result_ok {
8736 let result = unsafe { o.contents.result };
8737 unsafe { o.contents.result = core::ptr::null_mut() };
8738 CResult_PaymentPreimageAPIErrorZPtr { result }
8740 let err = unsafe { o.contents.err };
8741 unsafe { o.contents.err = core::ptr::null_mut(); }
8742 CResult_PaymentPreimageAPIErrorZPtr { err }
8746 result_ok: o.result_ok,
8750 impl Clone for CResult_PaymentPreimageAPIErrorZ {
8751 fn clone(&self) -> Self {
8753 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
8754 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8757 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
8758 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8764 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
8765 /// but with all dynamically-allocated buffers duplicated in new buffers.
8766 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
8769 /// An enum which can either contain a crate::c_types::derived::CVec_ChainHashZ or not
8770 pub enum COption_CVec_ChainHashZZ {
8771 /// When we're in this state, this COption_CVec_ChainHashZZ contains a crate::c_types::derived::CVec_ChainHashZ
8772 Some(crate::c_types::derived::CVec_ChainHashZ),
8773 /// When we're in this state, this COption_CVec_ChainHashZZ contains nothing
8776 impl COption_CVec_ChainHashZZ {
8777 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8778 if let Self::None = self { false } else { true }
8780 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8783 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_ChainHashZ {
8784 if let Self::Some(v) = self { v } else { unreachable!() }
8788 /// Constructs a new COption_CVec_ChainHashZZ containing a crate::c_types::derived::CVec_ChainHashZ
8789 pub extern "C" fn COption_CVec_ChainHashZZ_some(o: crate::c_types::derived::CVec_ChainHashZ) -> COption_CVec_ChainHashZZ {
8790 COption_CVec_ChainHashZZ::Some(o)
8793 /// Constructs a new COption_CVec_ChainHashZZ containing nothing
8794 pub extern "C" fn COption_CVec_ChainHashZZ_none() -> COption_CVec_ChainHashZZ {
8795 COption_CVec_ChainHashZZ::None
8798 /// Frees any resources associated with the crate::c_types::derived::CVec_ChainHashZ, if we are in the Some state
8799 pub extern "C" fn COption_CVec_ChainHashZZ_free(_res: COption_CVec_ChainHashZZ) { }
8801 /// Creates a new COption_CVec_ChainHashZZ which has the same data as `orig`
8802 /// but with all dynamically-allocated buffers duplicated in new buffers.
8803 pub extern "C" fn COption_CVec_ChainHashZZ_clone(orig: &COption_CVec_ChainHashZZ) -> COption_CVec_ChainHashZZ { Clone::clone(&orig) }
8805 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8806 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8807 /// A pointer to the contents in the success state.
8808 /// Reading from this pointer when `result_ok` is not set is undefined.
8809 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
8810 /// A pointer to the contents in the error state.
8811 /// Reading from this pointer when `result_ok` is set is undefined.
8812 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8815 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8816 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8817 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8818 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
8819 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8820 /// `err` or `result` depending on the state of `result_ok`.
8821 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
8822 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8823 pub result_ok: bool,
8826 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
8827 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8828 CResult_CounterpartyForwardingInfoDecodeErrorZ {
8829 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8830 result: Box::into_raw(Box::new(o)),
8836 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
8837 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8838 CResult_CounterpartyForwardingInfoDecodeErrorZ {
8839 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8840 err: Box::into_raw(Box::new(e)),
8845 /// Checks if the given object is currently in the success state
8847 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
8851 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
8852 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
8853 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8854 fn drop(&mut self) {
8856 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8857 let _ = unsafe { Box::from_raw(self.contents.result) };
8860 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8861 let _ = unsafe { Box::from_raw(self.contents.err) };
8866 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8867 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8868 let contents = if o.result_ok {
8869 let result = unsafe { o.contents.result };
8870 unsafe { o.contents.result = core::ptr::null_mut() };
8871 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
8873 let err = unsafe { o.contents.err };
8874 unsafe { o.contents.err = core::ptr::null_mut(); }
8875 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
8879 result_ok: o.result_ok,
8883 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8884 fn clone(&self) -> Self {
8886 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8887 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
8890 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8891 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8897 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
8898 /// but with all dynamically-allocated buffers duplicated in new buffers.
8899 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
8901 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
8902 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
8903 /// A pointer to the contents in the success state.
8904 /// Reading from this pointer when `result_ok` is not set is undefined.
8905 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
8906 /// A pointer to the contents in the error state.
8907 /// Reading from this pointer when `result_ok` is set is undefined.
8908 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8911 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
8912 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
8913 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8914 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
8915 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
8916 /// `err` or `result` depending on the state of `result_ok`.
8917 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
8918 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
8919 pub result_ok: bool,
8922 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
8923 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
8924 CResult_ChannelCounterpartyDecodeErrorZ {
8925 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8926 result: Box::into_raw(Box::new(o)),
8932 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
8933 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
8934 CResult_ChannelCounterpartyDecodeErrorZ {
8935 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8936 err: Box::into_raw(Box::new(e)),
8941 /// Checks if the given object is currently in the success state
8943 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
8947 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
8948 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
8949 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
8950 fn drop(&mut self) {
8952 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8953 let _ = unsafe { Box::from_raw(self.contents.result) };
8956 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8957 let _ = unsafe { Box::from_raw(self.contents.err) };
8962 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
8963 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
8964 let contents = if o.result_ok {
8965 let result = unsafe { o.contents.result };
8966 unsafe { o.contents.result = core::ptr::null_mut() };
8967 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
8969 let err = unsafe { o.contents.err };
8970 unsafe { o.contents.err = core::ptr::null_mut(); }
8971 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
8975 result_ok: o.result_ok,
8979 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
8980 fn clone(&self) -> Self {
8982 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8983 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
8986 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8987 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8993 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
8994 /// but with all dynamically-allocated buffers duplicated in new buffers.
8995 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
8997 /// The contents of CResult_ChannelDetailsDecodeErrorZ
8998 pub union CResult_ChannelDetailsDecodeErrorZPtr {
8999 /// A pointer to the contents in the success state.
9000 /// Reading from this pointer when `result_ok` is not set is undefined.
9001 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9002 /// A pointer to the contents in the error state.
9003 /// Reading from this pointer when `result_ok` is set is undefined.
9004 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9007 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9008 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9009 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9010 pub struct CResult_ChannelDetailsDecodeErrorZ {
9011 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9012 /// `err` or `result` depending on the state of `result_ok`.
9013 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9014 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9015 pub result_ok: bool,
9018 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9019 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9020 CResult_ChannelDetailsDecodeErrorZ {
9021 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9022 result: Box::into_raw(Box::new(o)),
9028 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9029 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9030 CResult_ChannelDetailsDecodeErrorZ {
9031 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9032 err: Box::into_raw(Box::new(e)),
9037 /// Checks if the given object is currently in the success state
9039 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9043 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9044 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9045 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9046 fn drop(&mut self) {
9048 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9049 let _ = unsafe { Box::from_raw(self.contents.result) };
9052 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9053 let _ = unsafe { Box::from_raw(self.contents.err) };
9058 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9059 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9060 let contents = if o.result_ok {
9061 let result = unsafe { o.contents.result };
9062 unsafe { o.contents.result = core::ptr::null_mut() };
9063 CResult_ChannelDetailsDecodeErrorZPtr { result }
9065 let err = unsafe { o.contents.err };
9066 unsafe { o.contents.err = core::ptr::null_mut(); }
9067 CResult_ChannelDetailsDecodeErrorZPtr { err }
9071 result_ok: o.result_ok,
9075 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9076 fn clone(&self) -> Self {
9078 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9079 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9082 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9083 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9089 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9090 /// but with all dynamically-allocated buffers duplicated in new buffers.
9091 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9093 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9094 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9095 /// A pointer to the contents in the success state.
9096 /// Reading from this pointer when `result_ok` is not set is undefined.
9097 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9098 /// A pointer to the contents in the error state.
9099 /// Reading from this pointer when `result_ok` is set is undefined.
9100 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9103 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9104 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9106 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9107 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9108 /// `err` or `result` depending on the state of `result_ok`.
9109 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9110 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9111 pub result_ok: bool,
9114 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9115 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9116 CResult_PhantomRouteHintsDecodeErrorZ {
9117 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9118 result: Box::into_raw(Box::new(o)),
9124 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9125 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9126 CResult_PhantomRouteHintsDecodeErrorZ {
9127 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9128 err: Box::into_raw(Box::new(e)),
9133 /// Checks if the given object is currently in the success state
9135 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9139 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9140 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9141 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9142 fn drop(&mut self) {
9144 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9145 let _ = unsafe { Box::from_raw(self.contents.result) };
9148 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9149 let _ = unsafe { Box::from_raw(self.contents.err) };
9154 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9155 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9156 let contents = if o.result_ok {
9157 let result = unsafe { o.contents.result };
9158 unsafe { o.contents.result = core::ptr::null_mut() };
9159 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9161 let err = unsafe { o.contents.err };
9162 unsafe { o.contents.err = core::ptr::null_mut(); }
9163 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9167 result_ok: o.result_ok,
9171 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9172 fn clone(&self) -> Self {
9174 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9175 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9178 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9179 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9185 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9186 /// but with all dynamically-allocated buffers duplicated in new buffers.
9187 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9189 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
9190 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
9191 /// A pointer to the contents in the success state.
9192 /// Reading from this pointer when `result_ok` is not set is undefined.
9193 pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
9194 /// A pointer to the contents in the error state.
9195 /// Reading from this pointer when `result_ok` is set is undefined.
9196 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9199 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
9200 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
9201 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9202 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
9203 /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
9204 /// `err` or `result` depending on the state of `result_ok`.
9205 pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
9206 /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
9207 pub result_ok: bool,
9210 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
9211 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
9212 CResult_ChannelShutdownStateDecodeErrorZ {
9213 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9214 result: Box::into_raw(Box::new(o)),
9220 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
9221 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
9222 CResult_ChannelShutdownStateDecodeErrorZ {
9223 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9224 err: Box::into_raw(Box::new(e)),
9229 /// Checks if the given object is currently in the success state
9231 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
9235 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
9236 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
9237 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
9238 fn drop(&mut self) {
9240 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9241 let _ = unsafe { Box::from_raw(self.contents.result) };
9244 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9245 let _ = unsafe { Box::from_raw(self.contents.err) };
9250 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
9251 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
9252 let contents = if o.result_ok {
9253 let result = unsafe { o.contents.result };
9254 unsafe { o.contents.result = core::ptr::null_mut() };
9255 CResult_ChannelShutdownStateDecodeErrorZPtr { result }
9257 let err = unsafe { o.contents.err };
9258 unsafe { o.contents.err = core::ptr::null_mut(); }
9259 CResult_ChannelShutdownStateDecodeErrorZPtr { err }
9263 result_ok: o.result_ok,
9267 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
9268 fn clone(&self) -> Self {
9270 Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9271 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
9274 Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
9275 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9281 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
9282 /// but with all dynamically-allocated buffers duplicated in new buffers.
9283 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
9285 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9286 /// This corresponds to std::vector in C++
9287 pub struct CVec_ChannelMonitorZ {
9288 /// The elements in the array.
9289 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9290 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9291 /// The number of elements pointed to by `data`.
9294 impl CVec_ChannelMonitorZ {
9295 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9296 if self.datalen == 0 { return Vec::new(); }
9297 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9298 self.data = core::ptr::null_mut();
9302 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9303 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9306 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9307 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9308 let datalen = v.len();
9309 let data = Box::into_raw(v.into_boxed_slice());
9310 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9314 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9315 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9316 impl Drop for CVec_ChannelMonitorZ {
9317 fn drop(&mut self) {
9318 if self.datalen == 0 { return; }
9319 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9323 /// A tuple of 2 elements. See the individual fields for the types contained.
9324 pub struct C2Tuple_BlockHashChannelManagerZ {
9325 /// The element at position 0
9326 pub a: crate::c_types::ThirtyTwoBytes,
9327 /// The element at position 1
9328 pub b: crate::lightning::ln::channelmanager::ChannelManager,
9330 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9331 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9338 impl C2Tuple_BlockHashChannelManagerZ {
9339 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9343 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9345 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9346 C2Tuple_BlockHashChannelManagerZ { a, b, }
9350 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9351 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9353 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9354 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9355 /// A pointer to the contents in the success state.
9356 /// Reading from this pointer when `result_ok` is not set is undefined.
9357 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9358 /// A pointer to the contents in the error state.
9359 /// Reading from this pointer when `result_ok` is set is undefined.
9360 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9363 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9364 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9365 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9366 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9367 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9368 /// `err` or `result` depending on the state of `result_ok`.
9369 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9370 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9371 pub result_ok: bool,
9374 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9375 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9376 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9377 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9378 result: Box::into_raw(Box::new(o)),
9384 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9385 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9386 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9387 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9388 err: Box::into_raw(Box::new(e)),
9393 /// Checks if the given object is currently in the success state
9395 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9399 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9400 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9401 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9402 fn drop(&mut self) {
9404 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9405 let _ = unsafe { Box::from_raw(self.contents.result) };
9408 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9409 let _ = unsafe { Box::from_raw(self.contents.err) };
9414 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9415 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9416 let contents = if o.result_ok {
9417 let result = unsafe { o.contents.result };
9418 unsafe { o.contents.result = core::ptr::null_mut() };
9419 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9421 let err = unsafe { o.contents.err };
9422 unsafe { o.contents.err = core::ptr::null_mut(); }
9423 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9427 result_ok: o.result_ok,
9432 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
9433 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9434 /// A pointer to the contents in the success state.
9435 /// Reading from this pointer when `result_ok` is not set is undefined.
9436 pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
9437 /// A pointer to the contents in the error state.
9438 /// Reading from this pointer when `result_ok` is set is undefined.
9439 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9442 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
9443 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
9444 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9445 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
9446 /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
9447 /// `err` or `result` depending on the state of `result_ok`.
9448 pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
9449 /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
9450 pub result_ok: bool,
9453 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
9454 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
9455 CResult_MaxDustHTLCExposureDecodeErrorZ {
9456 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9457 result: Box::into_raw(Box::new(o)),
9463 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
9464 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
9465 CResult_MaxDustHTLCExposureDecodeErrorZ {
9466 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9467 err: Box::into_raw(Box::new(e)),
9472 /// Checks if the given object is currently in the success state
9474 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
9478 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
9479 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
9480 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
9481 fn drop(&mut self) {
9483 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9484 let _ = unsafe { Box::from_raw(self.contents.result) };
9487 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9488 let _ = unsafe { Box::from_raw(self.contents.err) };
9493 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
9494 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
9495 let contents = if o.result_ok {
9496 let result = unsafe { o.contents.result };
9497 unsafe { o.contents.result = core::ptr::null_mut() };
9498 CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
9500 let err = unsafe { o.contents.err };
9501 unsafe { o.contents.err = core::ptr::null_mut(); }
9502 CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
9506 result_ok: o.result_ok,
9510 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
9511 fn clone(&self) -> Self {
9513 Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9514 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
9517 Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
9518 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9524 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
9525 /// but with all dynamically-allocated buffers duplicated in new buffers.
9526 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
9528 /// The contents of CResult_ChannelConfigDecodeErrorZ
9529 pub union CResult_ChannelConfigDecodeErrorZPtr {
9530 /// A pointer to the contents in the success state.
9531 /// Reading from this pointer when `result_ok` is not set is undefined.
9532 pub result: *mut crate::lightning::util::config::ChannelConfig,
9533 /// A pointer to the contents in the error state.
9534 /// Reading from this pointer when `result_ok` is set is undefined.
9535 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9538 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9539 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9540 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9541 pub struct CResult_ChannelConfigDecodeErrorZ {
9542 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9543 /// `err` or `result` depending on the state of `result_ok`.
9544 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9545 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9546 pub result_ok: bool,
9549 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9550 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9551 CResult_ChannelConfigDecodeErrorZ {
9552 contents: CResult_ChannelConfigDecodeErrorZPtr {
9553 result: Box::into_raw(Box::new(o)),
9559 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9560 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9561 CResult_ChannelConfigDecodeErrorZ {
9562 contents: CResult_ChannelConfigDecodeErrorZPtr {
9563 err: Box::into_raw(Box::new(e)),
9568 /// Checks if the given object is currently in the success state
9570 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9574 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9575 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9576 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9577 fn drop(&mut self) {
9579 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9580 let _ = unsafe { Box::from_raw(self.contents.result) };
9583 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9584 let _ = unsafe { Box::from_raw(self.contents.err) };
9589 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9590 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9591 let contents = if o.result_ok {
9592 let result = unsafe { o.contents.result };
9593 unsafe { o.contents.result = core::ptr::null_mut() };
9594 CResult_ChannelConfigDecodeErrorZPtr { result }
9596 let err = unsafe { o.contents.err };
9597 unsafe { o.contents.err = core::ptr::null_mut(); }
9598 CResult_ChannelConfigDecodeErrorZPtr { err }
9602 result_ok: o.result_ok,
9606 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9607 fn clone(&self) -> Self {
9609 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9610 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9613 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9614 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9620 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9621 /// but with all dynamically-allocated buffers duplicated in new buffers.
9622 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9625 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
9626 pub enum COption_MaxDustHTLCExposureZ {
9627 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
9628 Some(crate::lightning::util::config::MaxDustHTLCExposure),
9629 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
9632 impl COption_MaxDustHTLCExposureZ {
9633 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9634 if let Self::None = self { false } else { true }
9636 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9639 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
9640 if let Self::Some(v) = self { v } else { unreachable!() }
9644 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
9645 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
9646 COption_MaxDustHTLCExposureZ::Some(o)
9649 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
9650 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
9651 COption_MaxDustHTLCExposureZ::None
9654 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
9655 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
9657 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
9658 /// but with all dynamically-allocated buffers duplicated in new buffers.
9659 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
9662 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
9663 pub enum COption_APIErrorZ {
9664 /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
9665 Some(crate::lightning::util::errors::APIError),
9666 /// When we're in this state, this COption_APIErrorZ contains nothing
9669 impl COption_APIErrorZ {
9670 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9671 if let Self::None = self { false } else { true }
9673 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9676 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
9677 if let Self::Some(v) = self { v } else { unreachable!() }
9681 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
9682 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
9683 COption_APIErrorZ::Some(o)
9686 /// Constructs a new COption_APIErrorZ containing nothing
9687 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
9688 COption_APIErrorZ::None
9691 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
9692 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
9694 /// Creates a new COption_APIErrorZ which has the same data as `orig`
9695 /// but with all dynamically-allocated buffers duplicated in new buffers.
9696 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
9698 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
9699 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
9700 /// A pointer to the contents in the success state.
9701 /// Reading from this pointer when `result_ok` is not set is undefined.
9702 pub result: *mut crate::c_types::derived::COption_APIErrorZ,
9703 /// A pointer to the contents in the error state.
9704 /// Reading from this pointer when `result_ok` is set is undefined.
9705 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9708 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
9709 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9711 pub struct CResult_COption_APIErrorZDecodeErrorZ {
9712 /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
9713 /// `err` or `result` depending on the state of `result_ok`.
9714 pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
9715 /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
9716 pub result_ok: bool,
9719 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
9720 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
9721 CResult_COption_APIErrorZDecodeErrorZ {
9722 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
9723 result: Box::into_raw(Box::new(o)),
9729 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
9730 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
9731 CResult_COption_APIErrorZDecodeErrorZ {
9732 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
9733 err: Box::into_raw(Box::new(e)),
9738 /// Checks if the given object is currently in the success state
9740 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
9744 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
9745 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
9746 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
9747 fn drop(&mut self) {
9749 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9750 let _ = unsafe { Box::from_raw(self.contents.result) };
9753 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9754 let _ = unsafe { Box::from_raw(self.contents.err) };
9759 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
9760 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9761 let contents = if o.result_ok {
9762 let result = unsafe { o.contents.result };
9763 unsafe { o.contents.result = core::ptr::null_mut() };
9764 CResult_COption_APIErrorZDecodeErrorZPtr { result }
9766 let err = unsafe { o.contents.err };
9767 unsafe { o.contents.err = core::ptr::null_mut(); }
9768 CResult_COption_APIErrorZDecodeErrorZPtr { err }
9772 result_ok: o.result_ok,
9776 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
9777 fn clone(&self) -> Self {
9779 Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
9780 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
9783 Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
9784 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9790 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
9791 /// but with all dynamically-allocated buffers duplicated in new buffers.
9792 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
9794 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9795 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9796 /// A pointer to the contents in the success state.
9797 /// Reading from this pointer when `result_ok` is not set is undefined.
9798 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9799 /// A pointer to the contents in the error state.
9800 /// Reading from this pointer when `result_ok` is set is undefined.
9801 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9804 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9805 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9807 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9808 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9809 /// `err` or `result` depending on the state of `result_ok`.
9810 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9811 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9812 pub result_ok: bool,
9815 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9816 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9817 CResult_ChannelMonitorUpdateDecodeErrorZ {
9818 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9819 result: Box::into_raw(Box::new(o)),
9825 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9826 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9827 CResult_ChannelMonitorUpdateDecodeErrorZ {
9828 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9829 err: Box::into_raw(Box::new(e)),
9834 /// Checks if the given object is currently in the success state
9836 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9840 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9841 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9842 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9843 fn drop(&mut self) {
9845 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9846 let _ = unsafe { Box::from_raw(self.contents.result) };
9849 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9850 let _ = unsafe { Box::from_raw(self.contents.err) };
9855 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9856 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9857 let contents = if o.result_ok {
9858 let result = unsafe { o.contents.result };
9859 unsafe { o.contents.result = core::ptr::null_mut() };
9860 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9862 let err = unsafe { o.contents.err };
9863 unsafe { o.contents.err = core::ptr::null_mut(); }
9864 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9868 result_ok: o.result_ok,
9872 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9873 fn clone(&self) -> Self {
9875 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9876 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9879 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9880 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9886 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9887 /// but with all dynamically-allocated buffers duplicated in new buffers.
9888 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9891 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9892 pub enum COption_MonitorEventZ {
9893 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9894 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9895 /// When we're in this state, this COption_MonitorEventZ contains nothing
9898 impl COption_MonitorEventZ {
9899 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9900 if let Self::None = self { false } else { true }
9902 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9905 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9906 if let Self::Some(v) = self { v } else { unreachable!() }
9910 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9911 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9912 COption_MonitorEventZ::Some(o)
9915 /// Constructs a new COption_MonitorEventZ containing nothing
9916 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9917 COption_MonitorEventZ::None
9920 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9921 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9923 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9924 /// but with all dynamically-allocated buffers duplicated in new buffers.
9925 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9927 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9928 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9929 /// A pointer to the contents in the success state.
9930 /// Reading from this pointer when `result_ok` is not set is undefined.
9931 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9932 /// A pointer to the contents in the error state.
9933 /// Reading from this pointer when `result_ok` is set is undefined.
9934 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9937 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9938 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9940 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9941 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9942 /// `err` or `result` depending on the state of `result_ok`.
9943 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9944 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9945 pub result_ok: bool,
9948 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9949 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9950 CResult_COption_MonitorEventZDecodeErrorZ {
9951 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9952 result: Box::into_raw(Box::new(o)),
9958 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9959 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9960 CResult_COption_MonitorEventZDecodeErrorZ {
9961 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9962 err: Box::into_raw(Box::new(e)),
9967 /// Checks if the given object is currently in the success state
9969 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9973 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9974 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9975 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9976 fn drop(&mut self) {
9978 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9979 let _ = unsafe { Box::from_raw(self.contents.result) };
9982 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9983 let _ = unsafe { Box::from_raw(self.contents.err) };
9988 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9989 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9990 let contents = if o.result_ok {
9991 let result = unsafe { o.contents.result };
9992 unsafe { o.contents.result = core::ptr::null_mut() };
9993 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9995 let err = unsafe { o.contents.err };
9996 unsafe { o.contents.err = core::ptr::null_mut(); }
9997 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10001 result_ok: o.result_ok,
10005 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10006 fn clone(&self) -> Self {
10007 if self.result_ok {
10008 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10009 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10012 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10013 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10019 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10020 /// but with all dynamically-allocated buffers duplicated in new buffers.
10021 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10023 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10024 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10025 /// A pointer to the contents in the success state.
10026 /// Reading from this pointer when `result_ok` is not set is undefined.
10027 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10028 /// A pointer to the contents in the error state.
10029 /// Reading from this pointer when `result_ok` is set is undefined.
10030 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10033 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10034 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10035 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10036 pub struct CResult_HTLCUpdateDecodeErrorZ {
10037 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10038 /// `err` or `result` depending on the state of `result_ok`.
10039 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10040 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10041 pub result_ok: bool,
10044 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10045 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10046 CResult_HTLCUpdateDecodeErrorZ {
10047 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10048 result: Box::into_raw(Box::new(o)),
10054 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10055 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10056 CResult_HTLCUpdateDecodeErrorZ {
10057 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10058 err: Box::into_raw(Box::new(e)),
10063 /// Checks if the given object is currently in the success state
10065 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10069 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10070 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10071 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10072 fn drop(&mut self) {
10073 if self.result_ok {
10074 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10075 let _ = unsafe { Box::from_raw(self.contents.result) };
10078 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10079 let _ = unsafe { Box::from_raw(self.contents.err) };
10084 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10085 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10086 let contents = if o.result_ok {
10087 let result = unsafe { o.contents.result };
10088 unsafe { o.contents.result = core::ptr::null_mut() };
10089 CResult_HTLCUpdateDecodeErrorZPtr { result }
10091 let err = unsafe { o.contents.err };
10092 unsafe { o.contents.err = core::ptr::null_mut(); }
10093 CResult_HTLCUpdateDecodeErrorZPtr { err }
10097 result_ok: o.result_ok,
10101 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10102 fn clone(&self) -> Self {
10103 if self.result_ok {
10104 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10105 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10108 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10109 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10115 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10116 /// but with all dynamically-allocated buffers duplicated in new buffers.
10117 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10119 /// A tuple of 2 elements. See the individual fields for the types contained.
10120 pub struct C2Tuple_OutPointScriptZ {
10121 /// The element at position 0
10122 pub a: crate::lightning::chain::transaction::OutPoint,
10123 /// The element at position 1
10124 pub b: crate::c_types::derived::CVec_u8Z,
10126 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
10127 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10134 impl C2Tuple_OutPointScriptZ {
10135 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10139 impl Clone for C2Tuple_OutPointScriptZ {
10140 fn clone(&self) -> Self {
10142 a: Clone::clone(&self.a),
10143 b: Clone::clone(&self.b),
10148 /// Creates a new tuple which has the same data as `orig`
10149 /// but with all dynamically-allocated buffers duplicated in new buffers.
10150 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
10151 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10153 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
10154 C2Tuple_OutPointScriptZ { a, b, }
10158 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
10159 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
10161 /// A tuple of 2 elements. See the individual fields for the types contained.
10162 pub struct C2Tuple_u32ScriptZ {
10163 /// The element at position 0
10165 /// The element at position 1
10166 pub b: crate::c_types::derived::CVec_u8Z,
10168 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
10169 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10176 impl C2Tuple_u32ScriptZ {
10177 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10181 impl Clone for C2Tuple_u32ScriptZ {
10182 fn clone(&self) -> Self {
10184 a: Clone::clone(&self.a),
10185 b: Clone::clone(&self.b),
10190 /// Creates a new tuple which has the same data as `orig`
10191 /// but with all dynamically-allocated buffers duplicated in new buffers.
10192 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
10193 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
10195 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
10196 C2Tuple_u32ScriptZ { a, b, }
10200 /// Frees any resources used by the C2Tuple_u32ScriptZ.
10201 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
10203 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
10204 /// This corresponds to std::vector in C++
10205 pub struct CVec_C2Tuple_u32ScriptZZ {
10206 /// The elements in the array.
10207 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10208 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
10209 /// The number of elements pointed to by `data`.
10212 impl CVec_C2Tuple_u32ScriptZZ {
10213 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
10214 if self.datalen == 0 { return Vec::new(); }
10215 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10216 self.data = core::ptr::null_mut();
10220 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
10221 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10224 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
10225 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
10226 let datalen = v.len();
10227 let data = Box::into_raw(v.into_boxed_slice());
10228 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10232 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10233 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
10234 impl Drop for CVec_C2Tuple_u32ScriptZZ {
10235 fn drop(&mut self) {
10236 if self.datalen == 0 { return; }
10237 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10240 impl Clone for CVec_C2Tuple_u32ScriptZZ {
10241 fn clone(&self) -> Self {
10242 let mut res = Vec::new();
10243 if self.datalen == 0 { return Self::from(res); }
10244 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10249 /// A tuple of 2 elements. See the individual fields for the types contained.
10250 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10251 /// The element at position 0
10252 pub a: crate::c_types::ThirtyTwoBytes,
10253 /// The element at position 1
10254 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
10256 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10257 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
10264 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10265 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
10269 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10270 fn clone(&self) -> Self {
10272 a: Clone::clone(&self.a),
10273 b: Clone::clone(&self.b),
10278 /// Creates a new tuple which has the same data as `orig`
10279 /// but with all dynamically-allocated buffers duplicated in new buffers.
10280 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
10281 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
10283 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10284 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
10288 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
10289 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
10291 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
10292 /// This corresponds to std::vector in C++
10293 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10294 /// The elements in the array.
10295 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10296 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
10297 /// The number of elements pointed to by `data`.
10300 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10301 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
10302 if self.datalen == 0 { return Vec::new(); }
10303 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10304 self.data = core::ptr::null_mut();
10308 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
10309 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10312 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10313 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
10314 let datalen = v.len();
10315 let data = Box::into_raw(v.into_boxed_slice());
10316 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10320 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10321 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
10322 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10323 fn drop(&mut self) {
10324 if self.datalen == 0 { return; }
10325 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10328 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10329 fn clone(&self) -> Self {
10330 let mut res = Vec::new();
10331 if self.datalen == 0 { return Self::from(res); }
10332 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10337 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
10338 /// This corresponds to std::vector in C++
10339 pub struct CVec_TransactionZ {
10340 /// The elements in the array.
10341 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10342 pub data: *mut crate::c_types::Transaction,
10343 /// The number of elements pointed to by `data`.
10346 impl CVec_TransactionZ {
10347 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
10348 if self.datalen == 0 { return Vec::new(); }
10349 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10350 self.data = core::ptr::null_mut();
10354 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
10355 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10358 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
10359 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
10360 let datalen = v.len();
10361 let data = Box::into_raw(v.into_boxed_slice());
10362 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10366 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10367 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
10368 impl Drop for CVec_TransactionZ {
10369 fn drop(&mut self) {
10370 if self.datalen == 0 { return; }
10371 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10374 impl Clone for CVec_TransactionZ {
10375 fn clone(&self) -> Self {
10376 let mut res = Vec::new();
10377 if self.datalen == 0 { return Self::from(res); }
10378 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10383 /// A tuple of 2 elements. See the individual fields for the types contained.
10384 pub struct C2Tuple_u32TxOutZ {
10385 /// The element at position 0
10387 /// The element at position 1
10388 pub b: crate::c_types::TxOut,
10390 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
10391 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
10398 impl C2Tuple_u32TxOutZ {
10399 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
10403 impl Clone for C2Tuple_u32TxOutZ {
10404 fn clone(&self) -> Self {
10406 a: Clone::clone(&self.a),
10407 b: Clone::clone(&self.b),
10412 /// Creates a new tuple which has the same data as `orig`
10413 /// but with all dynamically-allocated buffers duplicated in new buffers.
10414 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
10415 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
10417 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
10418 C2Tuple_u32TxOutZ { a, b, }
10422 /// Frees any resources used by the C2Tuple_u32TxOutZ.
10423 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
10425 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
10426 /// This corresponds to std::vector in C++
10427 pub struct CVec_C2Tuple_u32TxOutZZ {
10428 /// The elements in the array.
10429 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10430 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
10431 /// The number of elements pointed to by `data`.
10434 impl CVec_C2Tuple_u32TxOutZZ {
10435 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
10436 if self.datalen == 0 { return Vec::new(); }
10437 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10438 self.data = core::ptr::null_mut();
10442 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
10443 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10446 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
10447 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
10448 let datalen = v.len();
10449 let data = Box::into_raw(v.into_boxed_slice());
10450 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10454 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10455 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
10456 impl Drop for CVec_C2Tuple_u32TxOutZZ {
10457 fn drop(&mut self) {
10458 if self.datalen == 0 { return; }
10459 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10462 impl Clone for CVec_C2Tuple_u32TxOutZZ {
10463 fn clone(&self) -> Self {
10464 let mut res = Vec::new();
10465 if self.datalen == 0 { return Self::from(res); }
10466 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10471 /// A tuple of 2 elements. See the individual fields for the types contained.
10472 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
10473 /// The element at position 0
10474 pub a: crate::c_types::ThirtyTwoBytes,
10475 /// The element at position 1
10476 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
10478 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
10479 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
10486 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
10487 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
10491 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
10492 fn clone(&self) -> Self {
10494 a: Clone::clone(&self.a),
10495 b: Clone::clone(&self.b),
10500 /// Creates a new tuple which has the same data as `orig`
10501 /// but with all dynamically-allocated buffers duplicated in new buffers.
10502 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
10503 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
10505 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
10506 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
10510 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
10511 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
10513 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
10514 /// This corresponds to std::vector in C++
10515 pub struct CVec_TransactionOutputsZ {
10516 /// The elements in the array.
10517 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10518 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
10519 /// The number of elements pointed to by `data`.
10522 impl CVec_TransactionOutputsZ {
10523 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
10524 if self.datalen == 0 { return Vec::new(); }
10525 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10526 self.data = core::ptr::null_mut();
10530 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
10531 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10534 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
10535 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
10536 let datalen = v.len();
10537 let data = Box::into_raw(v.into_boxed_slice());
10538 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10542 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10543 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
10544 impl Drop for CVec_TransactionOutputsZ {
10545 fn drop(&mut self) {
10546 if self.datalen == 0 { return; }
10547 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10550 impl Clone for CVec_TransactionOutputsZ {
10551 fn clone(&self) -> Self {
10552 let mut res = Vec::new();
10553 if self.datalen == 0 { return Self::from(res); }
10554 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10559 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
10560 /// This corresponds to std::vector in C++
10561 pub struct CVec_BalanceZ {
10562 /// The elements in the array.
10563 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10564 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
10565 /// The number of elements pointed to by `data`.
10568 impl CVec_BalanceZ {
10569 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
10570 if self.datalen == 0 { return Vec::new(); }
10571 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10572 self.data = core::ptr::null_mut();
10576 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
10577 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10580 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
10581 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
10582 let datalen = v.len();
10583 let data = Box::into_raw(v.into_boxed_slice());
10584 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10588 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10589 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
10590 impl Drop for CVec_BalanceZ {
10591 fn drop(&mut self) {
10592 if self.datalen == 0 { return; }
10593 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10596 impl Clone for CVec_BalanceZ {
10597 fn clone(&self) -> Self {
10598 let mut res = Vec::new();
10599 if self.datalen == 0 { return Self::from(res); }
10600 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10605 /// A tuple of 2 elements. See the individual fields for the types contained.
10606 pub struct C2Tuple_BlockHashChannelMonitorZ {
10607 /// The element at position 0
10608 pub a: crate::c_types::ThirtyTwoBytes,
10609 /// The element at position 1
10610 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
10612 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
10613 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
10620 impl C2Tuple_BlockHashChannelMonitorZ {
10621 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
10625 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
10627 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
10628 C2Tuple_BlockHashChannelMonitorZ { a, b, }
10632 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
10633 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
10635 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
10636 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10637 /// A pointer to the contents in the success state.
10638 /// Reading from this pointer when `result_ok` is not set is undefined.
10639 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
10640 /// A pointer to the contents in the error state.
10641 /// Reading from this pointer when `result_ok` is set is undefined.
10642 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10645 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
10646 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10648 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10649 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
10650 /// `err` or `result` depending on the state of `result_ok`.
10651 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
10652 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
10653 pub result_ok: bool,
10656 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10657 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10658 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10659 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10660 result: Box::into_raw(Box::new(o)),
10666 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10667 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10668 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10669 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10670 err: Box::into_raw(Box::new(e)),
10675 /// Checks if the given object is currently in the success state
10677 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10681 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10682 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10683 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10684 fn drop(&mut self) {
10685 if self.result_ok {
10686 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10687 let _ = unsafe { Box::from_raw(self.contents.result) };
10690 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10691 let _ = unsafe { Box::from_raw(self.contents.err) };
10696 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10697 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10698 let contents = if o.result_ok {
10699 let result = unsafe { o.contents.result };
10700 unsafe { o.contents.result = core::ptr::null_mut() };
10701 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10703 let err = unsafe { o.contents.err };
10704 unsafe { o.contents.err = core::ptr::null_mut(); }
10705 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10709 result_ok: o.result_ok,
10714 /// A tuple of 2 elements. See the individual fields for the types contained.
10715 pub struct C2Tuple_PublicKeyTypeZ {
10716 /// The element at position 0
10717 pub a: crate::c_types::PublicKey,
10718 /// The element at position 1
10719 pub b: crate::lightning::ln::wire::Type,
10721 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10722 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10729 impl C2Tuple_PublicKeyTypeZ {
10730 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10734 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10736 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10737 C2Tuple_PublicKeyTypeZ { a, b, }
10741 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10742 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10744 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10745 /// This corresponds to std::vector in C++
10746 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10747 /// The elements in the array.
10748 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10749 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10750 /// The number of elements pointed to by `data`.
10753 impl CVec_C2Tuple_PublicKeyTypeZZ {
10754 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10755 if self.datalen == 0 { return Vec::new(); }
10756 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10757 self.data = core::ptr::null_mut();
10761 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10762 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10765 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10766 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10767 let datalen = v.len();
10768 let data = Box::into_raw(v.into_boxed_slice());
10769 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10773 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10774 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10775 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10776 fn drop(&mut self) {
10777 if self.datalen == 0 { return; }
10778 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10783 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
10784 pub enum COption_OffersMessageZ {
10785 /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
10786 Some(crate::lightning::onion_message::offers::OffersMessage),
10787 /// When we're in this state, this COption_OffersMessageZ contains nothing
10790 impl COption_OffersMessageZ {
10791 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10792 if let Self::None = self { false } else { true }
10794 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10797 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
10798 if let Self::Some(v) = self { v } else { unreachable!() }
10802 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
10803 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
10804 COption_OffersMessageZ::Some(o)
10807 /// Constructs a new COption_OffersMessageZ containing nothing
10808 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
10809 COption_OffersMessageZ::None
10812 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
10813 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
10815 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
10816 /// but with all dynamically-allocated buffers duplicated in new buffers.
10817 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
10819 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
10820 pub enum COption_CustomOnionMessageContentsZ {
10821 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
10822 Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
10823 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
10826 impl COption_CustomOnionMessageContentsZ {
10827 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10828 if let Self::None = self { false } else { true }
10830 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10833 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
10834 if let Self::Some(v) = self { v } else { unreachable!() }
10838 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
10839 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
10840 COption_CustomOnionMessageContentsZ::Some(o)
10843 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
10844 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
10845 COption_CustomOnionMessageContentsZ::None
10848 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
10849 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
10851 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
10852 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
10853 /// A pointer to the contents in the success state.
10854 /// Reading from this pointer when `result_ok` is not set is undefined.
10855 pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
10856 /// A pointer to the contents in the error state.
10857 /// Reading from this pointer when `result_ok` is set is undefined.
10858 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10861 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
10862 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10864 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10865 /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
10866 /// `err` or `result` depending on the state of `result_ok`.
10867 pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
10868 /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
10869 pub result_ok: bool,
10872 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
10873 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10874 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10875 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
10876 result: Box::into_raw(Box::new(o)),
10882 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
10883 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10884 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10885 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
10886 err: Box::into_raw(Box::new(e)),
10891 /// Checks if the given object is currently in the success state
10893 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
10897 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
10898 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
10899 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10900 fn drop(&mut self) {
10901 if self.result_ok {
10902 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10903 let _ = unsafe { Box::from_raw(self.contents.result) };
10906 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10907 let _ = unsafe { Box::from_raw(self.contents.err) };
10912 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10913 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10914 let contents = if o.result_ok {
10915 let result = unsafe { o.contents.result };
10916 unsafe { o.contents.result = core::ptr::null_mut() };
10917 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
10919 let err = unsafe { o.contents.err };
10920 unsafe { o.contents.err = core::ptr::null_mut(); }
10921 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
10925 result_ok: o.result_ok,
10930 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
10931 pub enum COption_TypeZ {
10932 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
10933 Some(crate::lightning::ln::wire::Type),
10934 /// When we're in this state, this COption_TypeZ contains nothing
10937 impl COption_TypeZ {
10938 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10939 if let Self::None = self { false } else { true }
10941 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10944 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
10945 if let Self::Some(v) = self { v } else { unreachable!() }
10949 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
10950 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
10951 COption_TypeZ::Some(o)
10954 /// Constructs a new COption_TypeZ containing nothing
10955 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
10956 COption_TypeZ::None
10959 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
10960 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
10962 /// The contents of CResult_COption_TypeZDecodeErrorZ
10963 pub union CResult_COption_TypeZDecodeErrorZPtr {
10964 /// A pointer to the contents in the success state.
10965 /// Reading from this pointer when `result_ok` is not set is undefined.
10966 pub result: *mut crate::c_types::derived::COption_TypeZ,
10967 /// A pointer to the contents in the error state.
10968 /// Reading from this pointer when `result_ok` is set is undefined.
10969 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10972 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10973 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10974 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10975 pub struct CResult_COption_TypeZDecodeErrorZ {
10976 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10977 /// `err` or `result` depending on the state of `result_ok`.
10978 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
10979 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10980 pub result_ok: bool,
10983 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
10984 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
10985 CResult_COption_TypeZDecodeErrorZ {
10986 contents: CResult_COption_TypeZDecodeErrorZPtr {
10987 result: Box::into_raw(Box::new(o)),
10993 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
10994 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
10995 CResult_COption_TypeZDecodeErrorZ {
10996 contents: CResult_COption_TypeZDecodeErrorZPtr {
10997 err: Box::into_raw(Box::new(e)),
11002 /// Checks if the given object is currently in the success state
11004 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
11008 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
11009 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
11010 impl Drop for CResult_COption_TypeZDecodeErrorZ {
11011 fn drop(&mut self) {
11012 if self.result_ok {
11013 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11014 let _ = unsafe { Box::from_raw(self.contents.result) };
11017 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11018 let _ = unsafe { Box::from_raw(self.contents.err) };
11023 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
11024 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11025 let contents = if o.result_ok {
11026 let result = unsafe { o.contents.result };
11027 unsafe { o.contents.result = core::ptr::null_mut() };
11028 CResult_COption_TypeZDecodeErrorZPtr { result }
11030 let err = unsafe { o.contents.err };
11031 unsafe { o.contents.err = core::ptr::null_mut(); }
11032 CResult_COption_TypeZDecodeErrorZPtr { err }
11036 result_ok: o.result_ok,
11042 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11043 pub enum COption_NetAddressZ {
11044 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11045 Some(crate::lightning::ln::msgs::NetAddress),
11046 /// When we're in this state, this COption_NetAddressZ contains nothing
11049 impl COption_NetAddressZ {
11050 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11051 if let Self::None = self { false } else { true }
11053 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11056 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11057 if let Self::Some(v) = self { v } else { unreachable!() }
11061 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11062 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11063 COption_NetAddressZ::Some(o)
11066 /// Constructs a new COption_NetAddressZ containing nothing
11067 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11068 COption_NetAddressZ::None
11071 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11072 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11074 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11075 /// but with all dynamically-allocated buffers duplicated in new buffers.
11076 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11078 /// A tuple of 2 elements. See the individual fields for the types contained.
11079 pub struct C2Tuple_PublicKeyCOption_NetAddressZZ {
11080 /// The element at position 0
11081 pub a: crate::c_types::PublicKey,
11082 /// The element at position 1
11083 pub b: crate::c_types::derived::COption_NetAddressZ,
11085 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)> for C2Tuple_PublicKeyCOption_NetAddressZZ {
11086 fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)) -> Self {
11093 impl C2Tuple_PublicKeyCOption_NetAddressZZ {
11094 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ) {
11098 impl Clone for C2Tuple_PublicKeyCOption_NetAddressZZ {
11099 fn clone(&self) -> Self {
11101 a: Clone::clone(&self.a),
11102 b: Clone::clone(&self.b),
11107 /// Creates a new tuple which has the same data as `orig`
11108 /// but with all dynamically-allocated buffers duplicated in new buffers.
11109 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_NetAddressZZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ { Clone::clone(&orig) }
11110 /// Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements.
11112 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_NetAddressZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ {
11113 C2Tuple_PublicKeyCOption_NetAddressZZ { a, b, }
11117 /// Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ.
11118 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res: C2Tuple_PublicKeyCOption_NetAddressZZ) { }
11120 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size.
11121 /// This corresponds to std::vector in C++
11122 pub struct CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11123 /// The elements in the array.
11124 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11125 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ,
11126 /// The number of elements pointed to by `data`.
11129 impl CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11130 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ> {
11131 if self.datalen == 0 { return Vec::new(); }
11132 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11133 self.data = core::ptr::null_mut();
11137 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ] {
11138 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11141 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11142 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>) -> Self {
11143 let datalen = v.len();
11144 let data = Box::into_raw(v.into_boxed_slice());
11145 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11149 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11150 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ) { }
11151 impl Drop for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11152 fn drop(&mut self) {
11153 if self.datalen == 0 { return; }
11154 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11157 impl Clone for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11158 fn clone(&self) -> Self {
11159 let mut res = Vec::new();
11160 if self.datalen == 0 { return Self::from(res); }
11161 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11166 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11167 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11168 /// A pointer to the contents in the success state.
11169 /// Reading from this pointer when `result_ok` is not set is undefined.
11170 pub result: *mut crate::c_types::derived::CVec_u8Z,
11171 /// A pointer to the contents in the error state.
11172 /// Reading from this pointer when `result_ok` is set is undefined.
11173 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11176 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11177 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11179 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11180 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11181 /// `err` or `result` depending on the state of `result_ok`.
11182 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11183 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11184 pub result_ok: bool,
11187 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11188 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11189 CResult_CVec_u8ZPeerHandleErrorZ {
11190 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11191 result: Box::into_raw(Box::new(o)),
11197 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11198 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11199 CResult_CVec_u8ZPeerHandleErrorZ {
11200 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11201 err: Box::into_raw(Box::new(e)),
11206 /// Checks if the given object is currently in the success state
11208 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11212 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11213 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11214 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11215 fn drop(&mut self) {
11216 if self.result_ok {
11217 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11218 let _ = unsafe { Box::from_raw(self.contents.result) };
11221 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11222 let _ = unsafe { Box::from_raw(self.contents.err) };
11227 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11228 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11229 let contents = if o.result_ok {
11230 let result = unsafe { o.contents.result };
11231 unsafe { o.contents.result = core::ptr::null_mut() };
11232 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11234 let err = unsafe { o.contents.err };
11235 unsafe { o.contents.err = core::ptr::null_mut(); }
11236 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11240 result_ok: o.result_ok,
11244 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11245 fn clone(&self) -> Self {
11246 if self.result_ok {
11247 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11248 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11251 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11252 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11258 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11259 /// but with all dynamically-allocated buffers duplicated in new buffers.
11260 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11262 /// The contents of CResult_NonePeerHandleErrorZ
11263 pub union CResult_NonePeerHandleErrorZPtr {
11264 /// Note that this value is always NULL, as there are no contents in the OK variant
11265 pub result: *mut core::ffi::c_void,
11266 /// A pointer to the contents in the error state.
11267 /// Reading from this pointer when `result_ok` is set is undefined.
11268 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11271 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11272 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11274 pub struct CResult_NonePeerHandleErrorZ {
11275 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11276 /// `err` or `result` depending on the state of `result_ok`.
11277 pub contents: CResult_NonePeerHandleErrorZPtr,
11278 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11279 pub result_ok: bool,
11282 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11283 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11284 CResult_NonePeerHandleErrorZ {
11285 contents: CResult_NonePeerHandleErrorZPtr {
11286 result: core::ptr::null_mut(),
11292 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11293 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11294 CResult_NonePeerHandleErrorZ {
11295 contents: CResult_NonePeerHandleErrorZPtr {
11296 err: Box::into_raw(Box::new(e)),
11301 /// Checks if the given object is currently in the success state
11303 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11307 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11308 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11309 impl Drop for CResult_NonePeerHandleErrorZ {
11310 fn drop(&mut self) {
11311 if self.result_ok {
11313 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11314 let _ = unsafe { Box::from_raw(self.contents.err) };
11319 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11320 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11321 let contents = if o.result_ok {
11322 let _ = unsafe { Box::from_raw(o.contents.result) };
11323 o.contents.result = core::ptr::null_mut();
11324 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11326 let err = unsafe { o.contents.err };
11327 unsafe { o.contents.err = core::ptr::null_mut(); }
11328 CResult_NonePeerHandleErrorZPtr { err }
11332 result_ok: o.result_ok,
11336 impl Clone for CResult_NonePeerHandleErrorZ {
11337 fn clone(&self) -> Self {
11338 if self.result_ok {
11339 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11340 result: core::ptr::null_mut()
11343 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11344 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11350 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11351 /// but with all dynamically-allocated buffers duplicated in new buffers.
11352 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11354 /// The contents of CResult_boolPeerHandleErrorZ
11355 pub union CResult_boolPeerHandleErrorZPtr {
11356 /// A pointer to the contents in the success state.
11357 /// Reading from this pointer when `result_ok` is not set is undefined.
11358 pub result: *mut bool,
11359 /// A pointer to the contents in the error state.
11360 /// Reading from this pointer when `result_ok` is set is undefined.
11361 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11364 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11365 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11367 pub struct CResult_boolPeerHandleErrorZ {
11368 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11369 /// `err` or `result` depending on the state of `result_ok`.
11370 pub contents: CResult_boolPeerHandleErrorZPtr,
11371 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11372 pub result_ok: bool,
11375 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11376 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11377 CResult_boolPeerHandleErrorZ {
11378 contents: CResult_boolPeerHandleErrorZPtr {
11379 result: Box::into_raw(Box::new(o)),
11385 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11386 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
11387 CResult_boolPeerHandleErrorZ {
11388 contents: CResult_boolPeerHandleErrorZPtr {
11389 err: Box::into_raw(Box::new(e)),
11394 /// Checks if the given object is currently in the success state
11396 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
11400 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
11401 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
11402 impl Drop for CResult_boolPeerHandleErrorZ {
11403 fn drop(&mut self) {
11404 if self.result_ok {
11405 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11406 let _ = unsafe { Box::from_raw(self.contents.result) };
11409 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11410 let _ = unsafe { Box::from_raw(self.contents.err) };
11415 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
11416 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11417 let contents = if o.result_ok {
11418 let result = unsafe { o.contents.result };
11419 unsafe { o.contents.result = core::ptr::null_mut() };
11420 CResult_boolPeerHandleErrorZPtr { result }
11422 let err = unsafe { o.contents.err };
11423 unsafe { o.contents.err = core::ptr::null_mut(); }
11424 CResult_boolPeerHandleErrorZPtr { err }
11428 result_ok: o.result_ok,
11432 impl Clone for CResult_boolPeerHandleErrorZ {
11433 fn clone(&self) -> Self {
11434 if self.result_ok {
11435 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
11436 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
11439 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
11440 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11446 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
11447 /// but with all dynamically-allocated buffers duplicated in new buffers.
11448 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
11450 /// The contents of CResult_u32GraphSyncErrorZ
11451 pub union CResult_u32GraphSyncErrorZPtr {
11452 /// A pointer to the contents in the success state.
11453 /// Reading from this pointer when `result_ok` is not set is undefined.
11454 pub result: *mut u32,
11455 /// A pointer to the contents in the error state.
11456 /// Reading from this pointer when `result_ok` is set is undefined.
11457 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
11460 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
11461 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
11462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11463 pub struct CResult_u32GraphSyncErrorZ {
11464 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
11465 /// `err` or `result` depending on the state of `result_ok`.
11466 pub contents: CResult_u32GraphSyncErrorZPtr,
11467 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
11468 pub result_ok: bool,
11471 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
11472 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
11473 CResult_u32GraphSyncErrorZ {
11474 contents: CResult_u32GraphSyncErrorZPtr {
11475 result: Box::into_raw(Box::new(o)),
11481 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
11482 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
11483 CResult_u32GraphSyncErrorZ {
11484 contents: CResult_u32GraphSyncErrorZPtr {
11485 err: Box::into_raw(Box::new(e)),
11490 /// Checks if the given object is currently in the success state
11492 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
11496 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
11497 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
11498 impl Drop for CResult_u32GraphSyncErrorZ {
11499 fn drop(&mut self) {
11500 if self.result_ok {
11501 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11502 let _ = unsafe { Box::from_raw(self.contents.result) };
11505 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11506 let _ = unsafe { Box::from_raw(self.contents.err) };
11511 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
11512 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
11513 let contents = if o.result_ok {
11514 let result = unsafe { o.contents.result };
11515 unsafe { o.contents.result = core::ptr::null_mut() };
11516 CResult_u32GraphSyncErrorZPtr { result }
11518 let err = unsafe { o.contents.err };
11519 unsafe { o.contents.err = core::ptr::null_mut(); }
11520 CResult_u32GraphSyncErrorZPtr { err }
11524 result_ok: o.result_ok,
11530 /// An enum which can either contain a crate::c_types::SecretKey or not
11531 pub enum COption_KeyPairZ {
11532 /// When we're in this state, this COption_KeyPairZ contains a crate::c_types::SecretKey
11533 Some(crate::c_types::SecretKey),
11534 /// When we're in this state, this COption_KeyPairZ contains nothing
11537 impl COption_KeyPairZ {
11538 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11539 if let Self::None = self { false } else { true }
11541 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11544 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
11545 if let Self::Some(v) = self { v } else { unreachable!() }
11549 /// Constructs a new COption_KeyPairZ containing a crate::c_types::SecretKey
11550 pub extern "C" fn COption_KeyPairZ_some(o: crate::c_types::SecretKey) -> COption_KeyPairZ {
11551 COption_KeyPairZ::Some(o)
11554 /// Constructs a new COption_KeyPairZ containing nothing
11555 pub extern "C" fn COption_KeyPairZ_none() -> COption_KeyPairZ {
11556 COption_KeyPairZ::None
11559 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
11560 pub extern "C" fn COption_KeyPairZ_free(_res: COption_KeyPairZ) { }
11562 /// Creates a new COption_KeyPairZ which has the same data as `orig`
11563 /// but with all dynamically-allocated buffers duplicated in new buffers.
11564 pub extern "C" fn COption_KeyPairZ_clone(orig: &COption_KeyPairZ) -> COption_KeyPairZ { Clone::clone(&orig) }
11566 /// The contents of CResult_COption_KeyPairZNoneZ
11567 pub union CResult_COption_KeyPairZNoneZPtr {
11568 /// A pointer to the contents in the success state.
11569 /// Reading from this pointer when `result_ok` is not set is undefined.
11570 pub result: *mut crate::c_types::derived::COption_KeyPairZ,
11571 /// Note that this value is always NULL, as there are no contents in the Err variant
11572 pub err: *mut core::ffi::c_void,
11575 /// A CResult_COption_KeyPairZNoneZ represents the result of a fallible operation,
11576 /// containing a crate::c_types::derived::COption_KeyPairZ on success and a () on failure.
11577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11578 pub struct CResult_COption_KeyPairZNoneZ {
11579 /// The contents of this CResult_COption_KeyPairZNoneZ, accessible via either
11580 /// `err` or `result` depending on the state of `result_ok`.
11581 pub contents: CResult_COption_KeyPairZNoneZPtr,
11582 /// Whether this CResult_COption_KeyPairZNoneZ represents a success state.
11583 pub result_ok: bool,
11586 /// Creates a new CResult_COption_KeyPairZNoneZ in the success state.
11587 pub extern "C" fn CResult_COption_KeyPairZNoneZ_ok(o: crate::c_types::derived::COption_KeyPairZ) -> CResult_COption_KeyPairZNoneZ {
11588 CResult_COption_KeyPairZNoneZ {
11589 contents: CResult_COption_KeyPairZNoneZPtr {
11590 result: Box::into_raw(Box::new(o)),
11596 /// Creates a new CResult_COption_KeyPairZNoneZ in the error state.
11597 pub extern "C" fn CResult_COption_KeyPairZNoneZ_err() -> CResult_COption_KeyPairZNoneZ {
11598 CResult_COption_KeyPairZNoneZ {
11599 contents: CResult_COption_KeyPairZNoneZPtr {
11600 err: core::ptr::null_mut(),
11605 /// Checks if the given object is currently in the success state
11607 pub extern "C" fn CResult_COption_KeyPairZNoneZ_is_ok(o: &CResult_COption_KeyPairZNoneZ) -> bool {
11611 /// Frees any resources used by the CResult_COption_KeyPairZNoneZ.
11612 pub extern "C" fn CResult_COption_KeyPairZNoneZ_free(_res: CResult_COption_KeyPairZNoneZ) { }
11613 impl Drop for CResult_COption_KeyPairZNoneZ {
11614 fn drop(&mut self) {
11615 if self.result_ok {
11616 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11617 let _ = unsafe { Box::from_raw(self.contents.result) };
11623 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_KeyPairZ, ()>> for CResult_COption_KeyPairZNoneZ {
11624 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_KeyPairZ, ()>) -> Self {
11625 let contents = if o.result_ok {
11626 let result = unsafe { o.contents.result };
11627 unsafe { o.contents.result = core::ptr::null_mut() };
11628 CResult_COption_KeyPairZNoneZPtr { result }
11630 let _ = unsafe { Box::from_raw(o.contents.err) };
11631 o.contents.err = core::ptr::null_mut();
11632 CResult_COption_KeyPairZNoneZPtr { err: core::ptr::null_mut() }
11636 result_ok: o.result_ok,
11640 impl Clone for CResult_COption_KeyPairZNoneZ {
11641 fn clone(&self) -> Self {
11642 if self.result_ok {
11643 Self { result_ok: true, contents: CResult_COption_KeyPairZNoneZPtr {
11644 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_KeyPairZ>::clone(unsafe { &*self.contents.result })))
11647 Self { result_ok: false, contents: CResult_COption_KeyPairZNoneZPtr {
11648 err: core::ptr::null_mut()
11654 /// Creates a new CResult_COption_KeyPairZNoneZ which has the same data as `orig`
11655 /// but with all dynamically-allocated buffers duplicated in new buffers.
11656 pub extern "C" fn CResult_COption_KeyPairZNoneZ_clone(orig: &CResult_COption_KeyPairZNoneZ) -> CResult_COption_KeyPairZNoneZ { Clone::clone(&orig) }
11659 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
11660 pub enum COption_ScriptZ {
11661 /// When we're in this state, this COption_ScriptZ contains a crate::c_types::derived::CVec_u8Z
11662 Some(crate::c_types::derived::CVec_u8Z),
11663 /// When we're in this state, this COption_ScriptZ contains nothing
11666 impl COption_ScriptZ {
11667 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11668 if let Self::None = self { false } else { true }
11670 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11673 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
11674 if let Self::Some(v) = self { v } else { unreachable!() }
11678 /// Constructs a new COption_ScriptZ containing a crate::c_types::derived::CVec_u8Z
11679 pub extern "C" fn COption_ScriptZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_ScriptZ {
11680 COption_ScriptZ::Some(o)
11683 /// Constructs a new COption_ScriptZ containing nothing
11684 pub extern "C" fn COption_ScriptZ_none() -> COption_ScriptZ {
11685 COption_ScriptZ::None
11688 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
11689 pub extern "C" fn COption_ScriptZ_free(_res: COption_ScriptZ) { }
11691 /// Creates a new COption_ScriptZ which has the same data as `orig`
11692 /// but with all dynamically-allocated buffers duplicated in new buffers.
11693 pub extern "C" fn COption_ScriptZ_clone(orig: &COption_ScriptZ) -> COption_ScriptZ { Clone::clone(&orig) }
11695 /// An enum which can either contain a or not
11696 pub enum COption_NoneZ {
11697 /// When we're in this state, this COption_NoneZ contains a
11699 /// When we're in this state, this COption_NoneZ contains nothing
11702 impl COption_NoneZ {
11703 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11704 if let Self::None = self { false } else { true }
11706 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11711 /// Constructs a new COption_NoneZ containing a
11712 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
11713 COption_NoneZ::Some
11716 /// Constructs a new COption_NoneZ containing nothing
11717 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
11718 COption_NoneZ::None
11721 /// Frees any resources associated with the , if we are in the Some state
11722 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
11724 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
11725 /// This corresponds to std::vector in C++
11726 pub struct CVec_WitnessZ {
11727 /// The elements in the array.
11728 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11729 pub data: *mut crate::c_types::Witness,
11730 /// The number of elements pointed to by `data`.
11733 impl CVec_WitnessZ {
11734 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
11735 if self.datalen == 0 { return Vec::new(); }
11736 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11737 self.data = core::ptr::null_mut();
11741 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
11742 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11745 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
11746 fn from(v: Vec<crate::c_types::Witness>) -> Self {
11747 let datalen = v.len();
11748 let data = Box::into_raw(v.into_boxed_slice());
11749 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11753 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11754 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
11755 impl Drop for CVec_WitnessZ {
11756 fn drop(&mut self) {
11757 if self.datalen == 0 { return; }
11758 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11761 impl Clone for CVec_WitnessZ {
11762 fn clone(&self) -> Self {
11763 let mut res = Vec::new();
11764 if self.datalen == 0 { return Self::from(res); }
11765 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11771 /// An enum which can either contain a i64 or not
11772 pub enum COption_i64Z {
11773 /// When we're in this state, this COption_i64Z contains a i64
11775 /// When we're in this state, this COption_i64Z contains nothing
11778 impl COption_i64Z {
11779 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11780 if let Self::None = self { false } else { true }
11782 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11785 #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
11786 if let Self::Some(v) = self { v } else { unreachable!() }
11790 /// Constructs a new COption_i64Z containing a i64
11791 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
11792 COption_i64Z::Some(o)
11795 /// Constructs a new COption_i64Z containing nothing
11796 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
11800 /// Frees any resources associated with the i64, if we are in the Some state
11801 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
11803 /// Creates a new COption_i64Z which has the same data as `orig`
11804 /// but with all dynamically-allocated buffers duplicated in new buffers.
11805 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
11808 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
11809 pub enum COption_TxidZ {
11810 /// When we're in this state, this COption_TxidZ contains a crate::c_types::ThirtyTwoBytes
11811 Some(crate::c_types::ThirtyTwoBytes),
11812 /// When we're in this state, this COption_TxidZ contains nothing
11815 impl COption_TxidZ {
11816 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11817 if let Self::None = self { false } else { true }
11819 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11822 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
11823 if let Self::Some(v) = self { v } else { unreachable!() }
11827 /// Constructs a new COption_TxidZ containing a crate::c_types::ThirtyTwoBytes
11828 pub extern "C" fn COption_TxidZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_TxidZ {
11829 COption_TxidZ::Some(o)
11832 /// Constructs a new COption_TxidZ containing nothing
11833 pub extern "C" fn COption_TxidZ_none() -> COption_TxidZ {
11834 COption_TxidZ::None
11837 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
11838 pub extern "C" fn COption_TxidZ_free(_res: COption_TxidZ) { }
11840 /// Creates a new COption_TxidZ which has the same data as `orig`
11841 /// but with all dynamically-allocated buffers duplicated in new buffers.
11842 pub extern "C" fn COption_TxidZ_clone(orig: &COption_TxidZ) -> COption_TxidZ { Clone::clone(&orig) }
11844 /// The contents of CResult_NetAddressDecodeErrorZ
11845 pub union CResult_NetAddressDecodeErrorZPtr {
11846 /// A pointer to the contents in the success state.
11847 /// Reading from this pointer when `result_ok` is not set is undefined.
11848 pub result: *mut crate::lightning::ln::msgs::NetAddress,
11849 /// A pointer to the contents in the error state.
11850 /// Reading from this pointer when `result_ok` is set is undefined.
11851 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11854 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11855 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11856 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11857 pub struct CResult_NetAddressDecodeErrorZ {
11858 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11859 /// `err` or `result` depending on the state of `result_ok`.
11860 pub contents: CResult_NetAddressDecodeErrorZPtr,
11861 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11862 pub result_ok: bool,
11865 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11866 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11867 CResult_NetAddressDecodeErrorZ {
11868 contents: CResult_NetAddressDecodeErrorZPtr {
11869 result: Box::into_raw(Box::new(o)),
11875 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11876 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11877 CResult_NetAddressDecodeErrorZ {
11878 contents: CResult_NetAddressDecodeErrorZPtr {
11879 err: Box::into_raw(Box::new(e)),
11884 /// Checks if the given object is currently in the success state
11886 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11890 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11891 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11892 impl Drop for CResult_NetAddressDecodeErrorZ {
11893 fn drop(&mut self) {
11894 if self.result_ok {
11895 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11896 let _ = unsafe { Box::from_raw(self.contents.result) };
11899 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11900 let _ = unsafe { Box::from_raw(self.contents.err) };
11905 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11906 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11907 let contents = if o.result_ok {
11908 let result = unsafe { o.contents.result };
11909 unsafe { o.contents.result = core::ptr::null_mut() };
11910 CResult_NetAddressDecodeErrorZPtr { result }
11912 let err = unsafe { o.contents.err };
11913 unsafe { o.contents.err = core::ptr::null_mut(); }
11914 CResult_NetAddressDecodeErrorZPtr { err }
11918 result_ok: o.result_ok,
11922 impl Clone for CResult_NetAddressDecodeErrorZ {
11923 fn clone(&self) -> Self {
11924 if self.result_ok {
11925 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11926 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11929 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11930 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11936 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11937 /// but with all dynamically-allocated buffers duplicated in new buffers.
11938 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11940 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11941 /// This corresponds to std::vector in C++
11942 pub struct CVec_UpdateAddHTLCZ {
11943 /// The elements in the array.
11944 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11945 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11946 /// The number of elements pointed to by `data`.
11949 impl CVec_UpdateAddHTLCZ {
11950 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11951 if self.datalen == 0 { return Vec::new(); }
11952 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11953 self.data = core::ptr::null_mut();
11957 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11958 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11961 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11962 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11963 let datalen = v.len();
11964 let data = Box::into_raw(v.into_boxed_slice());
11965 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11969 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11970 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11971 impl Drop for CVec_UpdateAddHTLCZ {
11972 fn drop(&mut self) {
11973 if self.datalen == 0 { return; }
11974 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11977 impl Clone for CVec_UpdateAddHTLCZ {
11978 fn clone(&self) -> Self {
11979 let mut res = Vec::new();
11980 if self.datalen == 0 { return Self::from(res); }
11981 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11986 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11987 /// This corresponds to std::vector in C++
11988 pub struct CVec_UpdateFulfillHTLCZ {
11989 /// The elements in the array.
11990 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11991 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11992 /// The number of elements pointed to by `data`.
11995 impl CVec_UpdateFulfillHTLCZ {
11996 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11997 if self.datalen == 0 { return Vec::new(); }
11998 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11999 self.data = core::ptr::null_mut();
12003 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12004 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12007 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12008 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12009 let datalen = v.len();
12010 let data = Box::into_raw(v.into_boxed_slice());
12011 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12015 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12016 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12017 impl Drop for CVec_UpdateFulfillHTLCZ {
12018 fn drop(&mut self) {
12019 if self.datalen == 0 { return; }
12020 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12023 impl Clone for CVec_UpdateFulfillHTLCZ {
12024 fn clone(&self) -> Self {
12025 let mut res = Vec::new();
12026 if self.datalen == 0 { return Self::from(res); }
12027 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12032 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12033 /// This corresponds to std::vector in C++
12034 pub struct CVec_UpdateFailHTLCZ {
12035 /// The elements in the array.
12036 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12037 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12038 /// The number of elements pointed to by `data`.
12041 impl CVec_UpdateFailHTLCZ {
12042 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12043 if self.datalen == 0 { return Vec::new(); }
12044 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12045 self.data = core::ptr::null_mut();
12049 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12050 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12053 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12054 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12055 let datalen = v.len();
12056 let data = Box::into_raw(v.into_boxed_slice());
12057 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12061 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12062 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12063 impl Drop for CVec_UpdateFailHTLCZ {
12064 fn drop(&mut self) {
12065 if self.datalen == 0 { return; }
12066 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12069 impl Clone for CVec_UpdateFailHTLCZ {
12070 fn clone(&self) -> Self {
12071 let mut res = Vec::new();
12072 if self.datalen == 0 { return Self::from(res); }
12073 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12078 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12079 /// This corresponds to std::vector in C++
12080 pub struct CVec_UpdateFailMalformedHTLCZ {
12081 /// The elements in the array.
12082 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12083 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12084 /// The number of elements pointed to by `data`.
12087 impl CVec_UpdateFailMalformedHTLCZ {
12088 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12089 if self.datalen == 0 { return Vec::new(); }
12090 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12091 self.data = core::ptr::null_mut();
12095 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12096 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12099 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12100 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12101 let datalen = v.len();
12102 let data = Box::into_raw(v.into_boxed_slice());
12103 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12107 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12108 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12109 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12110 fn drop(&mut self) {
12111 if self.datalen == 0 { return; }
12112 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12115 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12116 fn clone(&self) -> Self {
12117 let mut res = Vec::new();
12118 if self.datalen == 0 { return Self::from(res); }
12119 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12124 /// The contents of CResult_AcceptChannelDecodeErrorZ
12125 pub union CResult_AcceptChannelDecodeErrorZPtr {
12126 /// A pointer to the contents in the success state.
12127 /// Reading from this pointer when `result_ok` is not set is undefined.
12128 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12129 /// A pointer to the contents in the error state.
12130 /// Reading from this pointer when `result_ok` is set is undefined.
12131 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12134 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12135 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12136 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12137 pub struct CResult_AcceptChannelDecodeErrorZ {
12138 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12139 /// `err` or `result` depending on the state of `result_ok`.
12140 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12141 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12142 pub result_ok: bool,
12145 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12146 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12147 CResult_AcceptChannelDecodeErrorZ {
12148 contents: CResult_AcceptChannelDecodeErrorZPtr {
12149 result: Box::into_raw(Box::new(o)),
12155 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12156 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12157 CResult_AcceptChannelDecodeErrorZ {
12158 contents: CResult_AcceptChannelDecodeErrorZPtr {
12159 err: Box::into_raw(Box::new(e)),
12164 /// Checks if the given object is currently in the success state
12166 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12170 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12171 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12172 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12173 fn drop(&mut self) {
12174 if self.result_ok {
12175 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12176 let _ = unsafe { Box::from_raw(self.contents.result) };
12179 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12180 let _ = unsafe { Box::from_raw(self.contents.err) };
12185 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12186 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12187 let contents = if o.result_ok {
12188 let result = unsafe { o.contents.result };
12189 unsafe { o.contents.result = core::ptr::null_mut() };
12190 CResult_AcceptChannelDecodeErrorZPtr { result }
12192 let err = unsafe { o.contents.err };
12193 unsafe { o.contents.err = core::ptr::null_mut(); }
12194 CResult_AcceptChannelDecodeErrorZPtr { err }
12198 result_ok: o.result_ok,
12202 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12203 fn clone(&self) -> Self {
12204 if self.result_ok {
12205 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12206 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12209 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12210 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12216 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12217 /// but with all dynamically-allocated buffers duplicated in new buffers.
12218 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12220 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
12221 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
12222 /// A pointer to the contents in the success state.
12223 /// Reading from this pointer when `result_ok` is not set is undefined.
12224 pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
12225 /// A pointer to the contents in the error state.
12226 /// Reading from this pointer when `result_ok` is set is undefined.
12227 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12230 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
12231 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
12232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12233 pub struct CResult_AcceptChannelV2DecodeErrorZ {
12234 /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
12235 /// `err` or `result` depending on the state of `result_ok`.
12236 pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
12237 /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
12238 pub result_ok: bool,
12241 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
12242 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
12243 CResult_AcceptChannelV2DecodeErrorZ {
12244 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
12245 result: Box::into_raw(Box::new(o)),
12251 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
12252 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
12253 CResult_AcceptChannelV2DecodeErrorZ {
12254 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
12255 err: Box::into_raw(Box::new(e)),
12260 /// Checks if the given object is currently in the success state
12262 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
12266 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
12267 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
12268 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
12269 fn drop(&mut self) {
12270 if self.result_ok {
12271 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12272 let _ = unsafe { Box::from_raw(self.contents.result) };
12275 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12276 let _ = unsafe { Box::from_raw(self.contents.err) };
12281 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
12282 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
12283 let contents = if o.result_ok {
12284 let result = unsafe { o.contents.result };
12285 unsafe { o.contents.result = core::ptr::null_mut() };
12286 CResult_AcceptChannelV2DecodeErrorZPtr { result }
12288 let err = unsafe { o.contents.err };
12289 unsafe { o.contents.err = core::ptr::null_mut(); }
12290 CResult_AcceptChannelV2DecodeErrorZPtr { err }
12294 result_ok: o.result_ok,
12298 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
12299 fn clone(&self) -> Self {
12300 if self.result_ok {
12301 Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
12302 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
12305 Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
12306 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12312 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
12313 /// but with all dynamically-allocated buffers duplicated in new buffers.
12314 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
12316 /// The contents of CResult_TxAddInputDecodeErrorZ
12317 pub union CResult_TxAddInputDecodeErrorZPtr {
12318 /// A pointer to the contents in the success state.
12319 /// Reading from this pointer when `result_ok` is not set is undefined.
12320 pub result: *mut crate::lightning::ln::msgs::TxAddInput,
12321 /// A pointer to the contents in the error state.
12322 /// Reading from this pointer when `result_ok` is set is undefined.
12323 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12326 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
12327 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
12328 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12329 pub struct CResult_TxAddInputDecodeErrorZ {
12330 /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
12331 /// `err` or `result` depending on the state of `result_ok`.
12332 pub contents: CResult_TxAddInputDecodeErrorZPtr,
12333 /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
12334 pub result_ok: bool,
12337 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
12338 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
12339 CResult_TxAddInputDecodeErrorZ {
12340 contents: CResult_TxAddInputDecodeErrorZPtr {
12341 result: Box::into_raw(Box::new(o)),
12347 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
12348 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
12349 CResult_TxAddInputDecodeErrorZ {
12350 contents: CResult_TxAddInputDecodeErrorZPtr {
12351 err: Box::into_raw(Box::new(e)),
12356 /// Checks if the given object is currently in the success state
12358 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
12362 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
12363 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
12364 impl Drop for CResult_TxAddInputDecodeErrorZ {
12365 fn drop(&mut self) {
12366 if self.result_ok {
12367 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12368 let _ = unsafe { Box::from_raw(self.contents.result) };
12371 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12372 let _ = unsafe { Box::from_raw(self.contents.err) };
12377 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
12378 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
12379 let contents = if o.result_ok {
12380 let result = unsafe { o.contents.result };
12381 unsafe { o.contents.result = core::ptr::null_mut() };
12382 CResult_TxAddInputDecodeErrorZPtr { result }
12384 let err = unsafe { o.contents.err };
12385 unsafe { o.contents.err = core::ptr::null_mut(); }
12386 CResult_TxAddInputDecodeErrorZPtr { err }
12390 result_ok: o.result_ok,
12394 impl Clone for CResult_TxAddInputDecodeErrorZ {
12395 fn clone(&self) -> Self {
12396 if self.result_ok {
12397 Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
12398 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
12401 Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
12402 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12408 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
12409 /// but with all dynamically-allocated buffers duplicated in new buffers.
12410 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
12412 /// The contents of CResult_TxAddOutputDecodeErrorZ
12413 pub union CResult_TxAddOutputDecodeErrorZPtr {
12414 /// A pointer to the contents in the success state.
12415 /// Reading from this pointer when `result_ok` is not set is undefined.
12416 pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
12417 /// A pointer to the contents in the error state.
12418 /// Reading from this pointer when `result_ok` is set is undefined.
12419 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12422 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
12423 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
12424 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12425 pub struct CResult_TxAddOutputDecodeErrorZ {
12426 /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
12427 /// `err` or `result` depending on the state of `result_ok`.
12428 pub contents: CResult_TxAddOutputDecodeErrorZPtr,
12429 /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
12430 pub result_ok: bool,
12433 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
12434 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
12435 CResult_TxAddOutputDecodeErrorZ {
12436 contents: CResult_TxAddOutputDecodeErrorZPtr {
12437 result: Box::into_raw(Box::new(o)),
12443 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
12444 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
12445 CResult_TxAddOutputDecodeErrorZ {
12446 contents: CResult_TxAddOutputDecodeErrorZPtr {
12447 err: Box::into_raw(Box::new(e)),
12452 /// Checks if the given object is currently in the success state
12454 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
12458 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
12459 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
12460 impl Drop for CResult_TxAddOutputDecodeErrorZ {
12461 fn drop(&mut self) {
12462 if self.result_ok {
12463 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12464 let _ = unsafe { Box::from_raw(self.contents.result) };
12467 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12468 let _ = unsafe { Box::from_raw(self.contents.err) };
12473 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
12474 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
12475 let contents = if o.result_ok {
12476 let result = unsafe { o.contents.result };
12477 unsafe { o.contents.result = core::ptr::null_mut() };
12478 CResult_TxAddOutputDecodeErrorZPtr { result }
12480 let err = unsafe { o.contents.err };
12481 unsafe { o.contents.err = core::ptr::null_mut(); }
12482 CResult_TxAddOutputDecodeErrorZPtr { err }
12486 result_ok: o.result_ok,
12490 impl Clone for CResult_TxAddOutputDecodeErrorZ {
12491 fn clone(&self) -> Self {
12492 if self.result_ok {
12493 Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
12494 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
12497 Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
12498 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12504 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
12505 /// but with all dynamically-allocated buffers duplicated in new buffers.
12506 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
12508 /// The contents of CResult_TxRemoveInputDecodeErrorZ
12509 pub union CResult_TxRemoveInputDecodeErrorZPtr {
12510 /// A pointer to the contents in the success state.
12511 /// Reading from this pointer when `result_ok` is not set is undefined.
12512 pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
12513 /// A pointer to the contents in the error state.
12514 /// Reading from this pointer when `result_ok` is set is undefined.
12515 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12518 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
12519 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
12520 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12521 pub struct CResult_TxRemoveInputDecodeErrorZ {
12522 /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
12523 /// `err` or `result` depending on the state of `result_ok`.
12524 pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
12525 /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
12526 pub result_ok: bool,
12529 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
12530 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
12531 CResult_TxRemoveInputDecodeErrorZ {
12532 contents: CResult_TxRemoveInputDecodeErrorZPtr {
12533 result: Box::into_raw(Box::new(o)),
12539 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
12540 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
12541 CResult_TxRemoveInputDecodeErrorZ {
12542 contents: CResult_TxRemoveInputDecodeErrorZPtr {
12543 err: Box::into_raw(Box::new(e)),
12548 /// Checks if the given object is currently in the success state
12550 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
12554 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
12555 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
12556 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
12557 fn drop(&mut self) {
12558 if self.result_ok {
12559 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12560 let _ = unsafe { Box::from_raw(self.contents.result) };
12563 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12564 let _ = unsafe { Box::from_raw(self.contents.err) };
12569 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
12570 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
12571 let contents = if o.result_ok {
12572 let result = unsafe { o.contents.result };
12573 unsafe { o.contents.result = core::ptr::null_mut() };
12574 CResult_TxRemoveInputDecodeErrorZPtr { result }
12576 let err = unsafe { o.contents.err };
12577 unsafe { o.contents.err = core::ptr::null_mut(); }
12578 CResult_TxRemoveInputDecodeErrorZPtr { err }
12582 result_ok: o.result_ok,
12586 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
12587 fn clone(&self) -> Self {
12588 if self.result_ok {
12589 Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
12590 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
12593 Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
12594 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12600 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
12601 /// but with all dynamically-allocated buffers duplicated in new buffers.
12602 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
12604 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
12605 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
12606 /// A pointer to the contents in the success state.
12607 /// Reading from this pointer when `result_ok` is not set is undefined.
12608 pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
12609 /// A pointer to the contents in the error state.
12610 /// Reading from this pointer when `result_ok` is set is undefined.
12611 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12614 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
12615 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
12616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12617 pub struct CResult_TxRemoveOutputDecodeErrorZ {
12618 /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
12619 /// `err` or `result` depending on the state of `result_ok`.
12620 pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
12621 /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
12622 pub result_ok: bool,
12625 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
12626 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
12627 CResult_TxRemoveOutputDecodeErrorZ {
12628 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
12629 result: Box::into_raw(Box::new(o)),
12635 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
12636 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
12637 CResult_TxRemoveOutputDecodeErrorZ {
12638 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
12639 err: Box::into_raw(Box::new(e)),
12644 /// Checks if the given object is currently in the success state
12646 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
12650 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
12651 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
12652 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
12653 fn drop(&mut self) {
12654 if self.result_ok {
12655 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12656 let _ = unsafe { Box::from_raw(self.contents.result) };
12659 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12660 let _ = unsafe { Box::from_raw(self.contents.err) };
12665 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
12666 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
12667 let contents = if o.result_ok {
12668 let result = unsafe { o.contents.result };
12669 unsafe { o.contents.result = core::ptr::null_mut() };
12670 CResult_TxRemoveOutputDecodeErrorZPtr { result }
12672 let err = unsafe { o.contents.err };
12673 unsafe { o.contents.err = core::ptr::null_mut(); }
12674 CResult_TxRemoveOutputDecodeErrorZPtr { err }
12678 result_ok: o.result_ok,
12682 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
12683 fn clone(&self) -> Self {
12684 if self.result_ok {
12685 Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
12686 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
12689 Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
12690 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12696 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
12697 /// but with all dynamically-allocated buffers duplicated in new buffers.
12698 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
12700 /// The contents of CResult_TxCompleteDecodeErrorZ
12701 pub union CResult_TxCompleteDecodeErrorZPtr {
12702 /// A pointer to the contents in the success state.
12703 /// Reading from this pointer when `result_ok` is not set is undefined.
12704 pub result: *mut crate::lightning::ln::msgs::TxComplete,
12705 /// A pointer to the contents in the error state.
12706 /// Reading from this pointer when `result_ok` is set is undefined.
12707 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12710 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
12711 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
12712 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12713 pub struct CResult_TxCompleteDecodeErrorZ {
12714 /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
12715 /// `err` or `result` depending on the state of `result_ok`.
12716 pub contents: CResult_TxCompleteDecodeErrorZPtr,
12717 /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
12718 pub result_ok: bool,
12721 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
12722 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
12723 CResult_TxCompleteDecodeErrorZ {
12724 contents: CResult_TxCompleteDecodeErrorZPtr {
12725 result: Box::into_raw(Box::new(o)),
12731 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
12732 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
12733 CResult_TxCompleteDecodeErrorZ {
12734 contents: CResult_TxCompleteDecodeErrorZPtr {
12735 err: Box::into_raw(Box::new(e)),
12740 /// Checks if the given object is currently in the success state
12742 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
12746 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
12747 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
12748 impl Drop for CResult_TxCompleteDecodeErrorZ {
12749 fn drop(&mut self) {
12750 if self.result_ok {
12751 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12752 let _ = unsafe { Box::from_raw(self.contents.result) };
12755 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12756 let _ = unsafe { Box::from_raw(self.contents.err) };
12761 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
12762 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
12763 let contents = if o.result_ok {
12764 let result = unsafe { o.contents.result };
12765 unsafe { o.contents.result = core::ptr::null_mut() };
12766 CResult_TxCompleteDecodeErrorZPtr { result }
12768 let err = unsafe { o.contents.err };
12769 unsafe { o.contents.err = core::ptr::null_mut(); }
12770 CResult_TxCompleteDecodeErrorZPtr { err }
12774 result_ok: o.result_ok,
12778 impl Clone for CResult_TxCompleteDecodeErrorZ {
12779 fn clone(&self) -> Self {
12780 if self.result_ok {
12781 Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
12782 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
12785 Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
12786 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12792 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
12793 /// but with all dynamically-allocated buffers duplicated in new buffers.
12794 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
12796 /// The contents of CResult_TxSignaturesDecodeErrorZ
12797 pub union CResult_TxSignaturesDecodeErrorZPtr {
12798 /// A pointer to the contents in the success state.
12799 /// Reading from this pointer when `result_ok` is not set is undefined.
12800 pub result: *mut crate::lightning::ln::msgs::TxSignatures,
12801 /// A pointer to the contents in the error state.
12802 /// Reading from this pointer when `result_ok` is set is undefined.
12803 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12806 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
12807 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12809 pub struct CResult_TxSignaturesDecodeErrorZ {
12810 /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
12811 /// `err` or `result` depending on the state of `result_ok`.
12812 pub contents: CResult_TxSignaturesDecodeErrorZPtr,
12813 /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
12814 pub result_ok: bool,
12817 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
12818 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
12819 CResult_TxSignaturesDecodeErrorZ {
12820 contents: CResult_TxSignaturesDecodeErrorZPtr {
12821 result: Box::into_raw(Box::new(o)),
12827 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
12828 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
12829 CResult_TxSignaturesDecodeErrorZ {
12830 contents: CResult_TxSignaturesDecodeErrorZPtr {
12831 err: Box::into_raw(Box::new(e)),
12836 /// Checks if the given object is currently in the success state
12838 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
12842 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
12843 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
12844 impl Drop for CResult_TxSignaturesDecodeErrorZ {
12845 fn drop(&mut self) {
12846 if self.result_ok {
12847 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12848 let _ = unsafe { Box::from_raw(self.contents.result) };
12851 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12852 let _ = unsafe { Box::from_raw(self.contents.err) };
12857 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
12858 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12859 let contents = if o.result_ok {
12860 let result = unsafe { o.contents.result };
12861 unsafe { o.contents.result = core::ptr::null_mut() };
12862 CResult_TxSignaturesDecodeErrorZPtr { result }
12864 let err = unsafe { o.contents.err };
12865 unsafe { o.contents.err = core::ptr::null_mut(); }
12866 CResult_TxSignaturesDecodeErrorZPtr { err }
12870 result_ok: o.result_ok,
12874 impl Clone for CResult_TxSignaturesDecodeErrorZ {
12875 fn clone(&self) -> Self {
12876 if self.result_ok {
12877 Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
12878 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
12881 Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
12882 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12888 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
12889 /// but with all dynamically-allocated buffers duplicated in new buffers.
12890 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
12892 /// The contents of CResult_TxInitRbfDecodeErrorZ
12893 pub union CResult_TxInitRbfDecodeErrorZPtr {
12894 /// A pointer to the contents in the success state.
12895 /// Reading from this pointer when `result_ok` is not set is undefined.
12896 pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
12897 /// A pointer to the contents in the error state.
12898 /// Reading from this pointer when `result_ok` is set is undefined.
12899 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12902 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
12903 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
12904 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12905 pub struct CResult_TxInitRbfDecodeErrorZ {
12906 /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
12907 /// `err` or `result` depending on the state of `result_ok`.
12908 pub contents: CResult_TxInitRbfDecodeErrorZPtr,
12909 /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
12910 pub result_ok: bool,
12913 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
12914 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
12915 CResult_TxInitRbfDecodeErrorZ {
12916 contents: CResult_TxInitRbfDecodeErrorZPtr {
12917 result: Box::into_raw(Box::new(o)),
12923 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
12924 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
12925 CResult_TxInitRbfDecodeErrorZ {
12926 contents: CResult_TxInitRbfDecodeErrorZPtr {
12927 err: Box::into_raw(Box::new(e)),
12932 /// Checks if the given object is currently in the success state
12934 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
12938 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
12939 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
12940 impl Drop for CResult_TxInitRbfDecodeErrorZ {
12941 fn drop(&mut self) {
12942 if self.result_ok {
12943 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12944 let _ = unsafe { Box::from_raw(self.contents.result) };
12947 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12948 let _ = unsafe { Box::from_raw(self.contents.err) };
12953 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
12954 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
12955 let contents = if o.result_ok {
12956 let result = unsafe { o.contents.result };
12957 unsafe { o.contents.result = core::ptr::null_mut() };
12958 CResult_TxInitRbfDecodeErrorZPtr { result }
12960 let err = unsafe { o.contents.err };
12961 unsafe { o.contents.err = core::ptr::null_mut(); }
12962 CResult_TxInitRbfDecodeErrorZPtr { err }
12966 result_ok: o.result_ok,
12970 impl Clone for CResult_TxInitRbfDecodeErrorZ {
12971 fn clone(&self) -> Self {
12972 if self.result_ok {
12973 Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
12974 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
12977 Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
12978 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12984 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
12985 /// but with all dynamically-allocated buffers duplicated in new buffers.
12986 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
12988 /// The contents of CResult_TxAckRbfDecodeErrorZ
12989 pub union CResult_TxAckRbfDecodeErrorZPtr {
12990 /// A pointer to the contents in the success state.
12991 /// Reading from this pointer when `result_ok` is not set is undefined.
12992 pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
12993 /// A pointer to the contents in the error state.
12994 /// Reading from this pointer when `result_ok` is set is undefined.
12995 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12998 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
12999 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
13000 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13001 pub struct CResult_TxAckRbfDecodeErrorZ {
13002 /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
13003 /// `err` or `result` depending on the state of `result_ok`.
13004 pub contents: CResult_TxAckRbfDecodeErrorZPtr,
13005 /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
13006 pub result_ok: bool,
13009 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
13010 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
13011 CResult_TxAckRbfDecodeErrorZ {
13012 contents: CResult_TxAckRbfDecodeErrorZPtr {
13013 result: Box::into_raw(Box::new(o)),
13019 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
13020 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
13021 CResult_TxAckRbfDecodeErrorZ {
13022 contents: CResult_TxAckRbfDecodeErrorZPtr {
13023 err: Box::into_raw(Box::new(e)),
13028 /// Checks if the given object is currently in the success state
13030 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
13034 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
13035 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
13036 impl Drop for CResult_TxAckRbfDecodeErrorZ {
13037 fn drop(&mut self) {
13038 if self.result_ok {
13039 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13040 let _ = unsafe { Box::from_raw(self.contents.result) };
13043 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13044 let _ = unsafe { Box::from_raw(self.contents.err) };
13049 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
13050 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
13051 let contents = if o.result_ok {
13052 let result = unsafe { o.contents.result };
13053 unsafe { o.contents.result = core::ptr::null_mut() };
13054 CResult_TxAckRbfDecodeErrorZPtr { result }
13056 let err = unsafe { o.contents.err };
13057 unsafe { o.contents.err = core::ptr::null_mut(); }
13058 CResult_TxAckRbfDecodeErrorZPtr { err }
13062 result_ok: o.result_ok,
13066 impl Clone for CResult_TxAckRbfDecodeErrorZ {
13067 fn clone(&self) -> Self {
13068 if self.result_ok {
13069 Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
13070 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
13073 Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
13074 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13080 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
13081 /// but with all dynamically-allocated buffers duplicated in new buffers.
13082 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
13084 /// The contents of CResult_TxAbortDecodeErrorZ
13085 pub union CResult_TxAbortDecodeErrorZPtr {
13086 /// A pointer to the contents in the success state.
13087 /// Reading from this pointer when `result_ok` is not set is undefined.
13088 pub result: *mut crate::lightning::ln::msgs::TxAbort,
13089 /// A pointer to the contents in the error state.
13090 /// Reading from this pointer when `result_ok` is set is undefined.
13091 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13094 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
13095 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
13096 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13097 pub struct CResult_TxAbortDecodeErrorZ {
13098 /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
13099 /// `err` or `result` depending on the state of `result_ok`.
13100 pub contents: CResult_TxAbortDecodeErrorZPtr,
13101 /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
13102 pub result_ok: bool,
13105 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
13106 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
13107 CResult_TxAbortDecodeErrorZ {
13108 contents: CResult_TxAbortDecodeErrorZPtr {
13109 result: Box::into_raw(Box::new(o)),
13115 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
13116 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
13117 CResult_TxAbortDecodeErrorZ {
13118 contents: CResult_TxAbortDecodeErrorZPtr {
13119 err: Box::into_raw(Box::new(e)),
13124 /// Checks if the given object is currently in the success state
13126 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
13130 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
13131 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
13132 impl Drop for CResult_TxAbortDecodeErrorZ {
13133 fn drop(&mut self) {
13134 if self.result_ok {
13135 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13136 let _ = unsafe { Box::from_raw(self.contents.result) };
13139 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13140 let _ = unsafe { Box::from_raw(self.contents.err) };
13145 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
13146 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
13147 let contents = if o.result_ok {
13148 let result = unsafe { o.contents.result };
13149 unsafe { o.contents.result = core::ptr::null_mut() };
13150 CResult_TxAbortDecodeErrorZPtr { result }
13152 let err = unsafe { o.contents.err };
13153 unsafe { o.contents.err = core::ptr::null_mut(); }
13154 CResult_TxAbortDecodeErrorZPtr { err }
13158 result_ok: o.result_ok,
13162 impl Clone for CResult_TxAbortDecodeErrorZ {
13163 fn clone(&self) -> Self {
13164 if self.result_ok {
13165 Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
13166 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
13169 Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
13170 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13176 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
13177 /// but with all dynamically-allocated buffers duplicated in new buffers.
13178 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
13180 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
13181 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
13182 /// A pointer to the contents in the success state.
13183 /// Reading from this pointer when `result_ok` is not set is undefined.
13184 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
13185 /// A pointer to the contents in the error state.
13186 /// Reading from this pointer when `result_ok` is set is undefined.
13187 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13190 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
13191 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13192 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13193 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
13194 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
13195 /// `err` or `result` depending on the state of `result_ok`.
13196 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
13197 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
13198 pub result_ok: bool,
13201 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13202 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13203 CResult_AnnouncementSignaturesDecodeErrorZ {
13204 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13205 result: Box::into_raw(Box::new(o)),
13211 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13212 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13213 CResult_AnnouncementSignaturesDecodeErrorZ {
13214 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13215 err: Box::into_raw(Box::new(e)),
13220 /// Checks if the given object is currently in the success state
13222 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
13226 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13227 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
13228 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
13229 fn drop(&mut self) {
13230 if self.result_ok {
13231 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13232 let _ = unsafe { Box::from_raw(self.contents.result) };
13235 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13236 let _ = unsafe { Box::from_raw(self.contents.err) };
13241 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
13242 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13243 let contents = if o.result_ok {
13244 let result = unsafe { o.contents.result };
13245 unsafe { o.contents.result = core::ptr::null_mut() };
13246 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
13248 let err = unsafe { o.contents.err };
13249 unsafe { o.contents.err = core::ptr::null_mut(); }
13250 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
13254 result_ok: o.result_ok,
13258 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
13259 fn clone(&self) -> Self {
13260 if self.result_ok {
13261 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13262 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
13265 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13266 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13272 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13273 /// but with all dynamically-allocated buffers duplicated in new buffers.
13274 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
13276 /// The contents of CResult_ChannelReestablishDecodeErrorZ
13277 pub union CResult_ChannelReestablishDecodeErrorZPtr {
13278 /// A pointer to the contents in the success state.
13279 /// Reading from this pointer when `result_ok` is not set is undefined.
13280 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
13281 /// A pointer to the contents in the error state.
13282 /// Reading from this pointer when `result_ok` is set is undefined.
13283 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13286 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
13287 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
13288 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13289 pub struct CResult_ChannelReestablishDecodeErrorZ {
13290 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
13291 /// `err` or `result` depending on the state of `result_ok`.
13292 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
13293 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
13294 pub result_ok: bool,
13297 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13298 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
13299 CResult_ChannelReestablishDecodeErrorZ {
13300 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13301 result: Box::into_raw(Box::new(o)),
13307 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13308 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
13309 CResult_ChannelReestablishDecodeErrorZ {
13310 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13311 err: Box::into_raw(Box::new(e)),
13316 /// Checks if the given object is currently in the success state
13318 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
13322 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13323 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
13324 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
13325 fn drop(&mut self) {
13326 if self.result_ok {
13327 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13328 let _ = unsafe { Box::from_raw(self.contents.result) };
13331 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13332 let _ = unsafe { Box::from_raw(self.contents.err) };
13337 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
13338 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
13339 let contents = if o.result_ok {
13340 let result = unsafe { o.contents.result };
13341 unsafe { o.contents.result = core::ptr::null_mut() };
13342 CResult_ChannelReestablishDecodeErrorZPtr { result }
13344 let err = unsafe { o.contents.err };
13345 unsafe { o.contents.err = core::ptr::null_mut(); }
13346 CResult_ChannelReestablishDecodeErrorZPtr { err }
13350 result_ok: o.result_ok,
13354 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
13355 fn clone(&self) -> Self {
13356 if self.result_ok {
13357 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13358 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
13361 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13362 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13368 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
13369 /// but with all dynamically-allocated buffers duplicated in new buffers.
13370 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
13372 /// The contents of CResult_ClosingSignedDecodeErrorZ
13373 pub union CResult_ClosingSignedDecodeErrorZPtr {
13374 /// A pointer to the contents in the success state.
13375 /// Reading from this pointer when `result_ok` is not set is undefined.
13376 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
13377 /// A pointer to the contents in the error state.
13378 /// Reading from this pointer when `result_ok` is set is undefined.
13379 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13382 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
13383 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13385 pub struct CResult_ClosingSignedDecodeErrorZ {
13386 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
13387 /// `err` or `result` depending on the state of `result_ok`.
13388 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
13389 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
13390 pub result_ok: bool,
13393 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
13394 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
13395 CResult_ClosingSignedDecodeErrorZ {
13396 contents: CResult_ClosingSignedDecodeErrorZPtr {
13397 result: Box::into_raw(Box::new(o)),
13403 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
13404 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
13405 CResult_ClosingSignedDecodeErrorZ {
13406 contents: CResult_ClosingSignedDecodeErrorZPtr {
13407 err: Box::into_raw(Box::new(e)),
13412 /// Checks if the given object is currently in the success state
13414 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
13418 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
13419 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
13420 impl Drop for CResult_ClosingSignedDecodeErrorZ {
13421 fn drop(&mut self) {
13422 if self.result_ok {
13423 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13424 let _ = unsafe { Box::from_raw(self.contents.result) };
13427 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13428 let _ = unsafe { Box::from_raw(self.contents.err) };
13433 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
13434 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13435 let contents = if o.result_ok {
13436 let result = unsafe { o.contents.result };
13437 unsafe { o.contents.result = core::ptr::null_mut() };
13438 CResult_ClosingSignedDecodeErrorZPtr { result }
13440 let err = unsafe { o.contents.err };
13441 unsafe { o.contents.err = core::ptr::null_mut(); }
13442 CResult_ClosingSignedDecodeErrorZPtr { err }
13446 result_ok: o.result_ok,
13450 impl Clone for CResult_ClosingSignedDecodeErrorZ {
13451 fn clone(&self) -> Self {
13452 if self.result_ok {
13453 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
13454 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
13457 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
13458 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13464 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
13465 /// but with all dynamically-allocated buffers duplicated in new buffers.
13466 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
13468 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
13469 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13470 /// A pointer to the contents in the success state.
13471 /// Reading from this pointer when `result_ok` is not set is undefined.
13472 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
13473 /// A pointer to the contents in the error state.
13474 /// Reading from this pointer when `result_ok` is set is undefined.
13475 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13478 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
13479 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13480 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13481 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
13482 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
13483 /// `err` or `result` depending on the state of `result_ok`.
13484 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
13485 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
13486 pub result_ok: bool,
13489 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
13490 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13491 CResult_ClosingSignedFeeRangeDecodeErrorZ {
13492 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13493 result: Box::into_raw(Box::new(o)),
13499 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
13500 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13501 CResult_ClosingSignedFeeRangeDecodeErrorZ {
13502 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13503 err: Box::into_raw(Box::new(e)),
13508 /// Checks if the given object is currently in the success state
13510 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
13514 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
13515 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
13516 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13517 fn drop(&mut self) {
13518 if self.result_ok {
13519 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13520 let _ = unsafe { Box::from_raw(self.contents.result) };
13523 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13524 let _ = unsafe { Box::from_raw(self.contents.err) };
13529 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13530 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13531 let contents = if o.result_ok {
13532 let result = unsafe { o.contents.result };
13533 unsafe { o.contents.result = core::ptr::null_mut() };
13534 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
13536 let err = unsafe { o.contents.err };
13537 unsafe { o.contents.err = core::ptr::null_mut(); }
13538 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
13542 result_ok: o.result_ok,
13546 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13547 fn clone(&self) -> Self {
13548 if self.result_ok {
13549 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13550 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
13553 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13554 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13560 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13561 /// but with all dynamically-allocated buffers duplicated in new buffers.
13562 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
13564 /// The contents of CResult_CommitmentSignedDecodeErrorZ
13565 pub union CResult_CommitmentSignedDecodeErrorZPtr {
13566 /// A pointer to the contents in the success state.
13567 /// Reading from this pointer when `result_ok` is not set is undefined.
13568 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
13569 /// A pointer to the contents in the error state.
13570 /// Reading from this pointer when `result_ok` is set is undefined.
13571 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13574 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
13575 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13576 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13577 pub struct CResult_CommitmentSignedDecodeErrorZ {
13578 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
13579 /// `err` or `result` depending on the state of `result_ok`.
13580 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
13581 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
13582 pub result_ok: bool,
13585 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13586 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
13587 CResult_CommitmentSignedDecodeErrorZ {
13588 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13589 result: Box::into_raw(Box::new(o)),
13595 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13596 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
13597 CResult_CommitmentSignedDecodeErrorZ {
13598 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13599 err: Box::into_raw(Box::new(e)),
13604 /// Checks if the given object is currently in the success state
13606 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
13610 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13611 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
13612 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
13613 fn drop(&mut self) {
13614 if self.result_ok {
13615 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13616 let _ = unsafe { Box::from_raw(self.contents.result) };
13619 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13620 let _ = unsafe { Box::from_raw(self.contents.err) };
13625 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
13626 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13627 let contents = if o.result_ok {
13628 let result = unsafe { o.contents.result };
13629 unsafe { o.contents.result = core::ptr::null_mut() };
13630 CResult_CommitmentSignedDecodeErrorZPtr { result }
13632 let err = unsafe { o.contents.err };
13633 unsafe { o.contents.err = core::ptr::null_mut(); }
13634 CResult_CommitmentSignedDecodeErrorZPtr { err }
13638 result_ok: o.result_ok,
13642 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
13643 fn clone(&self) -> Self {
13644 if self.result_ok {
13645 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13646 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
13649 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13650 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13656 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13657 /// but with all dynamically-allocated buffers duplicated in new buffers.
13658 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
13660 /// The contents of CResult_FundingCreatedDecodeErrorZ
13661 pub union CResult_FundingCreatedDecodeErrorZPtr {
13662 /// A pointer to the contents in the success state.
13663 /// Reading from this pointer when `result_ok` is not set is undefined.
13664 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13665 /// A pointer to the contents in the error state.
13666 /// Reading from this pointer when `result_ok` is set is undefined.
13667 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13670 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13671 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13672 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13673 pub struct CResult_FundingCreatedDecodeErrorZ {
13674 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13675 /// `err` or `result` depending on the state of `result_ok`.
13676 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13677 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13678 pub result_ok: bool,
13681 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13682 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13683 CResult_FundingCreatedDecodeErrorZ {
13684 contents: CResult_FundingCreatedDecodeErrorZPtr {
13685 result: Box::into_raw(Box::new(o)),
13691 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13692 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13693 CResult_FundingCreatedDecodeErrorZ {
13694 contents: CResult_FundingCreatedDecodeErrorZPtr {
13695 err: Box::into_raw(Box::new(e)),
13700 /// Checks if the given object is currently in the success state
13702 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13706 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13707 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13708 impl Drop for CResult_FundingCreatedDecodeErrorZ {
13709 fn drop(&mut self) {
13710 if self.result_ok {
13711 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13712 let _ = unsafe { Box::from_raw(self.contents.result) };
13715 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13716 let _ = unsafe { Box::from_raw(self.contents.err) };
13721 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
13722 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
13723 let contents = if o.result_ok {
13724 let result = unsafe { o.contents.result };
13725 unsafe { o.contents.result = core::ptr::null_mut() };
13726 CResult_FundingCreatedDecodeErrorZPtr { result }
13728 let err = unsafe { o.contents.err };
13729 unsafe { o.contents.err = core::ptr::null_mut(); }
13730 CResult_FundingCreatedDecodeErrorZPtr { err }
13734 result_ok: o.result_ok,
13738 impl Clone for CResult_FundingCreatedDecodeErrorZ {
13739 fn clone(&self) -> Self {
13740 if self.result_ok {
13741 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
13742 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
13745 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
13746 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13752 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13753 /// but with all dynamically-allocated buffers duplicated in new buffers.
13754 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
13756 /// The contents of CResult_FundingSignedDecodeErrorZ
13757 pub union CResult_FundingSignedDecodeErrorZPtr {
13758 /// A pointer to the contents in the success state.
13759 /// Reading from this pointer when `result_ok` is not set is undefined.
13760 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
13761 /// A pointer to the contents in the error state.
13762 /// Reading from this pointer when `result_ok` is set is undefined.
13763 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13766 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
13767 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13768 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13769 pub struct CResult_FundingSignedDecodeErrorZ {
13770 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
13771 /// `err` or `result` depending on the state of `result_ok`.
13772 pub contents: CResult_FundingSignedDecodeErrorZPtr,
13773 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
13774 pub result_ok: bool,
13777 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13778 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
13779 CResult_FundingSignedDecodeErrorZ {
13780 contents: CResult_FundingSignedDecodeErrorZPtr {
13781 result: Box::into_raw(Box::new(o)),
13787 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13788 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
13789 CResult_FundingSignedDecodeErrorZ {
13790 contents: CResult_FundingSignedDecodeErrorZPtr {
13791 err: Box::into_raw(Box::new(e)),
13796 /// Checks if the given object is currently in the success state
13798 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
13802 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13803 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
13804 impl Drop for CResult_FundingSignedDecodeErrorZ {
13805 fn drop(&mut self) {
13806 if self.result_ok {
13807 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13808 let _ = unsafe { Box::from_raw(self.contents.result) };
13811 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13812 let _ = unsafe { Box::from_raw(self.contents.err) };
13817 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
13818 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13819 let contents = if o.result_ok {
13820 let result = unsafe { o.contents.result };
13821 unsafe { o.contents.result = core::ptr::null_mut() };
13822 CResult_FundingSignedDecodeErrorZPtr { result }
13824 let err = unsafe { o.contents.err };
13825 unsafe { o.contents.err = core::ptr::null_mut(); }
13826 CResult_FundingSignedDecodeErrorZPtr { err }
13830 result_ok: o.result_ok,
13834 impl Clone for CResult_FundingSignedDecodeErrorZ {
13835 fn clone(&self) -> Self {
13836 if self.result_ok {
13837 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
13838 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
13841 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
13842 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13848 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13849 /// but with all dynamically-allocated buffers duplicated in new buffers.
13850 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
13852 /// The contents of CResult_ChannelReadyDecodeErrorZ
13853 pub union CResult_ChannelReadyDecodeErrorZPtr {
13854 /// A pointer to the contents in the success state.
13855 /// Reading from this pointer when `result_ok` is not set is undefined.
13856 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
13857 /// A pointer to the contents in the error state.
13858 /// Reading from this pointer when `result_ok` is set is undefined.
13859 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13862 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
13863 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
13864 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13865 pub struct CResult_ChannelReadyDecodeErrorZ {
13866 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
13867 /// `err` or `result` depending on the state of `result_ok`.
13868 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
13869 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
13870 pub result_ok: bool,
13873 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
13874 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
13875 CResult_ChannelReadyDecodeErrorZ {
13876 contents: CResult_ChannelReadyDecodeErrorZPtr {
13877 result: Box::into_raw(Box::new(o)),
13883 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
13884 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
13885 CResult_ChannelReadyDecodeErrorZ {
13886 contents: CResult_ChannelReadyDecodeErrorZPtr {
13887 err: Box::into_raw(Box::new(e)),
13892 /// Checks if the given object is currently in the success state
13894 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
13898 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13899 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13900 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13901 fn drop(&mut self) {
13902 if self.result_ok {
13903 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13904 let _ = unsafe { Box::from_raw(self.contents.result) };
13907 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13908 let _ = unsafe { Box::from_raw(self.contents.err) };
13913 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13914 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13915 let contents = if o.result_ok {
13916 let result = unsafe { o.contents.result };
13917 unsafe { o.contents.result = core::ptr::null_mut() };
13918 CResult_ChannelReadyDecodeErrorZPtr { result }
13920 let err = unsafe { o.contents.err };
13921 unsafe { o.contents.err = core::ptr::null_mut(); }
13922 CResult_ChannelReadyDecodeErrorZPtr { err }
13926 result_ok: o.result_ok,
13930 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13931 fn clone(&self) -> Self {
13932 if self.result_ok {
13933 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13934 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13937 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13938 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13944 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13945 /// but with all dynamically-allocated buffers duplicated in new buffers.
13946 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13948 /// The contents of CResult_InitDecodeErrorZ
13949 pub union CResult_InitDecodeErrorZPtr {
13950 /// A pointer to the contents in the success state.
13951 /// Reading from this pointer when `result_ok` is not set is undefined.
13952 pub result: *mut crate::lightning::ln::msgs::Init,
13953 /// A pointer to the contents in the error state.
13954 /// Reading from this pointer when `result_ok` is set is undefined.
13955 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13958 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13959 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13960 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13961 pub struct CResult_InitDecodeErrorZ {
13962 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13963 /// `err` or `result` depending on the state of `result_ok`.
13964 pub contents: CResult_InitDecodeErrorZPtr,
13965 /// Whether this CResult_InitDecodeErrorZ represents a success state.
13966 pub result_ok: bool,
13969 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13970 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13971 CResult_InitDecodeErrorZ {
13972 contents: CResult_InitDecodeErrorZPtr {
13973 result: Box::into_raw(Box::new(o)),
13979 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13980 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13981 CResult_InitDecodeErrorZ {
13982 contents: CResult_InitDecodeErrorZPtr {
13983 err: Box::into_raw(Box::new(e)),
13988 /// Checks if the given object is currently in the success state
13990 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13994 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13995 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13996 impl Drop for CResult_InitDecodeErrorZ {
13997 fn drop(&mut self) {
13998 if self.result_ok {
13999 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14000 let _ = unsafe { Box::from_raw(self.contents.result) };
14003 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14004 let _ = unsafe { Box::from_raw(self.contents.err) };
14009 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
14010 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
14011 let contents = if o.result_ok {
14012 let result = unsafe { o.contents.result };
14013 unsafe { o.contents.result = core::ptr::null_mut() };
14014 CResult_InitDecodeErrorZPtr { result }
14016 let err = unsafe { o.contents.err };
14017 unsafe { o.contents.err = core::ptr::null_mut(); }
14018 CResult_InitDecodeErrorZPtr { err }
14022 result_ok: o.result_ok,
14026 impl Clone for CResult_InitDecodeErrorZ {
14027 fn clone(&self) -> Self {
14028 if self.result_ok {
14029 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
14030 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
14033 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
14034 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14040 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
14041 /// but with all dynamically-allocated buffers duplicated in new buffers.
14042 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
14044 /// The contents of CResult_OpenChannelDecodeErrorZ
14045 pub union CResult_OpenChannelDecodeErrorZPtr {
14046 /// A pointer to the contents in the success state.
14047 /// Reading from this pointer when `result_ok` is not set is undefined.
14048 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
14049 /// A pointer to the contents in the error state.
14050 /// Reading from this pointer when `result_ok` is set is undefined.
14051 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14054 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
14055 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14057 pub struct CResult_OpenChannelDecodeErrorZ {
14058 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
14059 /// `err` or `result` depending on the state of `result_ok`.
14060 pub contents: CResult_OpenChannelDecodeErrorZPtr,
14061 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
14062 pub result_ok: bool,
14065 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
14066 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
14067 CResult_OpenChannelDecodeErrorZ {
14068 contents: CResult_OpenChannelDecodeErrorZPtr {
14069 result: Box::into_raw(Box::new(o)),
14075 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14076 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
14077 CResult_OpenChannelDecodeErrorZ {
14078 contents: CResult_OpenChannelDecodeErrorZPtr {
14079 err: Box::into_raw(Box::new(e)),
14084 /// Checks if the given object is currently in the success state
14086 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
14090 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14091 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
14092 impl Drop for CResult_OpenChannelDecodeErrorZ {
14093 fn drop(&mut self) {
14094 if self.result_ok {
14095 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14096 let _ = unsafe { Box::from_raw(self.contents.result) };
14099 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14100 let _ = unsafe { Box::from_raw(self.contents.err) };
14105 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
14106 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14107 let contents = if o.result_ok {
14108 let result = unsafe { o.contents.result };
14109 unsafe { o.contents.result = core::ptr::null_mut() };
14110 CResult_OpenChannelDecodeErrorZPtr { result }
14112 let err = unsafe { o.contents.err };
14113 unsafe { o.contents.err = core::ptr::null_mut(); }
14114 CResult_OpenChannelDecodeErrorZPtr { err }
14118 result_ok: o.result_ok,
14122 impl Clone for CResult_OpenChannelDecodeErrorZ {
14123 fn clone(&self) -> Self {
14124 if self.result_ok {
14125 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
14126 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
14129 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
14130 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14136 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14137 /// but with all dynamically-allocated buffers duplicated in new buffers.
14138 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
14140 /// The contents of CResult_OpenChannelV2DecodeErrorZ
14141 pub union CResult_OpenChannelV2DecodeErrorZPtr {
14142 /// A pointer to the contents in the success state.
14143 /// Reading from this pointer when `result_ok` is not set is undefined.
14144 pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
14145 /// A pointer to the contents in the error state.
14146 /// Reading from this pointer when `result_ok` is set is undefined.
14147 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14150 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
14151 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
14152 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14153 pub struct CResult_OpenChannelV2DecodeErrorZ {
14154 /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
14155 /// `err` or `result` depending on the state of `result_ok`.
14156 pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
14157 /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
14158 pub result_ok: bool,
14161 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
14162 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
14163 CResult_OpenChannelV2DecodeErrorZ {
14164 contents: CResult_OpenChannelV2DecodeErrorZPtr {
14165 result: Box::into_raw(Box::new(o)),
14171 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
14172 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
14173 CResult_OpenChannelV2DecodeErrorZ {
14174 contents: CResult_OpenChannelV2DecodeErrorZPtr {
14175 err: Box::into_raw(Box::new(e)),
14180 /// Checks if the given object is currently in the success state
14182 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
14186 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
14187 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
14188 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
14189 fn drop(&mut self) {
14190 if self.result_ok {
14191 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14192 let _ = unsafe { Box::from_raw(self.contents.result) };
14195 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14196 let _ = unsafe { Box::from_raw(self.contents.err) };
14201 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
14202 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
14203 let contents = if o.result_ok {
14204 let result = unsafe { o.contents.result };
14205 unsafe { o.contents.result = core::ptr::null_mut() };
14206 CResult_OpenChannelV2DecodeErrorZPtr { result }
14208 let err = unsafe { o.contents.err };
14209 unsafe { o.contents.err = core::ptr::null_mut(); }
14210 CResult_OpenChannelV2DecodeErrorZPtr { err }
14214 result_ok: o.result_ok,
14218 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
14219 fn clone(&self) -> Self {
14220 if self.result_ok {
14221 Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
14222 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
14225 Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
14226 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14232 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
14233 /// but with all dynamically-allocated buffers duplicated in new buffers.
14234 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
14236 /// The contents of CResult_RevokeAndACKDecodeErrorZ
14237 pub union CResult_RevokeAndACKDecodeErrorZPtr {
14238 /// A pointer to the contents in the success state.
14239 /// Reading from this pointer when `result_ok` is not set is undefined.
14240 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
14241 /// A pointer to the contents in the error state.
14242 /// Reading from this pointer when `result_ok` is set is undefined.
14243 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14246 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
14247 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
14248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14249 pub struct CResult_RevokeAndACKDecodeErrorZ {
14250 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
14251 /// `err` or `result` depending on the state of `result_ok`.
14252 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
14253 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
14254 pub result_ok: bool,
14257 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14258 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
14259 CResult_RevokeAndACKDecodeErrorZ {
14260 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14261 result: Box::into_raw(Box::new(o)),
14267 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14268 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
14269 CResult_RevokeAndACKDecodeErrorZ {
14270 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14271 err: Box::into_raw(Box::new(e)),
14276 /// Checks if the given object is currently in the success state
14278 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
14282 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14283 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
14284 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
14285 fn drop(&mut self) {
14286 if self.result_ok {
14287 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14288 let _ = unsafe { Box::from_raw(self.contents.result) };
14291 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14292 let _ = unsafe { Box::from_raw(self.contents.err) };
14297 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
14298 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
14299 let contents = if o.result_ok {
14300 let result = unsafe { o.contents.result };
14301 unsafe { o.contents.result = core::ptr::null_mut() };
14302 CResult_RevokeAndACKDecodeErrorZPtr { result }
14304 let err = unsafe { o.contents.err };
14305 unsafe { o.contents.err = core::ptr::null_mut(); }
14306 CResult_RevokeAndACKDecodeErrorZPtr { err }
14310 result_ok: o.result_ok,
14314 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
14315 fn clone(&self) -> Self {
14316 if self.result_ok {
14317 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14318 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
14321 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14322 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14328 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14329 /// but with all dynamically-allocated buffers duplicated in new buffers.
14330 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
14332 /// The contents of CResult_ShutdownDecodeErrorZ
14333 pub union CResult_ShutdownDecodeErrorZPtr {
14334 /// A pointer to the contents in the success state.
14335 /// Reading from this pointer when `result_ok` is not set is undefined.
14336 pub result: *mut crate::lightning::ln::msgs::Shutdown,
14337 /// A pointer to the contents in the error state.
14338 /// Reading from this pointer when `result_ok` is set is undefined.
14339 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14342 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
14343 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
14344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14345 pub struct CResult_ShutdownDecodeErrorZ {
14346 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
14347 /// `err` or `result` depending on the state of `result_ok`.
14348 pub contents: CResult_ShutdownDecodeErrorZPtr,
14349 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
14350 pub result_ok: bool,
14353 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14354 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
14355 CResult_ShutdownDecodeErrorZ {
14356 contents: CResult_ShutdownDecodeErrorZPtr {
14357 result: Box::into_raw(Box::new(o)),
14363 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14364 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
14365 CResult_ShutdownDecodeErrorZ {
14366 contents: CResult_ShutdownDecodeErrorZPtr {
14367 err: Box::into_raw(Box::new(e)),
14372 /// Checks if the given object is currently in the success state
14374 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
14378 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14379 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
14380 impl Drop for CResult_ShutdownDecodeErrorZ {
14381 fn drop(&mut self) {
14382 if self.result_ok {
14383 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14384 let _ = unsafe { Box::from_raw(self.contents.result) };
14387 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14388 let _ = unsafe { Box::from_raw(self.contents.err) };
14393 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
14394 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
14395 let contents = if o.result_ok {
14396 let result = unsafe { o.contents.result };
14397 unsafe { o.contents.result = core::ptr::null_mut() };
14398 CResult_ShutdownDecodeErrorZPtr { result }
14400 let err = unsafe { o.contents.err };
14401 unsafe { o.contents.err = core::ptr::null_mut(); }
14402 CResult_ShutdownDecodeErrorZPtr { err }
14406 result_ok: o.result_ok,
14410 impl Clone for CResult_ShutdownDecodeErrorZ {
14411 fn clone(&self) -> Self {
14412 if self.result_ok {
14413 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
14414 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
14417 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
14418 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14424 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14425 /// but with all dynamically-allocated buffers duplicated in new buffers.
14426 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
14428 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
14429 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
14430 /// A pointer to the contents in the success state.
14431 /// Reading from this pointer when `result_ok` is not set is undefined.
14432 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14433 /// A pointer to the contents in the error state.
14434 /// Reading from this pointer when `result_ok` is set is undefined.
14435 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14438 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
14439 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14440 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14441 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
14442 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
14443 /// `err` or `result` depending on the state of `result_ok`.
14444 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
14445 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
14446 pub result_ok: bool,
14449 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
14450 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
14451 CResult_UpdateFailHTLCDecodeErrorZ {
14452 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14453 result: Box::into_raw(Box::new(o)),
14459 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
14460 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
14461 CResult_UpdateFailHTLCDecodeErrorZ {
14462 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14463 err: Box::into_raw(Box::new(e)),
14468 /// Checks if the given object is currently in the success state
14470 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
14474 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
14475 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
14476 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
14477 fn drop(&mut self) {
14478 if self.result_ok {
14479 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14480 let _ = unsafe { Box::from_raw(self.contents.result) };
14483 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14484 let _ = unsafe { Box::from_raw(self.contents.err) };
14489 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
14490 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14491 let contents = if o.result_ok {
14492 let result = unsafe { o.contents.result };
14493 unsafe { o.contents.result = core::ptr::null_mut() };
14494 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
14496 let err = unsafe { o.contents.err };
14497 unsafe { o.contents.err = core::ptr::null_mut(); }
14498 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
14502 result_ok: o.result_ok,
14506 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
14507 fn clone(&self) -> Self {
14508 if self.result_ok {
14509 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14510 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
14513 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14514 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14520 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
14521 /// but with all dynamically-allocated buffers duplicated in new buffers.
14522 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
14524 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
14525 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14526 /// A pointer to the contents in the success state.
14527 /// Reading from this pointer when `result_ok` is not set is undefined.
14528 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14529 /// A pointer to the contents in the error state.
14530 /// Reading from this pointer when `result_ok` is set is undefined.
14531 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14534 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
14535 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14537 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14538 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
14539 /// `err` or `result` depending on the state of `result_ok`.
14540 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
14541 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
14542 pub result_ok: bool,
14545 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
14546 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14547 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14548 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14549 result: Box::into_raw(Box::new(o)),
14555 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
14556 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14557 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14558 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14559 err: Box::into_raw(Box::new(e)),
14564 /// Checks if the given object is currently in the success state
14566 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
14570 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
14571 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
14572 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14573 fn drop(&mut self) {
14574 if self.result_ok {
14575 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14576 let _ = unsafe { Box::from_raw(self.contents.result) };
14579 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14580 let _ = unsafe { Box::from_raw(self.contents.err) };
14585 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14586 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14587 let contents = if o.result_ok {
14588 let result = unsafe { o.contents.result };
14589 unsafe { o.contents.result = core::ptr::null_mut() };
14590 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
14592 let err = unsafe { o.contents.err };
14593 unsafe { o.contents.err = core::ptr::null_mut(); }
14594 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
14598 result_ok: o.result_ok,
14602 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14603 fn clone(&self) -> Self {
14604 if self.result_ok {
14605 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14606 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
14609 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14610 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14616 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
14617 /// but with all dynamically-allocated buffers duplicated in new buffers.
14618 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
14620 /// The contents of CResult_UpdateFeeDecodeErrorZ
14621 pub union CResult_UpdateFeeDecodeErrorZPtr {
14622 /// A pointer to the contents in the success state.
14623 /// Reading from this pointer when `result_ok` is not set is undefined.
14624 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
14625 /// A pointer to the contents in the error state.
14626 /// Reading from this pointer when `result_ok` is set is undefined.
14627 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14630 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
14631 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
14632 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14633 pub struct CResult_UpdateFeeDecodeErrorZ {
14634 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
14635 /// `err` or `result` depending on the state of `result_ok`.
14636 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
14637 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
14638 pub result_ok: bool,
14641 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14642 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
14643 CResult_UpdateFeeDecodeErrorZ {
14644 contents: CResult_UpdateFeeDecodeErrorZPtr {
14645 result: Box::into_raw(Box::new(o)),
14651 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14652 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
14653 CResult_UpdateFeeDecodeErrorZ {
14654 contents: CResult_UpdateFeeDecodeErrorZPtr {
14655 err: Box::into_raw(Box::new(e)),
14660 /// Checks if the given object is currently in the success state
14662 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
14666 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14667 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
14668 impl Drop for CResult_UpdateFeeDecodeErrorZ {
14669 fn drop(&mut self) {
14670 if self.result_ok {
14671 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14672 let _ = unsafe { Box::from_raw(self.contents.result) };
14675 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14676 let _ = unsafe { Box::from_raw(self.contents.err) };
14681 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
14682 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
14683 let contents = if o.result_ok {
14684 let result = unsafe { o.contents.result };
14685 unsafe { o.contents.result = core::ptr::null_mut() };
14686 CResult_UpdateFeeDecodeErrorZPtr { result }
14688 let err = unsafe { o.contents.err };
14689 unsafe { o.contents.err = core::ptr::null_mut(); }
14690 CResult_UpdateFeeDecodeErrorZPtr { err }
14694 result_ok: o.result_ok,
14698 impl Clone for CResult_UpdateFeeDecodeErrorZ {
14699 fn clone(&self) -> Self {
14700 if self.result_ok {
14701 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
14702 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
14705 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
14706 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14712 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14713 /// but with all dynamically-allocated buffers duplicated in new buffers.
14714 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
14716 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
14717 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14718 /// A pointer to the contents in the success state.
14719 /// Reading from this pointer when `result_ok` is not set is undefined.
14720 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14721 /// A pointer to the contents in the error state.
14722 /// Reading from this pointer when `result_ok` is set is undefined.
14723 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14726 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
14727 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14728 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14729 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
14730 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
14731 /// `err` or `result` depending on the state of `result_ok`.
14732 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
14733 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
14734 pub result_ok: bool,
14737 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14738 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14739 CResult_UpdateFulfillHTLCDecodeErrorZ {
14740 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14741 result: Box::into_raw(Box::new(o)),
14747 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14748 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14749 CResult_UpdateFulfillHTLCDecodeErrorZ {
14750 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14751 err: Box::into_raw(Box::new(e)),
14756 /// Checks if the given object is currently in the success state
14758 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14762 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14763 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14764 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14765 fn drop(&mut self) {
14766 if self.result_ok {
14767 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14768 let _ = unsafe { Box::from_raw(self.contents.result) };
14771 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14772 let _ = unsafe { Box::from_raw(self.contents.err) };
14777 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14778 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14779 let contents = if o.result_ok {
14780 let result = unsafe { o.contents.result };
14781 unsafe { o.contents.result = core::ptr::null_mut() };
14782 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14784 let err = unsafe { o.contents.err };
14785 unsafe { o.contents.err = core::ptr::null_mut(); }
14786 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14790 result_ok: o.result_ok,
14794 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14795 fn clone(&self) -> Self {
14796 if self.result_ok {
14797 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14798 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14801 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14802 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14808 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14809 /// but with all dynamically-allocated buffers duplicated in new buffers.
14810 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
14812 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
14813 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
14814 /// A pointer to the contents in the success state.
14815 /// Reading from this pointer when `result_ok` is not set is undefined.
14816 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14817 /// A pointer to the contents in the error state.
14818 /// Reading from this pointer when `result_ok` is set is undefined.
14819 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14822 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
14823 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14824 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14825 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
14826 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
14827 /// `err` or `result` depending on the state of `result_ok`.
14828 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
14829 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
14830 pub result_ok: bool,
14833 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14834 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
14835 CResult_UpdateAddHTLCDecodeErrorZ {
14836 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14837 result: Box::into_raw(Box::new(o)),
14843 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14844 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
14845 CResult_UpdateAddHTLCDecodeErrorZ {
14846 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14847 err: Box::into_raw(Box::new(e)),
14852 /// Checks if the given object is currently in the success state
14854 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
14858 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14859 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
14860 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
14861 fn drop(&mut self) {
14862 if self.result_ok {
14863 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14864 let _ = unsafe { Box::from_raw(self.contents.result) };
14867 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14868 let _ = unsafe { Box::from_raw(self.contents.err) };
14873 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
14874 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14875 let contents = if o.result_ok {
14876 let result = unsafe { o.contents.result };
14877 unsafe { o.contents.result = core::ptr::null_mut() };
14878 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
14880 let err = unsafe { o.contents.err };
14881 unsafe { o.contents.err = core::ptr::null_mut(); }
14882 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
14886 result_ok: o.result_ok,
14890 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
14891 fn clone(&self) -> Self {
14892 if self.result_ok {
14893 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14894 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
14897 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14898 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14904 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14905 /// but with all dynamically-allocated buffers duplicated in new buffers.
14906 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
14908 /// The contents of CResult_OnionMessageDecodeErrorZ
14909 pub union CResult_OnionMessageDecodeErrorZPtr {
14910 /// A pointer to the contents in the success state.
14911 /// Reading from this pointer when `result_ok` is not set is undefined.
14912 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
14913 /// A pointer to the contents in the error state.
14914 /// Reading from this pointer when `result_ok` is set is undefined.
14915 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14918 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
14919 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14920 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14921 pub struct CResult_OnionMessageDecodeErrorZ {
14922 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
14923 /// `err` or `result` depending on the state of `result_ok`.
14924 pub contents: CResult_OnionMessageDecodeErrorZPtr,
14925 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
14926 pub result_ok: bool,
14929 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
14930 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
14931 CResult_OnionMessageDecodeErrorZ {
14932 contents: CResult_OnionMessageDecodeErrorZPtr {
14933 result: Box::into_raw(Box::new(o)),
14939 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
14940 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
14941 CResult_OnionMessageDecodeErrorZ {
14942 contents: CResult_OnionMessageDecodeErrorZPtr {
14943 err: Box::into_raw(Box::new(e)),
14948 /// Checks if the given object is currently in the success state
14950 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
14954 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
14955 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
14956 impl Drop for CResult_OnionMessageDecodeErrorZ {
14957 fn drop(&mut self) {
14958 if self.result_ok {
14959 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14960 let _ = unsafe { Box::from_raw(self.contents.result) };
14963 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14964 let _ = unsafe { Box::from_raw(self.contents.err) };
14969 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
14970 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14971 let contents = if o.result_ok {
14972 let result = unsafe { o.contents.result };
14973 unsafe { o.contents.result = core::ptr::null_mut() };
14974 CResult_OnionMessageDecodeErrorZPtr { result }
14976 let err = unsafe { o.contents.err };
14977 unsafe { o.contents.err = core::ptr::null_mut(); }
14978 CResult_OnionMessageDecodeErrorZPtr { err }
14982 result_ok: o.result_ok,
14986 impl Clone for CResult_OnionMessageDecodeErrorZ {
14987 fn clone(&self) -> Self {
14988 if self.result_ok {
14989 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
14990 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
14993 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
14994 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15000 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
15001 /// but with all dynamically-allocated buffers duplicated in new buffers.
15002 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
15004 /// The contents of CResult_PingDecodeErrorZ
15005 pub union CResult_PingDecodeErrorZPtr {
15006 /// A pointer to the contents in the success state.
15007 /// Reading from this pointer when `result_ok` is not set is undefined.
15008 pub result: *mut crate::lightning::ln::msgs::Ping,
15009 /// A pointer to the contents in the error state.
15010 /// Reading from this pointer when `result_ok` is set is undefined.
15011 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15014 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
15015 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
15016 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15017 pub struct CResult_PingDecodeErrorZ {
15018 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
15019 /// `err` or `result` depending on the state of `result_ok`.
15020 pub contents: CResult_PingDecodeErrorZPtr,
15021 /// Whether this CResult_PingDecodeErrorZ represents a success state.
15022 pub result_ok: bool,
15025 /// Creates a new CResult_PingDecodeErrorZ in the success state.
15026 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
15027 CResult_PingDecodeErrorZ {
15028 contents: CResult_PingDecodeErrorZPtr {
15029 result: Box::into_raw(Box::new(o)),
15035 /// Creates a new CResult_PingDecodeErrorZ in the error state.
15036 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
15037 CResult_PingDecodeErrorZ {
15038 contents: CResult_PingDecodeErrorZPtr {
15039 err: Box::into_raw(Box::new(e)),
15044 /// Checks if the given object is currently in the success state
15046 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
15050 /// Frees any resources used by the CResult_PingDecodeErrorZ.
15051 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
15052 impl Drop for CResult_PingDecodeErrorZ {
15053 fn drop(&mut self) {
15054 if self.result_ok {
15055 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15056 let _ = unsafe { Box::from_raw(self.contents.result) };
15059 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15060 let _ = unsafe { Box::from_raw(self.contents.err) };
15065 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
15066 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
15067 let contents = if o.result_ok {
15068 let result = unsafe { o.contents.result };
15069 unsafe { o.contents.result = core::ptr::null_mut() };
15070 CResult_PingDecodeErrorZPtr { result }
15072 let err = unsafe { o.contents.err };
15073 unsafe { o.contents.err = core::ptr::null_mut(); }
15074 CResult_PingDecodeErrorZPtr { err }
15078 result_ok: o.result_ok,
15082 impl Clone for CResult_PingDecodeErrorZ {
15083 fn clone(&self) -> Self {
15084 if self.result_ok {
15085 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
15086 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
15089 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
15090 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15096 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
15097 /// but with all dynamically-allocated buffers duplicated in new buffers.
15098 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
15100 /// The contents of CResult_PongDecodeErrorZ
15101 pub union CResult_PongDecodeErrorZPtr {
15102 /// A pointer to the contents in the success state.
15103 /// Reading from this pointer when `result_ok` is not set is undefined.
15104 pub result: *mut crate::lightning::ln::msgs::Pong,
15105 /// A pointer to the contents in the error state.
15106 /// Reading from this pointer when `result_ok` is set is undefined.
15107 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15110 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
15111 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
15112 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15113 pub struct CResult_PongDecodeErrorZ {
15114 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
15115 /// `err` or `result` depending on the state of `result_ok`.
15116 pub contents: CResult_PongDecodeErrorZPtr,
15117 /// Whether this CResult_PongDecodeErrorZ represents a success state.
15118 pub result_ok: bool,
15121 /// Creates a new CResult_PongDecodeErrorZ in the success state.
15122 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
15123 CResult_PongDecodeErrorZ {
15124 contents: CResult_PongDecodeErrorZPtr {
15125 result: Box::into_raw(Box::new(o)),
15131 /// Creates a new CResult_PongDecodeErrorZ in the error state.
15132 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
15133 CResult_PongDecodeErrorZ {
15134 contents: CResult_PongDecodeErrorZPtr {
15135 err: Box::into_raw(Box::new(e)),
15140 /// Checks if the given object is currently in the success state
15142 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
15146 /// Frees any resources used by the CResult_PongDecodeErrorZ.
15147 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
15148 impl Drop for CResult_PongDecodeErrorZ {
15149 fn drop(&mut self) {
15150 if self.result_ok {
15151 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15152 let _ = unsafe { Box::from_raw(self.contents.result) };
15155 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15156 let _ = unsafe { Box::from_raw(self.contents.err) };
15161 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
15162 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
15163 let contents = if o.result_ok {
15164 let result = unsafe { o.contents.result };
15165 unsafe { o.contents.result = core::ptr::null_mut() };
15166 CResult_PongDecodeErrorZPtr { result }
15168 let err = unsafe { o.contents.err };
15169 unsafe { o.contents.err = core::ptr::null_mut(); }
15170 CResult_PongDecodeErrorZPtr { err }
15174 result_ok: o.result_ok,
15178 impl Clone for CResult_PongDecodeErrorZ {
15179 fn clone(&self) -> Self {
15180 if self.result_ok {
15181 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
15182 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
15185 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
15186 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15192 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15193 /// but with all dynamically-allocated buffers duplicated in new buffers.
15194 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
15196 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
15197 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15198 /// A pointer to the contents in the success state.
15199 /// Reading from this pointer when `result_ok` is not set is undefined.
15200 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
15201 /// A pointer to the contents in the error state.
15202 /// Reading from this pointer when `result_ok` is set is undefined.
15203 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15206 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15207 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15208 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15209 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15210 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
15211 /// `err` or `result` depending on the state of `result_ok`.
15212 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
15213 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
15214 pub result_ok: bool,
15217 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15218 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15219 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15220 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15221 result: Box::into_raw(Box::new(o)),
15227 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
15228 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15229 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15230 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15231 err: Box::into_raw(Box::new(e)),
15236 /// Checks if the given object is currently in the success state
15238 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
15242 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
15243 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
15244 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15245 fn drop(&mut self) {
15246 if self.result_ok {
15247 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15248 let _ = unsafe { Box::from_raw(self.contents.result) };
15251 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15252 let _ = unsafe { Box::from_raw(self.contents.err) };
15257 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15258 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15259 let contents = if o.result_ok {
15260 let result = unsafe { o.contents.result };
15261 unsafe { o.contents.result = core::ptr::null_mut() };
15262 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
15264 let err = unsafe { o.contents.err };
15265 unsafe { o.contents.err = core::ptr::null_mut(); }
15266 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
15270 result_ok: o.result_ok,
15274 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15275 fn clone(&self) -> Self {
15276 if self.result_ok {
15277 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15278 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15281 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15282 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15288 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15289 /// but with all dynamically-allocated buffers duplicated in new buffers.
15290 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15292 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
15293 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
15294 /// A pointer to the contents in the success state.
15295 /// Reading from this pointer when `result_ok` is not set is undefined.
15296 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
15297 /// A pointer to the contents in the error state.
15298 /// Reading from this pointer when `result_ok` is set is undefined.
15299 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15302 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15303 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15304 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15305 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
15306 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
15307 /// `err` or `result` depending on the state of `result_ok`.
15308 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
15309 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
15310 pub result_ok: bool,
15313 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
15314 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
15315 CResult_ChannelAnnouncementDecodeErrorZ {
15316 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15317 result: Box::into_raw(Box::new(o)),
15323 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15324 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
15325 CResult_ChannelAnnouncementDecodeErrorZ {
15326 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15327 err: Box::into_raw(Box::new(e)),
15332 /// Checks if the given object is currently in the success state
15334 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
15338 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15339 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
15340 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
15341 fn drop(&mut self) {
15342 if self.result_ok {
15343 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15344 let _ = unsafe { Box::from_raw(self.contents.result) };
15347 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15348 let _ = unsafe { Box::from_raw(self.contents.err) };
15353 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
15354 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15355 let contents = if o.result_ok {
15356 let result = unsafe { o.contents.result };
15357 unsafe { o.contents.result = core::ptr::null_mut() };
15358 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
15360 let err = unsafe { o.contents.err };
15361 unsafe { o.contents.err = core::ptr::null_mut(); }
15362 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
15366 result_ok: o.result_ok,
15370 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
15371 fn clone(&self) -> Self {
15372 if self.result_ok {
15373 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15374 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15377 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15378 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15384 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15385 /// but with all dynamically-allocated buffers duplicated in new buffers.
15386 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15388 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
15389 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15390 /// A pointer to the contents in the success state.
15391 /// Reading from this pointer when `result_ok` is not set is undefined.
15392 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
15393 /// A pointer to the contents in the error state.
15394 /// Reading from this pointer when `result_ok` is set is undefined.
15395 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15398 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15399 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15401 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
15402 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
15403 /// `err` or `result` depending on the state of `result_ok`.
15404 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
15405 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
15406 pub result_ok: bool,
15409 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15410 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15411 CResult_UnsignedChannelUpdateDecodeErrorZ {
15412 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15413 result: Box::into_raw(Box::new(o)),
15419 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15420 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15421 CResult_UnsignedChannelUpdateDecodeErrorZ {
15422 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15423 err: Box::into_raw(Box::new(e)),
15428 /// Checks if the given object is currently in the success state
15430 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
15434 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
15435 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
15436 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
15437 fn drop(&mut self) {
15438 if self.result_ok {
15439 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15440 let _ = unsafe { Box::from_raw(self.contents.result) };
15443 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15444 let _ = unsafe { Box::from_raw(self.contents.err) };
15449 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
15450 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15451 let contents = if o.result_ok {
15452 let result = unsafe { o.contents.result };
15453 unsafe { o.contents.result = core::ptr::null_mut() };
15454 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
15456 let err = unsafe { o.contents.err };
15457 unsafe { o.contents.err = core::ptr::null_mut(); }
15458 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
15462 result_ok: o.result_ok,
15466 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
15467 fn clone(&self) -> Self {
15468 if self.result_ok {
15469 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15470 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
15473 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15474 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15480 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
15481 /// but with all dynamically-allocated buffers duplicated in new buffers.
15482 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15484 /// The contents of CResult_ChannelUpdateDecodeErrorZ
15485 pub union CResult_ChannelUpdateDecodeErrorZPtr {
15486 /// A pointer to the contents in the success state.
15487 /// Reading from this pointer when `result_ok` is not set is undefined.
15488 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
15489 /// A pointer to the contents in the error state.
15490 /// Reading from this pointer when `result_ok` is set is undefined.
15491 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15494 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15495 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15497 pub struct CResult_ChannelUpdateDecodeErrorZ {
15498 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
15499 /// `err` or `result` depending on the state of `result_ok`.
15500 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
15501 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
15502 pub result_ok: bool,
15505 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
15506 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
15507 CResult_ChannelUpdateDecodeErrorZ {
15508 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15509 result: Box::into_raw(Box::new(o)),
15515 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
15516 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
15517 CResult_ChannelUpdateDecodeErrorZ {
15518 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15519 err: Box::into_raw(Box::new(e)),
15524 /// Checks if the given object is currently in the success state
15526 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
15530 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
15531 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
15532 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
15533 fn drop(&mut self) {
15534 if self.result_ok {
15535 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15536 let _ = unsafe { Box::from_raw(self.contents.result) };
15539 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15540 let _ = unsafe { Box::from_raw(self.contents.err) };
15545 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
15546 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15547 let contents = if o.result_ok {
15548 let result = unsafe { o.contents.result };
15549 unsafe { o.contents.result = core::ptr::null_mut() };
15550 CResult_ChannelUpdateDecodeErrorZPtr { result }
15552 let err = unsafe { o.contents.err };
15553 unsafe { o.contents.err = core::ptr::null_mut(); }
15554 CResult_ChannelUpdateDecodeErrorZPtr { err }
15558 result_ok: o.result_ok,
15562 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
15563 fn clone(&self) -> Self {
15564 if self.result_ok {
15565 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15566 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
15569 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15570 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15576 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
15577 /// but with all dynamically-allocated buffers duplicated in new buffers.
15578 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15580 /// The contents of CResult_ErrorMessageDecodeErrorZ
15581 pub union CResult_ErrorMessageDecodeErrorZPtr {
15582 /// A pointer to the contents in the success state.
15583 /// Reading from this pointer when `result_ok` is not set is undefined.
15584 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
15585 /// A pointer to the contents in the error state.
15586 /// Reading from this pointer when `result_ok` is set is undefined.
15587 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15590 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
15591 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15593 pub struct CResult_ErrorMessageDecodeErrorZ {
15594 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
15595 /// `err` or `result` depending on the state of `result_ok`.
15596 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
15597 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
15598 pub result_ok: bool,
15601 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
15602 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
15603 CResult_ErrorMessageDecodeErrorZ {
15604 contents: CResult_ErrorMessageDecodeErrorZPtr {
15605 result: Box::into_raw(Box::new(o)),
15611 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
15612 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
15613 CResult_ErrorMessageDecodeErrorZ {
15614 contents: CResult_ErrorMessageDecodeErrorZPtr {
15615 err: Box::into_raw(Box::new(e)),
15620 /// Checks if the given object is currently in the success state
15622 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
15626 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
15627 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
15628 impl Drop for CResult_ErrorMessageDecodeErrorZ {
15629 fn drop(&mut self) {
15630 if self.result_ok {
15631 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15632 let _ = unsafe { Box::from_raw(self.contents.result) };
15635 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15636 let _ = unsafe { Box::from_raw(self.contents.err) };
15641 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
15642 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15643 let contents = if o.result_ok {
15644 let result = unsafe { o.contents.result };
15645 unsafe { o.contents.result = core::ptr::null_mut() };
15646 CResult_ErrorMessageDecodeErrorZPtr { result }
15648 let err = unsafe { o.contents.err };
15649 unsafe { o.contents.err = core::ptr::null_mut(); }
15650 CResult_ErrorMessageDecodeErrorZPtr { err }
15654 result_ok: o.result_ok,
15658 impl Clone for CResult_ErrorMessageDecodeErrorZ {
15659 fn clone(&self) -> Self {
15660 if self.result_ok {
15661 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
15662 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
15665 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
15666 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15672 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
15673 /// but with all dynamically-allocated buffers duplicated in new buffers.
15674 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
15676 /// The contents of CResult_WarningMessageDecodeErrorZ
15677 pub union CResult_WarningMessageDecodeErrorZPtr {
15678 /// A pointer to the contents in the success state.
15679 /// Reading from this pointer when `result_ok` is not set is undefined.
15680 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
15681 /// A pointer to the contents in the error state.
15682 /// Reading from this pointer when `result_ok` is set is undefined.
15683 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15686 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
15687 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15688 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15689 pub struct CResult_WarningMessageDecodeErrorZ {
15690 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
15691 /// `err` or `result` depending on the state of `result_ok`.
15692 pub contents: CResult_WarningMessageDecodeErrorZPtr,
15693 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
15694 pub result_ok: bool,
15697 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
15698 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
15699 CResult_WarningMessageDecodeErrorZ {
15700 contents: CResult_WarningMessageDecodeErrorZPtr {
15701 result: Box::into_raw(Box::new(o)),
15707 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
15708 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
15709 CResult_WarningMessageDecodeErrorZ {
15710 contents: CResult_WarningMessageDecodeErrorZPtr {
15711 err: Box::into_raw(Box::new(e)),
15716 /// Checks if the given object is currently in the success state
15718 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
15722 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
15723 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
15724 impl Drop for CResult_WarningMessageDecodeErrorZ {
15725 fn drop(&mut self) {
15726 if self.result_ok {
15727 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15728 let _ = unsafe { Box::from_raw(self.contents.result) };
15731 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15732 let _ = unsafe { Box::from_raw(self.contents.err) };
15737 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
15738 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15739 let contents = if o.result_ok {
15740 let result = unsafe { o.contents.result };
15741 unsafe { o.contents.result = core::ptr::null_mut() };
15742 CResult_WarningMessageDecodeErrorZPtr { result }
15744 let err = unsafe { o.contents.err };
15745 unsafe { o.contents.err = core::ptr::null_mut(); }
15746 CResult_WarningMessageDecodeErrorZPtr { err }
15750 result_ok: o.result_ok,
15754 impl Clone for CResult_WarningMessageDecodeErrorZ {
15755 fn clone(&self) -> Self {
15756 if self.result_ok {
15757 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
15758 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
15761 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
15762 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15768 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
15769 /// but with all dynamically-allocated buffers duplicated in new buffers.
15770 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
15772 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
15773 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15774 /// A pointer to the contents in the success state.
15775 /// Reading from this pointer when `result_ok` is not set is undefined.
15776 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
15777 /// A pointer to the contents in the error state.
15778 /// Reading from this pointer when `result_ok` is set is undefined.
15779 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15782 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15783 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15785 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15786 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
15787 /// `err` or `result` depending on the state of `result_ok`.
15788 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
15789 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
15790 pub result_ok: bool,
15793 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
15794 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15795 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15796 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15797 result: Box::into_raw(Box::new(o)),
15803 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
15804 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15805 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15806 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15807 err: Box::into_raw(Box::new(e)),
15812 /// Checks if the given object is currently in the success state
15814 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
15818 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
15819 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
15820 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15821 fn drop(&mut self) {
15822 if self.result_ok {
15823 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15824 let _ = unsafe { Box::from_raw(self.contents.result) };
15827 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15828 let _ = unsafe { Box::from_raw(self.contents.err) };
15833 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15834 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15835 let contents = if o.result_ok {
15836 let result = unsafe { o.contents.result };
15837 unsafe { o.contents.result = core::ptr::null_mut() };
15838 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
15840 let err = unsafe { o.contents.err };
15841 unsafe { o.contents.err = core::ptr::null_mut(); }
15842 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
15846 result_ok: o.result_ok,
15850 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15851 fn clone(&self) -> Self {
15852 if self.result_ok {
15853 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15854 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15857 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15858 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15864 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
15865 /// but with all dynamically-allocated buffers duplicated in new buffers.
15866 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15868 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
15869 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
15870 /// A pointer to the contents in the success state.
15871 /// Reading from this pointer when `result_ok` is not set is undefined.
15872 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
15873 /// A pointer to the contents in the error state.
15874 /// Reading from this pointer when `result_ok` is set is undefined.
15875 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15878 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15879 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15880 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15881 pub struct CResult_NodeAnnouncementDecodeErrorZ {
15882 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
15883 /// `err` or `result` depending on the state of `result_ok`.
15884 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
15885 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
15886 pub result_ok: bool,
15889 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
15890 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
15891 CResult_NodeAnnouncementDecodeErrorZ {
15892 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15893 result: Box::into_raw(Box::new(o)),
15899 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
15900 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
15901 CResult_NodeAnnouncementDecodeErrorZ {
15902 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15903 err: Box::into_raw(Box::new(e)),
15908 /// Checks if the given object is currently in the success state
15910 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
15914 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
15915 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
15916 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
15917 fn drop(&mut self) {
15918 if self.result_ok {
15919 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15920 let _ = unsafe { Box::from_raw(self.contents.result) };
15923 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15924 let _ = unsafe { Box::from_raw(self.contents.err) };
15929 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
15930 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15931 let contents = if o.result_ok {
15932 let result = unsafe { o.contents.result };
15933 unsafe { o.contents.result = core::ptr::null_mut() };
15934 CResult_NodeAnnouncementDecodeErrorZPtr { result }
15936 let err = unsafe { o.contents.err };
15937 unsafe { o.contents.err = core::ptr::null_mut(); }
15938 CResult_NodeAnnouncementDecodeErrorZPtr { err }
15942 result_ok: o.result_ok,
15946 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
15947 fn clone(&self) -> Self {
15948 if self.result_ok {
15949 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15950 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15953 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15954 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15960 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
15961 /// but with all dynamically-allocated buffers duplicated in new buffers.
15962 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15964 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
15965 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
15966 /// A pointer to the contents in the success state.
15967 /// Reading from this pointer when `result_ok` is not set is undefined.
15968 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
15969 /// A pointer to the contents in the error state.
15970 /// Reading from this pointer when `result_ok` is set is undefined.
15971 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15974 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
15975 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
15976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15977 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
15978 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
15979 /// `err` or `result` depending on the state of `result_ok`.
15980 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
15981 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
15982 pub result_ok: bool,
15985 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
15986 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15987 CResult_QueryShortChannelIdsDecodeErrorZ {
15988 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15989 result: Box::into_raw(Box::new(o)),
15995 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
15996 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15997 CResult_QueryShortChannelIdsDecodeErrorZ {
15998 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15999 err: Box::into_raw(Box::new(e)),
16004 /// Checks if the given object is currently in the success state
16006 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
16010 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16011 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
16012 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
16013 fn drop(&mut self) {
16014 if self.result_ok {
16015 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16016 let _ = unsafe { Box::from_raw(self.contents.result) };
16019 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16020 let _ = unsafe { Box::from_raw(self.contents.err) };
16025 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
16026 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
16027 let contents = if o.result_ok {
16028 let result = unsafe { o.contents.result };
16029 unsafe { o.contents.result = core::ptr::null_mut() };
16030 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
16032 let err = unsafe { o.contents.err };
16033 unsafe { o.contents.err = core::ptr::null_mut(); }
16034 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
16038 result_ok: o.result_ok,
16042 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
16043 fn clone(&self) -> Self {
16044 if self.result_ok {
16045 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16046 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
16049 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16050 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16056 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16057 /// but with all dynamically-allocated buffers duplicated in new buffers.
16058 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
16060 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
16061 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16062 /// A pointer to the contents in the success state.
16063 /// Reading from this pointer when `result_ok` is not set is undefined.
16064 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
16065 /// A pointer to the contents in the error state.
16066 /// Reading from this pointer when `result_ok` is set is undefined.
16067 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16070 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
16071 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
16072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16073 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16074 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
16075 /// `err` or `result` depending on the state of `result_ok`.
16076 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
16077 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
16078 pub result_ok: bool,
16081 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16082 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16083 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16084 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16085 result: Box::into_raw(Box::new(o)),
16091 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16092 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16093 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16094 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16095 err: Box::into_raw(Box::new(e)),
16100 /// Checks if the given object is currently in the success state
16102 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
16106 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16107 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
16108 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16109 fn drop(&mut self) {
16110 if self.result_ok {
16111 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16112 let _ = unsafe { Box::from_raw(self.contents.result) };
16115 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16116 let _ = unsafe { Box::from_raw(self.contents.err) };
16121 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16122 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
16123 let contents = if o.result_ok {
16124 let result = unsafe { o.contents.result };
16125 unsafe { o.contents.result = core::ptr::null_mut() };
16126 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
16128 let err = unsafe { o.contents.err };
16129 unsafe { o.contents.err = core::ptr::null_mut(); }
16130 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
16134 result_ok: o.result_ok,
16138 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16139 fn clone(&self) -> Self {
16140 if self.result_ok {
16141 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16142 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
16145 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16146 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16152 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16153 /// but with all dynamically-allocated buffers duplicated in new buffers.
16154 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
16156 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
16157 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
16158 /// A pointer to the contents in the success state.
16159 /// Reading from this pointer when `result_ok` is not set is undefined.
16160 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
16161 /// A pointer to the contents in the error state.
16162 /// Reading from this pointer when `result_ok` is set is undefined.
16163 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16166 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
16167 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16168 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16169 pub struct CResult_QueryChannelRangeDecodeErrorZ {
16170 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
16171 /// `err` or `result` depending on the state of `result_ok`.
16172 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
16173 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
16174 pub result_ok: bool,
16177 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16178 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
16179 CResult_QueryChannelRangeDecodeErrorZ {
16180 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16181 result: Box::into_raw(Box::new(o)),
16187 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16188 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
16189 CResult_QueryChannelRangeDecodeErrorZ {
16190 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16191 err: Box::into_raw(Box::new(e)),
16196 /// Checks if the given object is currently in the success state
16198 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
16202 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16203 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
16204 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
16205 fn drop(&mut self) {
16206 if self.result_ok {
16207 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16208 let _ = unsafe { Box::from_raw(self.contents.result) };
16211 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16212 let _ = unsafe { Box::from_raw(self.contents.err) };
16217 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
16218 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16219 let contents = if o.result_ok {
16220 let result = unsafe { o.contents.result };
16221 unsafe { o.contents.result = core::ptr::null_mut() };
16222 CResult_QueryChannelRangeDecodeErrorZPtr { result }
16224 let err = unsafe { o.contents.err };
16225 unsafe { o.contents.err = core::ptr::null_mut(); }
16226 CResult_QueryChannelRangeDecodeErrorZPtr { err }
16230 result_ok: o.result_ok,
16234 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
16235 fn clone(&self) -> Self {
16236 if self.result_ok {
16237 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16238 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
16241 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16242 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16248 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16249 /// but with all dynamically-allocated buffers duplicated in new buffers.
16250 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16252 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
16253 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
16254 /// A pointer to the contents in the success state.
16255 /// Reading from this pointer when `result_ok` is not set is undefined.
16256 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
16257 /// A pointer to the contents in the error state.
16258 /// Reading from this pointer when `result_ok` is set is undefined.
16259 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16262 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
16263 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16264 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16265 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
16266 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
16267 /// `err` or `result` depending on the state of `result_ok`.
16268 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
16269 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
16270 pub result_ok: bool,
16273 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16274 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
16275 CResult_ReplyChannelRangeDecodeErrorZ {
16276 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16277 result: Box::into_raw(Box::new(o)),
16283 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16284 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
16285 CResult_ReplyChannelRangeDecodeErrorZ {
16286 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16287 err: Box::into_raw(Box::new(e)),
16292 /// Checks if the given object is currently in the success state
16294 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
16298 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16299 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
16300 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
16301 fn drop(&mut self) {
16302 if self.result_ok {
16303 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16304 let _ = unsafe { Box::from_raw(self.contents.result) };
16307 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16308 let _ = unsafe { Box::from_raw(self.contents.err) };
16313 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
16314 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16315 let contents = if o.result_ok {
16316 let result = unsafe { o.contents.result };
16317 unsafe { o.contents.result = core::ptr::null_mut() };
16318 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
16320 let err = unsafe { o.contents.err };
16321 unsafe { o.contents.err = core::ptr::null_mut(); }
16322 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
16326 result_ok: o.result_ok,
16330 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
16331 fn clone(&self) -> Self {
16332 if self.result_ok {
16333 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16334 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
16337 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16338 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16344 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16345 /// but with all dynamically-allocated buffers duplicated in new buffers.
16346 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16348 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
16349 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
16350 /// A pointer to the contents in the success state.
16351 /// Reading from this pointer when `result_ok` is not set is undefined.
16352 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
16353 /// A pointer to the contents in the error state.
16354 /// Reading from this pointer when `result_ok` is set is undefined.
16355 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16358 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
16359 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
16360 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16361 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
16362 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
16363 /// `err` or `result` depending on the state of `result_ok`.
16364 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
16365 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
16366 pub result_ok: bool,
16369 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16370 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
16371 CResult_GossipTimestampFilterDecodeErrorZ {
16372 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16373 result: Box::into_raw(Box::new(o)),
16379 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16380 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
16381 CResult_GossipTimestampFilterDecodeErrorZ {
16382 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16383 err: Box::into_raw(Box::new(e)),
16388 /// Checks if the given object is currently in the success state
16390 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
16394 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16395 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
16396 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
16397 fn drop(&mut self) {
16398 if self.result_ok {
16399 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16400 let _ = unsafe { Box::from_raw(self.contents.result) };
16403 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16404 let _ = unsafe { Box::from_raw(self.contents.err) };
16409 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
16410 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
16411 let contents = if o.result_ok {
16412 let result = unsafe { o.contents.result };
16413 unsafe { o.contents.result = core::ptr::null_mut() };
16414 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
16416 let err = unsafe { o.contents.err };
16417 unsafe { o.contents.err = core::ptr::null_mut(); }
16418 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
16422 result_ok: o.result_ok,
16426 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
16427 fn clone(&self) -> Self {
16428 if self.result_ok {
16429 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16430 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
16433 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16434 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16440 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16441 /// but with all dynamically-allocated buffers duplicated in new buffers.
16442 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
16444 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
16445 /// This corresponds to std::vector in C++
16446 pub struct CVec_PhantomRouteHintsZ {
16447 /// The elements in the array.
16448 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16449 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
16450 /// The number of elements pointed to by `data`.
16453 impl CVec_PhantomRouteHintsZ {
16454 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
16455 if self.datalen == 0 { return Vec::new(); }
16456 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16457 self.data = core::ptr::null_mut();
16461 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
16462 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16465 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
16466 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
16467 let datalen = v.len();
16468 let data = Box::into_raw(v.into_boxed_slice());
16469 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16473 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16474 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
16475 impl Drop for CVec_PhantomRouteHintsZ {
16476 fn drop(&mut self) {
16477 if self.datalen == 0 { return; }
16478 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16481 impl Clone for CVec_PhantomRouteHintsZ {
16482 fn clone(&self) -> Self {
16483 let mut res = Vec::new();
16484 if self.datalen == 0 { return Self::from(res); }
16485 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16490 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
16491 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
16492 /// A pointer to the contents in the success state.
16493 /// Reading from this pointer when `result_ok` is not set is undefined.
16494 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
16495 /// A pointer to the contents in the error state.
16496 /// Reading from this pointer when `result_ok` is set is undefined.
16497 pub err: *mut crate::lightning_invoice::SignOrCreationError,
16500 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
16501 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
16502 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16503 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
16504 /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
16505 /// `err` or `result` depending on the state of `result_ok`.
16506 pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
16507 /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
16508 pub result_ok: bool,
16511 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
16512 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
16513 CResult_Bolt11InvoiceSignOrCreationErrorZ {
16514 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
16515 result: Box::into_raw(Box::new(o)),
16521 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
16522 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
16523 CResult_Bolt11InvoiceSignOrCreationErrorZ {
16524 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
16525 err: Box::into_raw(Box::new(e)),
16530 /// Checks if the given object is currently in the success state
16532 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
16536 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
16537 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
16538 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
16539 fn drop(&mut self) {
16540 if self.result_ok {
16541 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16542 let _ = unsafe { Box::from_raw(self.contents.result) };
16545 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16546 let _ = unsafe { Box::from_raw(self.contents.err) };
16551 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
16552 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
16553 let contents = if o.result_ok {
16554 let result = unsafe { o.contents.result };
16555 unsafe { o.contents.result = core::ptr::null_mut() };
16556 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
16558 let err = unsafe { o.contents.err };
16559 unsafe { o.contents.err = core::ptr::null_mut(); }
16560 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
16564 result_ok: o.result_ok,
16568 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
16569 fn clone(&self) -> Self {
16570 if self.result_ok {
16571 Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
16572 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
16575 Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
16576 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
16582 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
16583 /// but with all dynamically-allocated buffers duplicated in new buffers.
16584 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
16586 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
16587 /// This corresponds to std::vector in C++
16588 pub struct CVec_FutureZ {
16589 /// The elements in the array.
16590 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16591 pub data: *mut crate::lightning::util::wakers::Future,
16592 /// The number of elements pointed to by `data`.
16595 impl CVec_FutureZ {
16596 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
16597 if self.datalen == 0 { return Vec::new(); }
16598 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16599 self.data = core::ptr::null_mut();
16603 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
16604 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16607 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
16608 fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
16609 let datalen = v.len();
16610 let data = Box::into_raw(v.into_boxed_slice());
16611 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16615 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16616 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
16617 impl Drop for CVec_FutureZ {
16618 fn drop(&mut self) {
16619 if self.datalen == 0 { return; }
16620 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16623 impl Clone for CVec_FutureZ {
16624 fn clone(&self) -> Self {
16625 let mut res = Vec::new();
16626 if self.datalen == 0 { return Self::from(res); }
16627 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16632 /// The contents of CResult_OffersMessageDecodeErrorZ
16633 pub union CResult_OffersMessageDecodeErrorZPtr {
16634 /// A pointer to the contents in the success state.
16635 /// Reading from this pointer when `result_ok` is not set is undefined.
16636 pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
16637 /// A pointer to the contents in the error state.
16638 /// Reading from this pointer when `result_ok` is set is undefined.
16639 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16642 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
16643 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16644 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16645 pub struct CResult_OffersMessageDecodeErrorZ {
16646 /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
16647 /// `err` or `result` depending on the state of `result_ok`.
16648 pub contents: CResult_OffersMessageDecodeErrorZPtr,
16649 /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
16650 pub result_ok: bool,
16653 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
16654 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
16655 CResult_OffersMessageDecodeErrorZ {
16656 contents: CResult_OffersMessageDecodeErrorZPtr {
16657 result: Box::into_raw(Box::new(o)),
16663 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
16664 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
16665 CResult_OffersMessageDecodeErrorZ {
16666 contents: CResult_OffersMessageDecodeErrorZPtr {
16667 err: Box::into_raw(Box::new(e)),
16672 /// Checks if the given object is currently in the success state
16674 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
16678 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
16679 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
16680 impl Drop for CResult_OffersMessageDecodeErrorZ {
16681 fn drop(&mut self) {
16682 if self.result_ok {
16683 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16684 let _ = unsafe { Box::from_raw(self.contents.result) };
16687 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16688 let _ = unsafe { Box::from_raw(self.contents.err) };
16693 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
16694 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16695 let contents = if o.result_ok {
16696 let result = unsafe { o.contents.result };
16697 unsafe { o.contents.result = core::ptr::null_mut() };
16698 CResult_OffersMessageDecodeErrorZPtr { result }
16700 let err = unsafe { o.contents.err };
16701 unsafe { o.contents.err = core::ptr::null_mut(); }
16702 CResult_OffersMessageDecodeErrorZPtr { err }
16706 result_ok: o.result_ok,
16710 impl Clone for CResult_OffersMessageDecodeErrorZ {
16711 fn clone(&self) -> Self {
16712 if self.result_ok {
16713 Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
16714 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
16717 Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
16718 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16724 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
16725 /// but with all dynamically-allocated buffers duplicated in new buffers.
16726 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
16728 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
16729 pub enum COption_HTLCClaimZ {
16730 /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
16731 Some(crate::lightning::ln::chan_utils::HTLCClaim),
16732 /// When we're in this state, this COption_HTLCClaimZ contains nothing
16735 impl COption_HTLCClaimZ {
16736 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
16737 if let Self::None = self { false } else { true }
16739 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
16742 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
16743 if let Self::Some(v) = self { v } else { unreachable!() }
16747 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
16748 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
16749 COption_HTLCClaimZ::Some(o)
16752 /// Constructs a new COption_HTLCClaimZ containing nothing
16753 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
16754 COption_HTLCClaimZ::None
16757 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
16758 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
16760 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
16761 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
16762 /// A pointer to the contents in the success state.
16763 /// Reading from this pointer when `result_ok` is not set is undefined.
16764 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
16765 /// A pointer to the contents in the error state.
16766 /// Reading from this pointer when `result_ok` is set is undefined.
16767 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16770 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
16771 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
16772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16773 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16774 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
16775 /// `err` or `result` depending on the state of `result_ok`.
16776 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
16777 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
16778 pub result_ok: bool,
16781 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
16782 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16783 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16784 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
16785 result: Box::into_raw(Box::new(o)),
16791 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
16792 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16793 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16794 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
16795 err: Box::into_raw(Box::new(e)),
16800 /// Checks if the given object is currently in the success state
16802 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
16806 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
16807 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
16808 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16809 fn drop(&mut self) {
16810 if self.result_ok {
16811 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16812 let _ = unsafe { Box::from_raw(self.contents.result) };
16815 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16816 let _ = unsafe { Box::from_raw(self.contents.err) };
16821 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16822 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
16823 let contents = if o.result_ok {
16824 let result = unsafe { o.contents.result };
16825 unsafe { o.contents.result = core::ptr::null_mut() };
16826 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
16828 let err = unsafe { o.contents.err };
16829 unsafe { o.contents.err = core::ptr::null_mut(); }
16830 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
16834 result_ok: o.result_ok,
16838 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16839 fn clone(&self) -> Self {
16840 if self.result_ok {
16841 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
16842 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
16845 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
16846 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16852 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
16853 /// but with all dynamically-allocated buffers duplicated in new buffers.
16854 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
16856 /// The contents of CResult_TxCreationKeysDecodeErrorZ
16857 pub union CResult_TxCreationKeysDecodeErrorZPtr {
16858 /// A pointer to the contents in the success state.
16859 /// Reading from this pointer when `result_ok` is not set is undefined.
16860 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
16861 /// A pointer to the contents in the error state.
16862 /// Reading from this pointer when `result_ok` is set is undefined.
16863 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16866 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
16867 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
16868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16869 pub struct CResult_TxCreationKeysDecodeErrorZ {
16870 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
16871 /// `err` or `result` depending on the state of `result_ok`.
16872 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
16873 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
16874 pub result_ok: bool,
16877 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
16878 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
16879 CResult_TxCreationKeysDecodeErrorZ {
16880 contents: CResult_TxCreationKeysDecodeErrorZPtr {
16881 result: Box::into_raw(Box::new(o)),
16887 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
16888 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
16889 CResult_TxCreationKeysDecodeErrorZ {
16890 contents: CResult_TxCreationKeysDecodeErrorZPtr {
16891 err: Box::into_raw(Box::new(e)),
16896 /// Checks if the given object is currently in the success state
16898 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
16902 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
16903 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
16904 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
16905 fn drop(&mut self) {
16906 if self.result_ok {
16907 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16908 let _ = unsafe { Box::from_raw(self.contents.result) };
16911 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16912 let _ = unsafe { Box::from_raw(self.contents.err) };
16917 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
16918 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
16919 let contents = if o.result_ok {
16920 let result = unsafe { o.contents.result };
16921 unsafe { o.contents.result = core::ptr::null_mut() };
16922 CResult_TxCreationKeysDecodeErrorZPtr { result }
16924 let err = unsafe { o.contents.err };
16925 unsafe { o.contents.err = core::ptr::null_mut(); }
16926 CResult_TxCreationKeysDecodeErrorZPtr { err }
16930 result_ok: o.result_ok,
16934 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
16935 fn clone(&self) -> Self {
16936 if self.result_ok {
16937 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
16938 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
16941 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
16942 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16948 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
16949 /// but with all dynamically-allocated buffers duplicated in new buffers.
16950 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
16952 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
16953 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
16954 /// A pointer to the contents in the success state.
16955 /// Reading from this pointer when `result_ok` is not set is undefined.
16956 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
16957 /// A pointer to the contents in the error state.
16958 /// Reading from this pointer when `result_ok` is set is undefined.
16959 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16962 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
16963 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
16964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16965 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
16966 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
16967 /// `err` or `result` depending on the state of `result_ok`.
16968 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
16969 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
16970 pub result_ok: bool,
16973 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
16974 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
16975 CResult_ChannelPublicKeysDecodeErrorZ {
16976 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
16977 result: Box::into_raw(Box::new(o)),
16983 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
16984 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
16985 CResult_ChannelPublicKeysDecodeErrorZ {
16986 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
16987 err: Box::into_raw(Box::new(e)),
16992 /// Checks if the given object is currently in the success state
16994 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
16998 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
16999 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
17000 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
17001 fn drop(&mut self) {
17002 if self.result_ok {
17003 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17004 let _ = unsafe { Box::from_raw(self.contents.result) };
17007 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17008 let _ = unsafe { Box::from_raw(self.contents.err) };
17013 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
17014 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
17015 let contents = if o.result_ok {
17016 let result = unsafe { o.contents.result };
17017 unsafe { o.contents.result = core::ptr::null_mut() };
17018 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
17020 let err = unsafe { o.contents.err };
17021 unsafe { o.contents.err = core::ptr::null_mut(); }
17022 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
17026 result_ok: o.result_ok,
17030 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
17031 fn clone(&self) -> Self {
17032 if self.result_ok {
17033 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
17034 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
17037 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
17038 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17044 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
17045 /// but with all dynamically-allocated buffers duplicated in new buffers.
17046 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
17048 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
17049 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
17050 /// A pointer to the contents in the success state.
17051 /// Reading from this pointer when `result_ok` is not set is undefined.
17052 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
17053 /// A pointer to the contents in the error state.
17054 /// Reading from this pointer when `result_ok` is set is undefined.
17055 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17058 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
17059 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
17060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17061 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
17062 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
17063 /// `err` or `result` depending on the state of `result_ok`.
17064 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
17065 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
17066 pub result_ok: bool,
17069 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
17070 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
17071 CResult_HTLCOutputInCommitmentDecodeErrorZ {
17072 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
17073 result: Box::into_raw(Box::new(o)),
17079 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
17080 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
17081 CResult_HTLCOutputInCommitmentDecodeErrorZ {
17082 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
17083 err: Box::into_raw(Box::new(e)),
17088 /// Checks if the given object is currently in the success state
17090 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
17094 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
17095 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
17096 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
17097 fn drop(&mut self) {
17098 if self.result_ok {
17099 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17100 let _ = unsafe { Box::from_raw(self.contents.result) };
17103 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17104 let _ = unsafe { Box::from_raw(self.contents.err) };
17109 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
17110 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
17111 let contents = if o.result_ok {
17112 let result = unsafe { o.contents.result };
17113 unsafe { o.contents.result = core::ptr::null_mut() };
17114 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
17116 let err = unsafe { o.contents.err };
17117 unsafe { o.contents.err = core::ptr::null_mut(); }
17118 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
17122 result_ok: o.result_ok,
17126 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
17127 fn clone(&self) -> Self {
17128 if self.result_ok {
17129 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
17130 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
17133 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
17134 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17140 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
17141 /// but with all dynamically-allocated buffers duplicated in new buffers.
17142 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
17144 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
17145 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
17146 /// A pointer to the contents in the success state.
17147 /// Reading from this pointer when `result_ok` is not set is undefined.
17148 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
17149 /// A pointer to the contents in the error state.
17150 /// Reading from this pointer when `result_ok` is set is undefined.
17151 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17154 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
17155 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
17156 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17157 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17158 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
17159 /// `err` or `result` depending on the state of `result_ok`.
17160 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
17161 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
17162 pub result_ok: bool,
17165 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
17166 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17167 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17168 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
17169 result: Box::into_raw(Box::new(o)),
17175 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
17176 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17177 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17178 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
17179 err: Box::into_raw(Box::new(e)),
17184 /// Checks if the given object is currently in the success state
17186 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
17190 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
17191 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
17192 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17193 fn drop(&mut self) {
17194 if self.result_ok {
17195 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17196 let _ = unsafe { Box::from_raw(self.contents.result) };
17199 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17200 let _ = unsafe { Box::from_raw(self.contents.err) };
17205 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17206 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
17207 let contents = if o.result_ok {
17208 let result = unsafe { o.contents.result };
17209 unsafe { o.contents.result = core::ptr::null_mut() };
17210 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
17212 let err = unsafe { o.contents.err };
17213 unsafe { o.contents.err = core::ptr::null_mut(); }
17214 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
17218 result_ok: o.result_ok,
17222 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
17223 fn clone(&self) -> Self {
17224 if self.result_ok {
17225 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
17226 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
17229 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
17230 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17236 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
17237 /// but with all dynamically-allocated buffers duplicated in new buffers.
17238 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
17240 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
17241 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
17242 /// A pointer to the contents in the success state.
17243 /// Reading from this pointer when `result_ok` is not set is undefined.
17244 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
17245 /// A pointer to the contents in the error state.
17246 /// Reading from this pointer when `result_ok` is set is undefined.
17247 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17250 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
17251 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
17252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17253 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
17254 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
17255 /// `err` or `result` depending on the state of `result_ok`.
17256 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
17257 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
17258 pub result_ok: bool,
17261 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
17262 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
17263 CResult_ChannelTransactionParametersDecodeErrorZ {
17264 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
17265 result: Box::into_raw(Box::new(o)),
17271 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
17272 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
17273 CResult_ChannelTransactionParametersDecodeErrorZ {
17274 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
17275 err: Box::into_raw(Box::new(e)),
17280 /// Checks if the given object is currently in the success state
17282 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
17286 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
17287 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
17288 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
17289 fn drop(&mut self) {
17290 if self.result_ok {
17291 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17292 let _ = unsafe { Box::from_raw(self.contents.result) };
17295 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17296 let _ = unsafe { Box::from_raw(self.contents.err) };
17301 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
17302 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
17303 let contents = if o.result_ok {
17304 let result = unsafe { o.contents.result };
17305 unsafe { o.contents.result = core::ptr::null_mut() };
17306 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
17308 let err = unsafe { o.contents.err };
17309 unsafe { o.contents.err = core::ptr::null_mut(); }
17310 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
17314 result_ok: o.result_ok,
17318 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
17319 fn clone(&self) -> Self {
17320 if self.result_ok {
17321 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
17322 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
17325 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
17326 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17332 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
17333 /// but with all dynamically-allocated buffers duplicated in new buffers.
17334 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
17336 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
17337 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
17338 /// A pointer to the contents in the success state.
17339 /// Reading from this pointer when `result_ok` is not set is undefined.
17340 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
17341 /// A pointer to the contents in the error state.
17342 /// Reading from this pointer when `result_ok` is set is undefined.
17343 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17346 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
17347 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
17348 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17349 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
17350 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
17351 /// `err` or `result` depending on the state of `result_ok`.
17352 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
17353 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
17354 pub result_ok: bool,
17357 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
17358 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
17359 CResult_HolderCommitmentTransactionDecodeErrorZ {
17360 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
17361 result: Box::into_raw(Box::new(o)),
17367 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
17368 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
17369 CResult_HolderCommitmentTransactionDecodeErrorZ {
17370 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
17371 err: Box::into_raw(Box::new(e)),
17376 /// Checks if the given object is currently in the success state
17378 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
17382 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
17383 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
17384 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
17385 fn drop(&mut self) {
17386 if self.result_ok {
17387 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17388 let _ = unsafe { Box::from_raw(self.contents.result) };
17391 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17392 let _ = unsafe { Box::from_raw(self.contents.err) };
17397 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
17398 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
17399 let contents = if o.result_ok {
17400 let result = unsafe { o.contents.result };
17401 unsafe { o.contents.result = core::ptr::null_mut() };
17402 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
17404 let err = unsafe { o.contents.err };
17405 unsafe { o.contents.err = core::ptr::null_mut(); }
17406 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
17410 result_ok: o.result_ok,
17414 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
17415 fn clone(&self) -> Self {
17416 if self.result_ok {
17417 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
17418 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
17421 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
17422 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17428 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
17429 /// but with all dynamically-allocated buffers duplicated in new buffers.
17430 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
17432 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
17433 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
17434 /// A pointer to the contents in the success state.
17435 /// Reading from this pointer when `result_ok` is not set is undefined.
17436 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
17437 /// A pointer to the contents in the error state.
17438 /// Reading from this pointer when `result_ok` is set is undefined.
17439 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17442 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
17443 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
17444 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17445 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
17446 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
17447 /// `err` or `result` depending on the state of `result_ok`.
17448 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
17449 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
17450 pub result_ok: bool,
17453 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
17454 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
17455 CResult_BuiltCommitmentTransactionDecodeErrorZ {
17456 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
17457 result: Box::into_raw(Box::new(o)),
17463 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
17464 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
17465 CResult_BuiltCommitmentTransactionDecodeErrorZ {
17466 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
17467 err: Box::into_raw(Box::new(e)),
17472 /// Checks if the given object is currently in the success state
17474 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
17478 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
17479 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
17480 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
17481 fn drop(&mut self) {
17482 if self.result_ok {
17483 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17484 let _ = unsafe { Box::from_raw(self.contents.result) };
17487 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17488 let _ = unsafe { Box::from_raw(self.contents.err) };
17493 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
17494 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
17495 let contents = if o.result_ok {
17496 let result = unsafe { o.contents.result };
17497 unsafe { o.contents.result = core::ptr::null_mut() };
17498 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
17500 let err = unsafe { o.contents.err };
17501 unsafe { o.contents.err = core::ptr::null_mut(); }
17502 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
17506 result_ok: o.result_ok,
17510 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
17511 fn clone(&self) -> Self {
17512 if self.result_ok {
17513 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
17514 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
17517 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
17518 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17524 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
17525 /// but with all dynamically-allocated buffers duplicated in new buffers.
17526 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
17528 /// The contents of CResult_TrustedClosingTransactionNoneZ
17529 pub union CResult_TrustedClosingTransactionNoneZPtr {
17530 /// A pointer to the contents in the success state.
17531 /// Reading from this pointer when `result_ok` is not set is undefined.
17532 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
17533 /// Note that this value is always NULL, as there are no contents in the Err variant
17534 pub err: *mut core::ffi::c_void,
17537 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
17538 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
17539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17540 pub struct CResult_TrustedClosingTransactionNoneZ {
17541 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
17542 /// `err` or `result` depending on the state of `result_ok`.
17543 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
17544 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
17545 pub result_ok: bool,
17548 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
17549 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
17550 CResult_TrustedClosingTransactionNoneZ {
17551 contents: CResult_TrustedClosingTransactionNoneZPtr {
17552 result: Box::into_raw(Box::new(o)),
17558 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
17559 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
17560 CResult_TrustedClosingTransactionNoneZ {
17561 contents: CResult_TrustedClosingTransactionNoneZPtr {
17562 err: core::ptr::null_mut(),
17567 /// Checks if the given object is currently in the success state
17569 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
17573 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
17574 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
17575 impl Drop for CResult_TrustedClosingTransactionNoneZ {
17576 fn drop(&mut self) {
17577 if self.result_ok {
17578 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17579 let _ = unsafe { Box::from_raw(self.contents.result) };
17585 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
17586 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
17587 let contents = if o.result_ok {
17588 let result = unsafe { o.contents.result };
17589 unsafe { o.contents.result = core::ptr::null_mut() };
17590 CResult_TrustedClosingTransactionNoneZPtr { result }
17592 let _ = unsafe { Box::from_raw(o.contents.err) };
17593 o.contents.err = core::ptr::null_mut();
17594 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
17598 result_ok: o.result_ok,
17603 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
17604 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
17605 /// A pointer to the contents in the success state.
17606 /// Reading from this pointer when `result_ok` is not set is undefined.
17607 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
17608 /// A pointer to the contents in the error state.
17609 /// Reading from this pointer when `result_ok` is set is undefined.
17610 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17613 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
17614 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
17615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17616 pub struct CResult_CommitmentTransactionDecodeErrorZ {
17617 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
17618 /// `err` or `result` depending on the state of `result_ok`.
17619 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
17620 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
17621 pub result_ok: bool,
17624 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
17625 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
17626 CResult_CommitmentTransactionDecodeErrorZ {
17627 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
17628 result: Box::into_raw(Box::new(o)),
17634 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
17635 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
17636 CResult_CommitmentTransactionDecodeErrorZ {
17637 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
17638 err: Box::into_raw(Box::new(e)),
17643 /// Checks if the given object is currently in the success state
17645 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
17649 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
17650 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
17651 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
17652 fn drop(&mut self) {
17653 if self.result_ok {
17654 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17655 let _ = unsafe { Box::from_raw(self.contents.result) };
17658 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17659 let _ = unsafe { Box::from_raw(self.contents.err) };
17664 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
17665 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
17666 let contents = if o.result_ok {
17667 let result = unsafe { o.contents.result };
17668 unsafe { o.contents.result = core::ptr::null_mut() };
17669 CResult_CommitmentTransactionDecodeErrorZPtr { result }
17671 let err = unsafe { o.contents.err };
17672 unsafe { o.contents.err = core::ptr::null_mut(); }
17673 CResult_CommitmentTransactionDecodeErrorZPtr { err }
17677 result_ok: o.result_ok,
17681 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
17682 fn clone(&self) -> Self {
17683 if self.result_ok {
17684 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
17685 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
17688 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
17689 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17695 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
17696 /// but with all dynamically-allocated buffers duplicated in new buffers.
17697 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
17699 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
17700 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
17701 /// A pointer to the contents in the success state.
17702 /// Reading from this pointer when `result_ok` is not set is undefined.
17703 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
17704 /// Note that this value is always NULL, as there are no contents in the Err variant
17705 pub err: *mut core::ffi::c_void,
17708 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
17709 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
17710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17711 pub struct CResult_TrustedCommitmentTransactionNoneZ {
17712 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
17713 /// `err` or `result` depending on the state of `result_ok`.
17714 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
17715 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
17716 pub result_ok: bool,
17719 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
17720 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
17721 CResult_TrustedCommitmentTransactionNoneZ {
17722 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
17723 result: Box::into_raw(Box::new(o)),
17729 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
17730 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
17731 CResult_TrustedCommitmentTransactionNoneZ {
17732 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
17733 err: core::ptr::null_mut(),
17738 /// Checks if the given object is currently in the success state
17740 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
17744 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
17745 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
17746 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
17747 fn drop(&mut self) {
17748 if self.result_ok {
17749 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17750 let _ = unsafe { Box::from_raw(self.contents.result) };
17756 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
17757 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
17758 let contents = if o.result_ok {
17759 let result = unsafe { o.contents.result };
17760 unsafe { o.contents.result = core::ptr::null_mut() };
17761 CResult_TrustedCommitmentTransactionNoneZPtr { result }
17763 let _ = unsafe { Box::from_raw(o.contents.err) };
17764 o.contents.err = core::ptr::null_mut();
17765 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
17769 result_ok: o.result_ok,
17774 /// The contents of CResult_CVec_SignatureZNoneZ
17775 pub union CResult_CVec_SignatureZNoneZPtr {
17776 /// A pointer to the contents in the success state.
17777 /// Reading from this pointer when `result_ok` is not set is undefined.
17778 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
17779 /// Note that this value is always NULL, as there are no contents in the Err variant
17780 pub err: *mut core::ffi::c_void,
17783 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
17784 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
17785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17786 pub struct CResult_CVec_SignatureZNoneZ {
17787 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
17788 /// `err` or `result` depending on the state of `result_ok`.
17789 pub contents: CResult_CVec_SignatureZNoneZPtr,
17790 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
17791 pub result_ok: bool,
17794 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
17795 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
17796 CResult_CVec_SignatureZNoneZ {
17797 contents: CResult_CVec_SignatureZNoneZPtr {
17798 result: Box::into_raw(Box::new(o)),
17804 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
17805 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
17806 CResult_CVec_SignatureZNoneZ {
17807 contents: CResult_CVec_SignatureZNoneZPtr {
17808 err: core::ptr::null_mut(),
17813 /// Checks if the given object is currently in the success state
17815 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
17819 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
17820 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
17821 impl Drop for CResult_CVec_SignatureZNoneZ {
17822 fn drop(&mut self) {
17823 if self.result_ok {
17824 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17825 let _ = unsafe { Box::from_raw(self.contents.result) };
17831 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
17832 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
17833 let contents = if o.result_ok {
17834 let result = unsafe { o.contents.result };
17835 unsafe { o.contents.result = core::ptr::null_mut() };
17836 CResult_CVec_SignatureZNoneZPtr { result }
17838 let _ = unsafe { Box::from_raw(o.contents.err) };
17839 o.contents.err = core::ptr::null_mut();
17840 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
17844 result_ok: o.result_ok,
17848 impl Clone for CResult_CVec_SignatureZNoneZ {
17849 fn clone(&self) -> Self {
17850 if self.result_ok {
17851 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
17852 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
17855 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
17856 err: core::ptr::null_mut()
17862 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
17863 /// but with all dynamically-allocated buffers duplicated in new buffers.
17864 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
17866 /// The contents of CResult_ShutdownScriptDecodeErrorZ
17867 pub union CResult_ShutdownScriptDecodeErrorZPtr {
17868 /// A pointer to the contents in the success state.
17869 /// Reading from this pointer when `result_ok` is not set is undefined.
17870 pub result: *mut crate::lightning::ln::script::ShutdownScript,
17871 /// A pointer to the contents in the error state.
17872 /// Reading from this pointer when `result_ok` is set is undefined.
17873 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17876 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
17877 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
17878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17879 pub struct CResult_ShutdownScriptDecodeErrorZ {
17880 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
17881 /// `err` or `result` depending on the state of `result_ok`.
17882 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
17883 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
17884 pub result_ok: bool,
17887 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
17888 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
17889 CResult_ShutdownScriptDecodeErrorZ {
17890 contents: CResult_ShutdownScriptDecodeErrorZPtr {
17891 result: Box::into_raw(Box::new(o)),
17897 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
17898 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
17899 CResult_ShutdownScriptDecodeErrorZ {
17900 contents: CResult_ShutdownScriptDecodeErrorZPtr {
17901 err: Box::into_raw(Box::new(e)),
17906 /// Checks if the given object is currently in the success state
17908 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
17912 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
17913 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
17914 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
17915 fn drop(&mut self) {
17916 if self.result_ok {
17917 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17918 let _ = unsafe { Box::from_raw(self.contents.result) };
17921 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17922 let _ = unsafe { Box::from_raw(self.contents.err) };
17927 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
17928 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
17929 let contents = if o.result_ok {
17930 let result = unsafe { o.contents.result };
17931 unsafe { o.contents.result = core::ptr::null_mut() };
17932 CResult_ShutdownScriptDecodeErrorZPtr { result }
17934 let err = unsafe { o.contents.err };
17935 unsafe { o.contents.err = core::ptr::null_mut(); }
17936 CResult_ShutdownScriptDecodeErrorZPtr { err }
17940 result_ok: o.result_ok,
17944 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
17945 fn clone(&self) -> Self {
17946 if self.result_ok {
17947 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
17948 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
17951 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
17952 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17958 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
17959 /// but with all dynamically-allocated buffers duplicated in new buffers.
17960 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
17962 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
17963 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
17964 /// A pointer to the contents in the success state.
17965 /// Reading from this pointer when `result_ok` is not set is undefined.
17966 pub result: *mut crate::lightning::ln::script::ShutdownScript,
17967 /// A pointer to the contents in the error state.
17968 /// Reading from this pointer when `result_ok` is set is undefined.
17969 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
17972 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
17973 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
17974 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17975 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
17976 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
17977 /// `err` or `result` depending on the state of `result_ok`.
17978 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
17979 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
17980 pub result_ok: bool,
17983 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
17984 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
17985 CResult_ShutdownScriptInvalidShutdownScriptZ {
17986 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
17987 result: Box::into_raw(Box::new(o)),
17993 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
17994 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
17995 CResult_ShutdownScriptInvalidShutdownScriptZ {
17996 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
17997 err: Box::into_raw(Box::new(e)),
18002 /// Checks if the given object is currently in the success state
18004 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
18008 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
18009 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
18010 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
18011 fn drop(&mut self) {
18012 if self.result_ok {
18013 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18014 let _ = unsafe { Box::from_raw(self.contents.result) };
18017 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18018 let _ = unsafe { Box::from_raw(self.contents.err) };
18023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
18024 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
18025 let contents = if o.result_ok {
18026 let result = unsafe { o.contents.result };
18027 unsafe { o.contents.result = core::ptr::null_mut() };
18028 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
18030 let err = unsafe { o.contents.err };
18031 unsafe { o.contents.err = core::ptr::null_mut(); }
18032 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
18036 result_ok: o.result_ok,
18040 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
18041 fn clone(&self) -> Self {
18042 if self.result_ok {
18043 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
18044 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
18047 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
18048 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
18054 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
18055 /// but with all dynamically-allocated buffers duplicated in new buffers.
18056 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
18058 /// The contents of CResult_PaymentPurposeDecodeErrorZ
18059 pub union CResult_PaymentPurposeDecodeErrorZPtr {
18060 /// A pointer to the contents in the success state.
18061 /// Reading from this pointer when `result_ok` is not set is undefined.
18062 pub result: *mut crate::lightning::events::PaymentPurpose,
18063 /// A pointer to the contents in the error state.
18064 /// Reading from this pointer when `result_ok` is set is undefined.
18065 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18068 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
18069 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
18070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18071 pub struct CResult_PaymentPurposeDecodeErrorZ {
18072 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
18073 /// `err` or `result` depending on the state of `result_ok`.
18074 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
18075 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
18076 pub result_ok: bool,
18079 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
18080 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
18081 CResult_PaymentPurposeDecodeErrorZ {
18082 contents: CResult_PaymentPurposeDecodeErrorZPtr {
18083 result: Box::into_raw(Box::new(o)),
18089 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
18090 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
18091 CResult_PaymentPurposeDecodeErrorZ {
18092 contents: CResult_PaymentPurposeDecodeErrorZPtr {
18093 err: Box::into_raw(Box::new(e)),
18098 /// Checks if the given object is currently in the success state
18100 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
18104 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
18105 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
18106 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
18107 fn drop(&mut self) {
18108 if self.result_ok {
18109 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18110 let _ = unsafe { Box::from_raw(self.contents.result) };
18113 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18114 let _ = unsafe { Box::from_raw(self.contents.err) };
18119 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
18120 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
18121 let contents = if o.result_ok {
18122 let result = unsafe { o.contents.result };
18123 unsafe { o.contents.result = core::ptr::null_mut() };
18124 CResult_PaymentPurposeDecodeErrorZPtr { result }
18126 let err = unsafe { o.contents.err };
18127 unsafe { o.contents.err = core::ptr::null_mut(); }
18128 CResult_PaymentPurposeDecodeErrorZPtr { err }
18132 result_ok: o.result_ok,
18136 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
18137 fn clone(&self) -> Self {
18138 if self.result_ok {
18139 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
18140 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
18143 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
18144 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18150 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
18151 /// but with all dynamically-allocated buffers duplicated in new buffers.
18152 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
18155 /// An enum which can either contain a crate::lightning::events::PathFailure or not
18156 pub enum COption_PathFailureZ {
18157 /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
18158 Some(crate::lightning::events::PathFailure),
18159 /// When we're in this state, this COption_PathFailureZ contains nothing
18162 impl COption_PathFailureZ {
18163 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18164 if let Self::None = self { false } else { true }
18166 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18169 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
18170 if let Self::Some(v) = self { v } else { unreachable!() }
18174 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
18175 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
18176 COption_PathFailureZ::Some(o)
18179 /// Constructs a new COption_PathFailureZ containing nothing
18180 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
18181 COption_PathFailureZ::None
18184 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
18185 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
18187 /// Creates a new COption_PathFailureZ which has the same data as `orig`
18188 /// but with all dynamically-allocated buffers duplicated in new buffers.
18189 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
18191 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
18192 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
18193 /// A pointer to the contents in the success state.
18194 /// Reading from this pointer when `result_ok` is not set is undefined.
18195 pub result: *mut crate::c_types::derived::COption_PathFailureZ,
18196 /// A pointer to the contents in the error state.
18197 /// Reading from this pointer when `result_ok` is set is undefined.
18198 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18201 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
18202 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
18203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18204 pub struct CResult_COption_PathFailureZDecodeErrorZ {
18205 /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
18206 /// `err` or `result` depending on the state of `result_ok`.
18207 pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
18208 /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
18209 pub result_ok: bool,
18212 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
18213 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
18214 CResult_COption_PathFailureZDecodeErrorZ {
18215 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
18216 result: Box::into_raw(Box::new(o)),
18222 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
18223 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
18224 CResult_COption_PathFailureZDecodeErrorZ {
18225 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
18226 err: Box::into_raw(Box::new(e)),
18231 /// Checks if the given object is currently in the success state
18233 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
18237 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
18238 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
18239 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
18240 fn drop(&mut self) {
18241 if self.result_ok {
18242 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18243 let _ = unsafe { Box::from_raw(self.contents.result) };
18246 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18247 let _ = unsafe { Box::from_raw(self.contents.err) };
18252 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
18253 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
18254 let contents = if o.result_ok {
18255 let result = unsafe { o.contents.result };
18256 unsafe { o.contents.result = core::ptr::null_mut() };
18257 CResult_COption_PathFailureZDecodeErrorZPtr { result }
18259 let err = unsafe { o.contents.err };
18260 unsafe { o.contents.err = core::ptr::null_mut(); }
18261 CResult_COption_PathFailureZDecodeErrorZPtr { err }
18265 result_ok: o.result_ok,
18269 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
18270 fn clone(&self) -> Self {
18271 if self.result_ok {
18272 Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
18273 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
18276 Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
18277 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18283 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
18284 /// but with all dynamically-allocated buffers duplicated in new buffers.
18285 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
18288 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
18289 pub enum COption_ClosureReasonZ {
18290 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
18291 Some(crate::lightning::events::ClosureReason),
18292 /// When we're in this state, this COption_ClosureReasonZ contains nothing
18295 impl COption_ClosureReasonZ {
18296 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18297 if let Self::None = self { false } else { true }
18299 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18302 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
18303 if let Self::Some(v) = self { v } else { unreachable!() }
18307 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
18308 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
18309 COption_ClosureReasonZ::Some(o)
18312 /// Constructs a new COption_ClosureReasonZ containing nothing
18313 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
18314 COption_ClosureReasonZ::None
18317 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
18318 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
18320 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
18321 /// but with all dynamically-allocated buffers duplicated in new buffers.
18322 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
18324 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
18325 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
18326 /// A pointer to the contents in the success state.
18327 /// Reading from this pointer when `result_ok` is not set is undefined.
18328 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
18329 /// A pointer to the contents in the error state.
18330 /// Reading from this pointer when `result_ok` is set is undefined.
18331 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18334 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
18335 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
18336 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18337 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
18338 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
18339 /// `err` or `result` depending on the state of `result_ok`.
18340 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
18341 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
18342 pub result_ok: bool,
18345 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
18346 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
18347 CResult_COption_ClosureReasonZDecodeErrorZ {
18348 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
18349 result: Box::into_raw(Box::new(o)),
18355 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
18356 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
18357 CResult_COption_ClosureReasonZDecodeErrorZ {
18358 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
18359 err: Box::into_raw(Box::new(e)),
18364 /// Checks if the given object is currently in the success state
18366 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
18370 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
18371 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
18372 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
18373 fn drop(&mut self) {
18374 if self.result_ok {
18375 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18376 let _ = unsafe { Box::from_raw(self.contents.result) };
18379 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18380 let _ = unsafe { Box::from_raw(self.contents.err) };
18385 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
18386 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
18387 let contents = if o.result_ok {
18388 let result = unsafe { o.contents.result };
18389 unsafe { o.contents.result = core::ptr::null_mut() };
18390 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
18392 let err = unsafe { o.contents.err };
18393 unsafe { o.contents.err = core::ptr::null_mut(); }
18394 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
18398 result_ok: o.result_ok,
18402 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
18403 fn clone(&self) -> Self {
18404 if self.result_ok {
18405 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
18406 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
18409 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
18410 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18416 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
18417 /// but with all dynamically-allocated buffers duplicated in new buffers.
18418 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
18421 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
18422 pub enum COption_HTLCDestinationZ {
18423 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
18424 Some(crate::lightning::events::HTLCDestination),
18425 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
18428 impl COption_HTLCDestinationZ {
18429 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18430 if let Self::None = self { false } else { true }
18432 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18435 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
18436 if let Self::Some(v) = self { v } else { unreachable!() }
18440 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
18441 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
18442 COption_HTLCDestinationZ::Some(o)
18445 /// Constructs a new COption_HTLCDestinationZ containing nothing
18446 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
18447 COption_HTLCDestinationZ::None
18450 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
18451 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
18453 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
18454 /// but with all dynamically-allocated buffers duplicated in new buffers.
18455 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
18457 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
18458 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
18459 /// A pointer to the contents in the success state.
18460 /// Reading from this pointer when `result_ok` is not set is undefined.
18461 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
18462 /// A pointer to the contents in the error state.
18463 /// Reading from this pointer when `result_ok` is set is undefined.
18464 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18467 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
18468 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
18469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18470 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
18471 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
18472 /// `err` or `result` depending on the state of `result_ok`.
18473 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
18474 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
18475 pub result_ok: bool,
18478 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
18479 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
18480 CResult_COption_HTLCDestinationZDecodeErrorZ {
18481 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
18482 result: Box::into_raw(Box::new(o)),
18488 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
18489 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
18490 CResult_COption_HTLCDestinationZDecodeErrorZ {
18491 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
18492 err: Box::into_raw(Box::new(e)),
18497 /// Checks if the given object is currently in the success state
18499 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
18503 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
18504 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
18505 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
18506 fn drop(&mut self) {
18507 if self.result_ok {
18508 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18509 let _ = unsafe { Box::from_raw(self.contents.result) };
18512 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18513 let _ = unsafe { Box::from_raw(self.contents.err) };
18518 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
18519 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
18520 let contents = if o.result_ok {
18521 let result = unsafe { o.contents.result };
18522 unsafe { o.contents.result = core::ptr::null_mut() };
18523 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
18525 let err = unsafe { o.contents.err };
18526 unsafe { o.contents.err = core::ptr::null_mut(); }
18527 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
18531 result_ok: o.result_ok,
18535 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
18536 fn clone(&self) -> Self {
18537 if self.result_ok {
18538 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
18539 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
18542 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
18543 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18549 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
18550 /// but with all dynamically-allocated buffers duplicated in new buffers.
18551 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
18553 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
18554 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
18555 /// A pointer to the contents in the success state.
18556 /// Reading from this pointer when `result_ok` is not set is undefined.
18557 pub result: *mut crate::lightning::events::PaymentFailureReason,
18558 /// A pointer to the contents in the error state.
18559 /// Reading from this pointer when `result_ok` is set is undefined.
18560 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18563 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
18564 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
18565 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18566 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
18567 /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
18568 /// `err` or `result` depending on the state of `result_ok`.
18569 pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
18570 /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
18571 pub result_ok: bool,
18574 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
18575 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
18576 CResult_PaymentFailureReasonDecodeErrorZ {
18577 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
18578 result: Box::into_raw(Box::new(o)),
18584 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
18585 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
18586 CResult_PaymentFailureReasonDecodeErrorZ {
18587 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
18588 err: Box::into_raw(Box::new(e)),
18593 /// Checks if the given object is currently in the success state
18595 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
18599 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
18600 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
18601 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
18602 fn drop(&mut self) {
18603 if self.result_ok {
18604 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18605 let _ = unsafe { Box::from_raw(self.contents.result) };
18608 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18609 let _ = unsafe { Box::from_raw(self.contents.err) };
18614 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
18615 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
18616 let contents = if o.result_ok {
18617 let result = unsafe { o.contents.result };
18618 unsafe { o.contents.result = core::ptr::null_mut() };
18619 CResult_PaymentFailureReasonDecodeErrorZPtr { result }
18621 let err = unsafe { o.contents.err };
18622 unsafe { o.contents.err = core::ptr::null_mut(); }
18623 CResult_PaymentFailureReasonDecodeErrorZPtr { err }
18627 result_ok: o.result_ok,
18631 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
18632 fn clone(&self) -> Self {
18633 if self.result_ok {
18634 Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
18635 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
18638 Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
18639 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18645 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
18646 /// but with all dynamically-allocated buffers duplicated in new buffers.
18647 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
18650 /// An enum which can either contain a crate::c_types::U128 or not
18651 pub enum COption_u128Z {
18652 /// When we're in this state, this COption_u128Z contains a crate::c_types::U128
18653 Some(crate::c_types::U128),
18654 /// When we're in this state, this COption_u128Z contains nothing
18657 impl COption_u128Z {
18658 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18659 if let Self::None = self { false } else { true }
18661 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18664 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
18665 if let Self::Some(v) = self { v } else { unreachable!() }
18669 /// Constructs a new COption_u128Z containing a crate::c_types::U128
18670 pub extern "C" fn COption_u128Z_some(o: crate::c_types::U128) -> COption_u128Z {
18671 COption_u128Z::Some(o)
18674 /// Constructs a new COption_u128Z containing nothing
18675 pub extern "C" fn COption_u128Z_none() -> COption_u128Z {
18676 COption_u128Z::None
18679 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
18680 pub extern "C" fn COption_u128Z_free(_res: COption_u128Z) { }
18682 /// Creates a new COption_u128Z which has the same data as `orig`
18683 /// but with all dynamically-allocated buffers duplicated in new buffers.
18684 pub extern "C" fn COption_u128Z_clone(orig: &COption_u128Z) -> COption_u128Z { Clone::clone(&orig) }
18687 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
18688 pub enum COption_PaymentIdZ {
18689 /// When we're in this state, this COption_PaymentIdZ contains a crate::c_types::ThirtyTwoBytes
18690 Some(crate::c_types::ThirtyTwoBytes),
18691 /// When we're in this state, this COption_PaymentIdZ contains nothing
18694 impl COption_PaymentIdZ {
18695 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18696 if let Self::None = self { false } else { true }
18698 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18701 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
18702 if let Self::Some(v) = self { v } else { unreachable!() }
18706 /// Constructs a new COption_PaymentIdZ containing a crate::c_types::ThirtyTwoBytes
18707 pub extern "C" fn COption_PaymentIdZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentIdZ {
18708 COption_PaymentIdZ::Some(o)
18711 /// Constructs a new COption_PaymentIdZ containing nothing
18712 pub extern "C" fn COption_PaymentIdZ_none() -> COption_PaymentIdZ {
18713 COption_PaymentIdZ::None
18716 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
18717 pub extern "C" fn COption_PaymentIdZ_free(_res: COption_PaymentIdZ) { }
18719 /// Creates a new COption_PaymentIdZ which has the same data as `orig`
18720 /// but with all dynamically-allocated buffers duplicated in new buffers.
18721 pub extern "C" fn COption_PaymentIdZ_clone(orig: &COption_PaymentIdZ) -> COption_PaymentIdZ { Clone::clone(&orig) }
18724 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
18725 pub enum COption_PaymentFailureReasonZ {
18726 /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
18727 Some(crate::lightning::events::PaymentFailureReason),
18728 /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
18731 impl COption_PaymentFailureReasonZ {
18732 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18733 if let Self::None = self { false } else { true }
18735 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18738 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
18739 if let Self::Some(v) = self { v } else { unreachable!() }
18743 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
18744 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
18745 COption_PaymentFailureReasonZ::Some(o)
18748 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
18749 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
18750 COption_PaymentFailureReasonZ::None
18753 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
18754 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
18756 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
18757 /// but with all dynamically-allocated buffers duplicated in new buffers.
18758 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
18761 /// An enum which can either contain a crate::lightning::events::Event or not
18762 pub enum COption_EventZ {
18763 /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
18764 Some(crate::lightning::events::Event),
18765 /// When we're in this state, this COption_EventZ contains nothing
18768 impl COption_EventZ {
18769 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18770 if let Self::None = self { false } else { true }
18772 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18775 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
18776 if let Self::Some(v) = self { v } else { unreachable!() }
18780 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
18781 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
18782 COption_EventZ::Some(o)
18785 /// Constructs a new COption_EventZ containing nothing
18786 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
18787 COption_EventZ::None
18790 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
18791 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
18793 /// Creates a new COption_EventZ which has the same data as `orig`
18794 /// but with all dynamically-allocated buffers duplicated in new buffers.
18795 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
18797 /// The contents of CResult_COption_EventZDecodeErrorZ
18798 pub union CResult_COption_EventZDecodeErrorZPtr {
18799 /// A pointer to the contents in the success state.
18800 /// Reading from this pointer when `result_ok` is not set is undefined.
18801 pub result: *mut crate::c_types::derived::COption_EventZ,
18802 /// A pointer to the contents in the error state.
18803 /// Reading from this pointer when `result_ok` is set is undefined.
18804 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18807 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
18808 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
18809 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18810 pub struct CResult_COption_EventZDecodeErrorZ {
18811 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
18812 /// `err` or `result` depending on the state of `result_ok`.
18813 pub contents: CResult_COption_EventZDecodeErrorZPtr,
18814 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
18815 pub result_ok: bool,
18818 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
18819 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
18820 CResult_COption_EventZDecodeErrorZ {
18821 contents: CResult_COption_EventZDecodeErrorZPtr {
18822 result: Box::into_raw(Box::new(o)),
18828 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
18829 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
18830 CResult_COption_EventZDecodeErrorZ {
18831 contents: CResult_COption_EventZDecodeErrorZPtr {
18832 err: Box::into_raw(Box::new(e)),
18837 /// Checks if the given object is currently in the success state
18839 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
18843 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
18844 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
18845 impl Drop for CResult_COption_EventZDecodeErrorZ {
18846 fn drop(&mut self) {
18847 if self.result_ok {
18848 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18849 let _ = unsafe { Box::from_raw(self.contents.result) };
18852 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18853 let _ = unsafe { Box::from_raw(self.contents.err) };
18858 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
18859 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
18860 let contents = if o.result_ok {
18861 let result = unsafe { o.contents.result };
18862 unsafe { o.contents.result = core::ptr::null_mut() };
18863 CResult_COption_EventZDecodeErrorZPtr { result }
18865 let err = unsafe { o.contents.err };
18866 unsafe { o.contents.err = core::ptr::null_mut(); }
18867 CResult_COption_EventZDecodeErrorZPtr { err }
18871 result_ok: o.result_ok,
18875 impl Clone for CResult_COption_EventZDecodeErrorZ {
18876 fn clone(&self) -> Self {
18877 if self.result_ok {
18878 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
18879 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
18882 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
18883 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18889 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
18890 /// but with all dynamically-allocated buffers duplicated in new buffers.
18891 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
18893 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
18894 /// This corresponds to std::vector in C++
18895 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
18896 /// The elements in the array.
18897 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18898 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
18899 /// The number of elements pointed to by `data`.
18902 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
18903 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
18904 if self.datalen == 0 { return Vec::new(); }
18905 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18906 self.data = core::ptr::null_mut();
18910 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
18911 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18914 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
18915 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
18916 let datalen = v.len();
18917 let data = Box::into_raw(v.into_boxed_slice());
18918 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18922 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18923 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
18924 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
18925 fn drop(&mut self) {
18926 if self.datalen == 0 { return; }
18927 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18931 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
18932 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
18933 /// A pointer to the contents in the success state.
18934 /// Reading from this pointer when `result_ok` is not set is undefined.
18935 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
18936 /// A pointer to the contents in the error state.
18937 /// Reading from this pointer when `result_ok` is set is undefined.
18938 pub err: *mut crate::c_types::IOError,
18941 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
18942 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
18943 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18944 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18945 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
18946 /// `err` or `result` depending on the state of `result_ok`.
18947 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
18948 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
18949 pub result_ok: bool,
18952 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
18953 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18954 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18955 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
18956 result: Box::into_raw(Box::new(o)),
18962 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
18963 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18964 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18965 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
18966 err: Box::into_raw(Box::new(e)),
18971 /// Checks if the given object is currently in the success state
18973 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
18977 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
18978 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
18979 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18980 fn drop(&mut self) {
18981 if self.result_ok {
18982 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18983 let _ = unsafe { Box::from_raw(self.contents.result) };
18986 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18987 let _ = unsafe { Box::from_raw(self.contents.err) };
18992 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
18993 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
18994 let contents = if o.result_ok {
18995 let result = unsafe { o.contents.result };
18996 unsafe { o.contents.result = core::ptr::null_mut() };
18997 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
18999 let err = unsafe { o.contents.err };
19000 unsafe { o.contents.err = core::ptr::null_mut(); }
19001 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
19005 result_ok: o.result_ok,
19010 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
19011 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
19012 /// A pointer to the contents in the success state.
19013 /// Reading from this pointer when `result_ok` is not set is undefined.
19014 pub result: *mut crate::lightning_invoice::SiPrefix,
19015 /// A pointer to the contents in the error state.
19016 /// Reading from this pointer when `result_ok` is set is undefined.
19017 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
19020 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
19021 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
19022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19023 pub struct CResult_SiPrefixBolt11ParseErrorZ {
19024 /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
19025 /// `err` or `result` depending on the state of `result_ok`.
19026 pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
19027 /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
19028 pub result_ok: bool,
19031 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
19032 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
19033 CResult_SiPrefixBolt11ParseErrorZ {
19034 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
19035 result: Box::into_raw(Box::new(o)),
19041 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
19042 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
19043 CResult_SiPrefixBolt11ParseErrorZ {
19044 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
19045 err: Box::into_raw(Box::new(e)),
19050 /// Checks if the given object is currently in the success state
19052 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
19056 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
19057 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
19058 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
19059 fn drop(&mut self) {
19060 if self.result_ok {
19061 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19062 let _ = unsafe { Box::from_raw(self.contents.result) };
19065 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19066 let _ = unsafe { Box::from_raw(self.contents.err) };
19071 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
19072 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
19073 let contents = if o.result_ok {
19074 let result = unsafe { o.contents.result };
19075 unsafe { o.contents.result = core::ptr::null_mut() };
19076 CResult_SiPrefixBolt11ParseErrorZPtr { result }
19078 let err = unsafe { o.contents.err };
19079 unsafe { o.contents.err = core::ptr::null_mut(); }
19080 CResult_SiPrefixBolt11ParseErrorZPtr { err }
19084 result_ok: o.result_ok,
19088 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
19089 fn clone(&self) -> Self {
19090 if self.result_ok {
19091 Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
19092 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
19095 Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
19096 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
19102 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
19103 /// but with all dynamically-allocated buffers duplicated in new buffers.
19104 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
19106 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
19107 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
19108 /// A pointer to the contents in the success state.
19109 /// Reading from this pointer when `result_ok` is not set is undefined.
19110 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
19111 /// A pointer to the contents in the error state.
19112 /// Reading from this pointer when `result_ok` is set is undefined.
19113 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
19116 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
19117 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
19118 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19119 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19120 /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
19121 /// `err` or `result` depending on the state of `result_ok`.
19122 pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
19123 /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
19124 pub result_ok: bool,
19127 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
19128 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19129 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19130 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
19131 result: Box::into_raw(Box::new(o)),
19137 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
19138 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19139 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19140 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
19141 err: Box::into_raw(Box::new(e)),
19146 /// Checks if the given object is currently in the success state
19148 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
19152 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
19153 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
19154 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19155 fn drop(&mut self) {
19156 if self.result_ok {
19157 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19158 let _ = unsafe { Box::from_raw(self.contents.result) };
19161 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19162 let _ = unsafe { Box::from_raw(self.contents.err) };
19167 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19168 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
19169 let contents = if o.result_ok {
19170 let result = unsafe { o.contents.result };
19171 unsafe { o.contents.result = core::ptr::null_mut() };
19172 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
19174 let err = unsafe { o.contents.err };
19175 unsafe { o.contents.err = core::ptr::null_mut(); }
19176 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
19180 result_ok: o.result_ok,
19184 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
19185 fn clone(&self) -> Self {
19186 if self.result_ok {
19187 Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
19188 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
19191 Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
19192 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
19198 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
19199 /// but with all dynamically-allocated buffers duplicated in new buffers.
19200 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
19202 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
19203 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
19204 /// A pointer to the contents in the success state.
19205 /// Reading from this pointer when `result_ok` is not set is undefined.
19206 pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
19207 /// A pointer to the contents in the error state.
19208 /// Reading from this pointer when `result_ok` is set is undefined.
19209 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
19212 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
19213 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
19214 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19215 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19216 /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
19217 /// `err` or `result` depending on the state of `result_ok`.
19218 pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
19219 /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
19220 pub result_ok: bool,
19223 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
19224 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19225 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19226 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
19227 result: Box::into_raw(Box::new(o)),
19233 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
19234 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19235 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19236 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
19237 err: Box::into_raw(Box::new(e)),
19242 /// Checks if the given object is currently in the success state
19244 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
19248 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
19249 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
19250 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19251 fn drop(&mut self) {
19252 if self.result_ok {
19253 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19254 let _ = unsafe { Box::from_raw(self.contents.result) };
19257 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19258 let _ = unsafe { Box::from_raw(self.contents.err) };
19263 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19264 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
19265 let contents = if o.result_ok {
19266 let result = unsafe { o.contents.result };
19267 unsafe { o.contents.result = core::ptr::null_mut() };
19268 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
19270 let err = unsafe { o.contents.err };
19271 unsafe { o.contents.err = core::ptr::null_mut(); }
19272 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
19276 result_ok: o.result_ok,
19280 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19281 fn clone(&self) -> Self {
19282 if self.result_ok {
19283 Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
19284 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
19287 Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
19288 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
19294 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
19295 /// but with all dynamically-allocated buffers duplicated in new buffers.
19296 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
19298 /// A tuple of 3 elements. See the individual fields for the types contained.
19299 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
19300 /// The element at position 0
19301 pub a: crate::lightning_invoice::RawBolt11Invoice,
19302 /// The element at position 1
19303 pub b: crate::c_types::ThirtyTwoBytes,
19304 /// The element at position 2
19305 pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
19307 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
19308 fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
19316 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
19317 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
19318 (self.a, self.b, self.c)
19321 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
19322 fn clone(&self) -> Self {
19324 a: Clone::clone(&self.a),
19325 b: Clone::clone(&self.b),
19326 c: Clone::clone(&self.c),
19331 /// Creates a new tuple which has the same data as `orig`
19332 /// but with all dynamically-allocated buffers duplicated in new buffers.
19333 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
19334 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
19336 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 {
19337 C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
19341 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
19342 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
19344 /// The contents of CResult_PayeePubKeyErrorZ
19345 pub union CResult_PayeePubKeyErrorZPtr {
19346 /// A pointer to the contents in the success state.
19347 /// Reading from this pointer when `result_ok` is not set is undefined.
19348 pub result: *mut crate::lightning_invoice::PayeePubKey,
19349 /// A pointer to the contents in the error state.
19350 /// Reading from this pointer when `result_ok` is set is undefined.
19351 pub err: *mut crate::c_types::Secp256k1Error,
19354 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
19355 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
19356 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19357 pub struct CResult_PayeePubKeyErrorZ {
19358 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
19359 /// `err` or `result` depending on the state of `result_ok`.
19360 pub contents: CResult_PayeePubKeyErrorZPtr,
19361 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
19362 pub result_ok: bool,
19365 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
19366 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
19367 CResult_PayeePubKeyErrorZ {
19368 contents: CResult_PayeePubKeyErrorZPtr {
19369 result: Box::into_raw(Box::new(o)),
19375 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
19376 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
19377 CResult_PayeePubKeyErrorZ {
19378 contents: CResult_PayeePubKeyErrorZPtr {
19379 err: Box::into_raw(Box::new(e)),
19384 /// Checks if the given object is currently in the success state
19386 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
19390 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
19391 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
19392 impl Drop for CResult_PayeePubKeyErrorZ {
19393 fn drop(&mut self) {
19394 if self.result_ok {
19395 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19396 let _ = unsafe { Box::from_raw(self.contents.result) };
19399 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19400 let _ = unsafe { Box::from_raw(self.contents.err) };
19405 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
19406 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
19407 let contents = if o.result_ok {
19408 let result = unsafe { o.contents.result };
19409 unsafe { o.contents.result = core::ptr::null_mut() };
19410 CResult_PayeePubKeyErrorZPtr { result }
19412 let err = unsafe { o.contents.err };
19413 unsafe { o.contents.err = core::ptr::null_mut(); }
19414 CResult_PayeePubKeyErrorZPtr { err }
19418 result_ok: o.result_ok,
19422 impl Clone for CResult_PayeePubKeyErrorZ {
19423 fn clone(&self) -> Self {
19424 if self.result_ok {
19425 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
19426 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
19429 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
19430 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
19436 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
19437 /// but with all dynamically-allocated buffers duplicated in new buffers.
19438 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
19440 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
19441 /// This corresponds to std::vector in C++
19442 pub struct CVec_PrivateRouteZ {
19443 /// The elements in the array.
19444 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
19445 pub data: *mut crate::lightning_invoice::PrivateRoute,
19446 /// The number of elements pointed to by `data`.
19449 impl CVec_PrivateRouteZ {
19450 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
19451 if self.datalen == 0 { return Vec::new(); }
19452 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
19453 self.data = core::ptr::null_mut();
19457 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
19458 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
19461 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
19462 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
19463 let datalen = v.len();
19464 let data = Box::into_raw(v.into_boxed_slice());
19465 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
19469 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
19470 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
19471 impl Drop for CVec_PrivateRouteZ {
19472 fn drop(&mut self) {
19473 if self.datalen == 0 { return; }
19474 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
19477 impl Clone for CVec_PrivateRouteZ {
19478 fn clone(&self) -> Self {
19479 let mut res = Vec::new();
19480 if self.datalen == 0 { return Self::from(res); }
19481 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
19486 /// The contents of CResult_PositiveTimestampCreationErrorZ
19487 pub union CResult_PositiveTimestampCreationErrorZPtr {
19488 /// A pointer to the contents in the success state.
19489 /// Reading from this pointer when `result_ok` is not set is undefined.
19490 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
19491 /// A pointer to the contents in the error state.
19492 /// Reading from this pointer when `result_ok` is set is undefined.
19493 pub err: *mut crate::lightning_invoice::CreationError,
19496 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
19497 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
19498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19499 pub struct CResult_PositiveTimestampCreationErrorZ {
19500 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
19501 /// `err` or `result` depending on the state of `result_ok`.
19502 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
19503 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
19504 pub result_ok: bool,
19507 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
19508 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
19509 CResult_PositiveTimestampCreationErrorZ {
19510 contents: CResult_PositiveTimestampCreationErrorZPtr {
19511 result: Box::into_raw(Box::new(o)),
19517 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
19518 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
19519 CResult_PositiveTimestampCreationErrorZ {
19520 contents: CResult_PositiveTimestampCreationErrorZPtr {
19521 err: Box::into_raw(Box::new(e)),
19526 /// Checks if the given object is currently in the success state
19528 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
19532 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
19533 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
19534 impl Drop for CResult_PositiveTimestampCreationErrorZ {
19535 fn drop(&mut self) {
19536 if self.result_ok {
19537 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19538 let _ = unsafe { Box::from_raw(self.contents.result) };
19541 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19542 let _ = unsafe { Box::from_raw(self.contents.err) };
19547 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
19548 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
19549 let contents = if o.result_ok {
19550 let result = unsafe { o.contents.result };
19551 unsafe { o.contents.result = core::ptr::null_mut() };
19552 CResult_PositiveTimestampCreationErrorZPtr { result }
19554 let err = unsafe { o.contents.err };
19555 unsafe { o.contents.err = core::ptr::null_mut(); }
19556 CResult_PositiveTimestampCreationErrorZPtr { err }
19560 result_ok: o.result_ok,
19564 impl Clone for CResult_PositiveTimestampCreationErrorZ {
19565 fn clone(&self) -> Self {
19566 if self.result_ok {
19567 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
19568 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
19571 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
19572 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
19578 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
19579 /// but with all dynamically-allocated buffers duplicated in new buffers.
19580 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
19582 /// The contents of CResult_NoneBolt11SemanticErrorZ
19583 pub union CResult_NoneBolt11SemanticErrorZPtr {
19584 /// Note that this value is always NULL, as there are no contents in the OK variant
19585 pub result: *mut core::ffi::c_void,
19586 /// A pointer to the contents in the error state.
19587 /// Reading from this pointer when `result_ok` is set is undefined.
19588 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
19591 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
19592 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
19593 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19594 pub struct CResult_NoneBolt11SemanticErrorZ {
19595 /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
19596 /// `err` or `result` depending on the state of `result_ok`.
19597 pub contents: CResult_NoneBolt11SemanticErrorZPtr,
19598 /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
19599 pub result_ok: bool,
19602 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
19603 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
19604 CResult_NoneBolt11SemanticErrorZ {
19605 contents: CResult_NoneBolt11SemanticErrorZPtr {
19606 result: core::ptr::null_mut(),
19612 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
19613 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
19614 CResult_NoneBolt11SemanticErrorZ {
19615 contents: CResult_NoneBolt11SemanticErrorZPtr {
19616 err: Box::into_raw(Box::new(e)),
19621 /// Checks if the given object is currently in the success state
19623 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
19627 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
19628 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
19629 impl Drop for CResult_NoneBolt11SemanticErrorZ {
19630 fn drop(&mut self) {
19631 if self.result_ok {
19633 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19634 let _ = unsafe { Box::from_raw(self.contents.err) };
19639 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
19640 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
19641 let contents = if o.result_ok {
19642 let _ = unsafe { Box::from_raw(o.contents.result) };
19643 o.contents.result = core::ptr::null_mut();
19644 CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
19646 let err = unsafe { o.contents.err };
19647 unsafe { o.contents.err = core::ptr::null_mut(); }
19648 CResult_NoneBolt11SemanticErrorZPtr { err }
19652 result_ok: o.result_ok,
19656 impl Clone for CResult_NoneBolt11SemanticErrorZ {
19657 fn clone(&self) -> Self {
19658 if self.result_ok {
19659 Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
19660 result: core::ptr::null_mut()
19663 Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
19664 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
19670 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
19671 /// but with all dynamically-allocated buffers duplicated in new buffers.
19672 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
19674 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
19675 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
19676 /// A pointer to the contents in the success state.
19677 /// Reading from this pointer when `result_ok` is not set is undefined.
19678 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
19679 /// A pointer to the contents in the error state.
19680 /// Reading from this pointer when `result_ok` is set is undefined.
19681 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
19684 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
19685 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
19686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19687 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19688 /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
19689 /// `err` or `result` depending on the state of `result_ok`.
19690 pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
19691 /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
19692 pub result_ok: bool,
19695 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
19696 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19697 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19698 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
19699 result: Box::into_raw(Box::new(o)),
19705 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
19706 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19707 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19708 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
19709 err: Box::into_raw(Box::new(e)),
19714 /// Checks if the given object is currently in the success state
19716 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
19720 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
19721 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
19722 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19723 fn drop(&mut self) {
19724 if self.result_ok {
19725 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19726 let _ = unsafe { Box::from_raw(self.contents.result) };
19729 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19730 let _ = unsafe { Box::from_raw(self.contents.err) };
19735 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19736 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
19737 let contents = if o.result_ok {
19738 let result = unsafe { o.contents.result };
19739 unsafe { o.contents.result = core::ptr::null_mut() };
19740 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
19742 let err = unsafe { o.contents.err };
19743 unsafe { o.contents.err = core::ptr::null_mut(); }
19744 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
19748 result_ok: o.result_ok,
19752 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
19753 fn clone(&self) -> Self {
19754 if self.result_ok {
19755 Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
19756 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
19759 Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
19760 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
19766 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
19767 /// but with all dynamically-allocated buffers duplicated in new buffers.
19768 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
19770 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
19771 /// This corresponds to std::vector in C++
19772 pub struct CVec_AddressZ {
19773 /// The elements in the array.
19774 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
19775 pub data: *mut crate::c_types::Str,
19776 /// The number of elements pointed to by `data`.
19779 impl CVec_AddressZ {
19780 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
19781 if self.datalen == 0 { return Vec::new(); }
19782 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
19783 self.data = core::ptr::null_mut();
19787 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
19788 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
19791 impl From<Vec<crate::c_types::Str>> for CVec_AddressZ {
19792 fn from(v: Vec<crate::c_types::Str>) -> Self {
19793 let datalen = v.len();
19794 let data = Box::into_raw(v.into_boxed_slice());
19795 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
19799 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
19800 pub extern "C" fn CVec_AddressZ_free(_res: CVec_AddressZ) { }
19801 impl Drop for CVec_AddressZ {
19802 fn drop(&mut self) {
19803 if self.datalen == 0 { return; }
19804 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
19807 impl Clone for CVec_AddressZ {
19808 fn clone(&self) -> Self {
19809 let mut res = Vec::new();
19810 if self.datalen == 0 { return Self::from(res); }
19811 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
19816 /// The contents of CResult_DescriptionCreationErrorZ
19817 pub union CResult_DescriptionCreationErrorZPtr {
19818 /// A pointer to the contents in the success state.
19819 /// Reading from this pointer when `result_ok` is not set is undefined.
19820 pub result: *mut crate::lightning_invoice::Description,
19821 /// A pointer to the contents in the error state.
19822 /// Reading from this pointer when `result_ok` is set is undefined.
19823 pub err: *mut crate::lightning_invoice::CreationError,
19826 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
19827 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
19828 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19829 pub struct CResult_DescriptionCreationErrorZ {
19830 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
19831 /// `err` or `result` depending on the state of `result_ok`.
19832 pub contents: CResult_DescriptionCreationErrorZPtr,
19833 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
19834 pub result_ok: bool,
19837 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
19838 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
19839 CResult_DescriptionCreationErrorZ {
19840 contents: CResult_DescriptionCreationErrorZPtr {
19841 result: Box::into_raw(Box::new(o)),
19847 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
19848 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
19849 CResult_DescriptionCreationErrorZ {
19850 contents: CResult_DescriptionCreationErrorZPtr {
19851 err: Box::into_raw(Box::new(e)),
19856 /// Checks if the given object is currently in the success state
19858 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
19862 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
19863 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
19864 impl Drop for CResult_DescriptionCreationErrorZ {
19865 fn drop(&mut self) {
19866 if self.result_ok {
19867 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19868 let _ = unsafe { Box::from_raw(self.contents.result) };
19871 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19872 let _ = unsafe { Box::from_raw(self.contents.err) };
19877 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
19878 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
19879 let contents = if o.result_ok {
19880 let result = unsafe { o.contents.result };
19881 unsafe { o.contents.result = core::ptr::null_mut() };
19882 CResult_DescriptionCreationErrorZPtr { result }
19884 let err = unsafe { o.contents.err };
19885 unsafe { o.contents.err = core::ptr::null_mut(); }
19886 CResult_DescriptionCreationErrorZPtr { err }
19890 result_ok: o.result_ok,
19894 impl Clone for CResult_DescriptionCreationErrorZ {
19895 fn clone(&self) -> Self {
19896 if self.result_ok {
19897 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
19898 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
19901 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
19902 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
19908 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
19909 /// but with all dynamically-allocated buffers duplicated in new buffers.
19910 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
19912 /// The contents of CResult_PrivateRouteCreationErrorZ
19913 pub union CResult_PrivateRouteCreationErrorZPtr {
19914 /// A pointer to the contents in the success state.
19915 /// Reading from this pointer when `result_ok` is not set is undefined.
19916 pub result: *mut crate::lightning_invoice::PrivateRoute,
19917 /// A pointer to the contents in the error state.
19918 /// Reading from this pointer when `result_ok` is set is undefined.
19919 pub err: *mut crate::lightning_invoice::CreationError,
19922 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
19923 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
19924 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19925 pub struct CResult_PrivateRouteCreationErrorZ {
19926 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
19927 /// `err` or `result` depending on the state of `result_ok`.
19928 pub contents: CResult_PrivateRouteCreationErrorZPtr,
19929 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
19930 pub result_ok: bool,
19933 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
19934 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
19935 CResult_PrivateRouteCreationErrorZ {
19936 contents: CResult_PrivateRouteCreationErrorZPtr {
19937 result: Box::into_raw(Box::new(o)),
19943 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
19944 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
19945 CResult_PrivateRouteCreationErrorZ {
19946 contents: CResult_PrivateRouteCreationErrorZPtr {
19947 err: Box::into_raw(Box::new(e)),
19952 /// Checks if the given object is currently in the success state
19954 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
19958 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
19959 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
19960 impl Drop for CResult_PrivateRouteCreationErrorZ {
19961 fn drop(&mut self) {
19962 if self.result_ok {
19963 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19964 let _ = unsafe { Box::from_raw(self.contents.result) };
19967 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19968 let _ = unsafe { Box::from_raw(self.contents.err) };
19973 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
19974 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
19975 let contents = if o.result_ok {
19976 let result = unsafe { o.contents.result };
19977 unsafe { o.contents.result = core::ptr::null_mut() };
19978 CResult_PrivateRouteCreationErrorZPtr { result }
19980 let err = unsafe { o.contents.err };
19981 unsafe { o.contents.err = core::ptr::null_mut(); }
19982 CResult_PrivateRouteCreationErrorZPtr { err }
19986 result_ok: o.result_ok,
19990 impl Clone for CResult_PrivateRouteCreationErrorZ {
19991 fn clone(&self) -> Self {
19992 if self.result_ok {
19993 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
19994 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
19997 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
19998 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
20004 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
20005 /// but with all dynamically-allocated buffers duplicated in new buffers.
20006 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
20008 /// The contents of CResult_OutPointDecodeErrorZ
20009 pub union CResult_OutPointDecodeErrorZPtr {
20010 /// A pointer to the contents in the success state.
20011 /// Reading from this pointer when `result_ok` is not set is undefined.
20012 pub result: *mut crate::lightning::chain::transaction::OutPoint,
20013 /// A pointer to the contents in the error state.
20014 /// Reading from this pointer when `result_ok` is set is undefined.
20015 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20018 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
20019 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
20020 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20021 pub struct CResult_OutPointDecodeErrorZ {
20022 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
20023 /// `err` or `result` depending on the state of `result_ok`.
20024 pub contents: CResult_OutPointDecodeErrorZPtr,
20025 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
20026 pub result_ok: bool,
20029 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
20030 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
20031 CResult_OutPointDecodeErrorZ {
20032 contents: CResult_OutPointDecodeErrorZPtr {
20033 result: Box::into_raw(Box::new(o)),
20039 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
20040 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
20041 CResult_OutPointDecodeErrorZ {
20042 contents: CResult_OutPointDecodeErrorZPtr {
20043 err: Box::into_raw(Box::new(e)),
20048 /// Checks if the given object is currently in the success state
20050 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
20054 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
20055 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
20056 impl Drop for CResult_OutPointDecodeErrorZ {
20057 fn drop(&mut self) {
20058 if self.result_ok {
20059 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20060 let _ = unsafe { Box::from_raw(self.contents.result) };
20063 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20064 let _ = unsafe { Box::from_raw(self.contents.err) };
20069 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
20070 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
20071 let contents = if o.result_ok {
20072 let result = unsafe { o.contents.result };
20073 unsafe { o.contents.result = core::ptr::null_mut() };
20074 CResult_OutPointDecodeErrorZPtr { result }
20076 let err = unsafe { o.contents.err };
20077 unsafe { o.contents.err = core::ptr::null_mut(); }
20078 CResult_OutPointDecodeErrorZPtr { err }
20082 result_ok: o.result_ok,
20086 impl Clone for CResult_OutPointDecodeErrorZ {
20087 fn clone(&self) -> Self {
20088 if self.result_ok {
20089 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
20090 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
20093 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
20094 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20100 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
20101 /// but with all dynamically-allocated buffers duplicated in new buffers.
20102 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
20104 /// The contents of CResult_BigSizeDecodeErrorZ
20105 pub union CResult_BigSizeDecodeErrorZPtr {
20106 /// A pointer to the contents in the success state.
20107 /// Reading from this pointer when `result_ok` is not set is undefined.
20108 pub result: *mut crate::lightning::util::ser::BigSize,
20109 /// A pointer to the contents in the error state.
20110 /// Reading from this pointer when `result_ok` is set is undefined.
20111 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20114 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
20115 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
20116 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20117 pub struct CResult_BigSizeDecodeErrorZ {
20118 /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
20119 /// `err` or `result` depending on the state of `result_ok`.
20120 pub contents: CResult_BigSizeDecodeErrorZPtr,
20121 /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
20122 pub result_ok: bool,
20125 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
20126 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
20127 CResult_BigSizeDecodeErrorZ {
20128 contents: CResult_BigSizeDecodeErrorZPtr {
20129 result: Box::into_raw(Box::new(o)),
20135 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
20136 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
20137 CResult_BigSizeDecodeErrorZ {
20138 contents: CResult_BigSizeDecodeErrorZPtr {
20139 err: Box::into_raw(Box::new(e)),
20144 /// Checks if the given object is currently in the success state
20146 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
20150 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
20151 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
20152 impl Drop for CResult_BigSizeDecodeErrorZ {
20153 fn drop(&mut self) {
20154 if self.result_ok {
20155 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20156 let _ = unsafe { Box::from_raw(self.contents.result) };
20159 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20160 let _ = unsafe { Box::from_raw(self.contents.err) };
20165 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
20166 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
20167 let contents = if o.result_ok {
20168 let result = unsafe { o.contents.result };
20169 unsafe { o.contents.result = core::ptr::null_mut() };
20170 CResult_BigSizeDecodeErrorZPtr { result }
20172 let err = unsafe { o.contents.err };
20173 unsafe { o.contents.err = core::ptr::null_mut(); }
20174 CResult_BigSizeDecodeErrorZPtr { err }
20178 result_ok: o.result_ok,
20182 impl Clone for CResult_BigSizeDecodeErrorZ {
20183 fn clone(&self) -> Self {
20184 if self.result_ok {
20185 Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
20186 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
20189 Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
20190 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20196 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
20197 /// but with all dynamically-allocated buffers duplicated in new buffers.
20198 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
20200 /// The contents of CResult_HostnameDecodeErrorZ
20201 pub union CResult_HostnameDecodeErrorZPtr {
20202 /// A pointer to the contents in the success state.
20203 /// Reading from this pointer when `result_ok` is not set is undefined.
20204 pub result: *mut crate::lightning::util::ser::Hostname,
20205 /// A pointer to the contents in the error state.
20206 /// Reading from this pointer when `result_ok` is set is undefined.
20207 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20210 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
20211 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
20212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20213 pub struct CResult_HostnameDecodeErrorZ {
20214 /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
20215 /// `err` or `result` depending on the state of `result_ok`.
20216 pub contents: CResult_HostnameDecodeErrorZPtr,
20217 /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
20218 pub result_ok: bool,
20221 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
20222 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
20223 CResult_HostnameDecodeErrorZ {
20224 contents: CResult_HostnameDecodeErrorZPtr {
20225 result: Box::into_raw(Box::new(o)),
20231 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
20232 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
20233 CResult_HostnameDecodeErrorZ {
20234 contents: CResult_HostnameDecodeErrorZPtr {
20235 err: Box::into_raw(Box::new(e)),
20240 /// Checks if the given object is currently in the success state
20242 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
20246 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
20247 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
20248 impl Drop for CResult_HostnameDecodeErrorZ {
20249 fn drop(&mut self) {
20250 if self.result_ok {
20251 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20252 let _ = unsafe { Box::from_raw(self.contents.result) };
20255 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20256 let _ = unsafe { Box::from_raw(self.contents.err) };
20261 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
20262 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
20263 let contents = if o.result_ok {
20264 let result = unsafe { o.contents.result };
20265 unsafe { o.contents.result = core::ptr::null_mut() };
20266 CResult_HostnameDecodeErrorZPtr { result }
20268 let err = unsafe { o.contents.err };
20269 unsafe { o.contents.err = core::ptr::null_mut(); }
20270 CResult_HostnameDecodeErrorZPtr { err }
20274 result_ok: o.result_ok,
20278 impl Clone for CResult_HostnameDecodeErrorZ {
20279 fn clone(&self) -> Self {
20280 if self.result_ok {
20281 Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
20282 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
20285 Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
20286 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20292 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
20293 /// but with all dynamically-allocated buffers duplicated in new buffers.
20294 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
20296 /// The contents of CResult_TransactionU16LenLimitedNoneZ
20297 pub union CResult_TransactionU16LenLimitedNoneZPtr {
20298 /// A pointer to the contents in the success state.
20299 /// Reading from this pointer when `result_ok` is not set is undefined.
20300 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
20301 /// Note that this value is always NULL, as there are no contents in the Err variant
20302 pub err: *mut core::ffi::c_void,
20305 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
20306 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
20307 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20308 pub struct CResult_TransactionU16LenLimitedNoneZ {
20309 /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
20310 /// `err` or `result` depending on the state of `result_ok`.
20311 pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
20312 /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
20313 pub result_ok: bool,
20316 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
20317 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
20318 CResult_TransactionU16LenLimitedNoneZ {
20319 contents: CResult_TransactionU16LenLimitedNoneZPtr {
20320 result: Box::into_raw(Box::new(o)),
20326 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
20327 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
20328 CResult_TransactionU16LenLimitedNoneZ {
20329 contents: CResult_TransactionU16LenLimitedNoneZPtr {
20330 err: core::ptr::null_mut(),
20335 /// Checks if the given object is currently in the success state
20337 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
20341 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
20342 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
20343 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
20344 fn drop(&mut self) {
20345 if self.result_ok {
20346 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20347 let _ = unsafe { Box::from_raw(self.contents.result) };
20353 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
20354 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
20355 let contents = if o.result_ok {
20356 let result = unsafe { o.contents.result };
20357 unsafe { o.contents.result = core::ptr::null_mut() };
20358 CResult_TransactionU16LenLimitedNoneZPtr { result }
20360 let _ = unsafe { Box::from_raw(o.contents.err) };
20361 o.contents.err = core::ptr::null_mut();
20362 CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
20366 result_ok: o.result_ok,
20370 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
20371 fn clone(&self) -> Self {
20372 if self.result_ok {
20373 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
20374 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
20377 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
20378 err: core::ptr::null_mut()
20384 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
20385 /// but with all dynamically-allocated buffers duplicated in new buffers.
20386 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
20388 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
20389 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
20390 /// A pointer to the contents in the success state.
20391 /// Reading from this pointer when `result_ok` is not set is undefined.
20392 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
20393 /// A pointer to the contents in the error state.
20394 /// Reading from this pointer when `result_ok` is set is undefined.
20395 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20398 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
20399 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
20400 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20401 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
20402 /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
20403 /// `err` or `result` depending on the state of `result_ok`.
20404 pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
20405 /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
20406 pub result_ok: bool,
20409 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
20410 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
20411 CResult_TransactionU16LenLimitedDecodeErrorZ {
20412 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
20413 result: Box::into_raw(Box::new(o)),
20419 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
20420 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
20421 CResult_TransactionU16LenLimitedDecodeErrorZ {
20422 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
20423 err: Box::into_raw(Box::new(e)),
20428 /// Checks if the given object is currently in the success state
20430 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
20434 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
20435 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
20436 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
20437 fn drop(&mut self) {
20438 if self.result_ok {
20439 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20440 let _ = unsafe { Box::from_raw(self.contents.result) };
20443 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20444 let _ = unsafe { Box::from_raw(self.contents.err) };
20449 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
20450 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
20451 let contents = if o.result_ok {
20452 let result = unsafe { o.contents.result };
20453 unsafe { o.contents.result = core::ptr::null_mut() };
20454 CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
20456 let err = unsafe { o.contents.err };
20457 unsafe { o.contents.err = core::ptr::null_mut(); }
20458 CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
20462 result_ok: o.result_ok,
20466 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
20467 fn clone(&self) -> Self {
20468 if self.result_ok {
20469 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
20470 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
20473 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
20474 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20480 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
20481 /// but with all dynamically-allocated buffers duplicated in new buffers.
20482 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
20484 /// The contents of CResult_UntrustedStringDecodeErrorZ
20485 pub union CResult_UntrustedStringDecodeErrorZPtr {
20486 /// A pointer to the contents in the success state.
20487 /// Reading from this pointer when `result_ok` is not set is undefined.
20488 pub result: *mut crate::lightning::util::string::UntrustedString,
20489 /// A pointer to the contents in the error state.
20490 /// Reading from this pointer when `result_ok` is set is undefined.
20491 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20494 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
20495 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
20496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20497 pub struct CResult_UntrustedStringDecodeErrorZ {
20498 /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
20499 /// `err` or `result` depending on the state of `result_ok`.
20500 pub contents: CResult_UntrustedStringDecodeErrorZPtr,
20501 /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
20502 pub result_ok: bool,
20505 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
20506 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
20507 CResult_UntrustedStringDecodeErrorZ {
20508 contents: CResult_UntrustedStringDecodeErrorZPtr {
20509 result: Box::into_raw(Box::new(o)),
20515 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
20516 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
20517 CResult_UntrustedStringDecodeErrorZ {
20518 contents: CResult_UntrustedStringDecodeErrorZPtr {
20519 err: Box::into_raw(Box::new(e)),
20524 /// Checks if the given object is currently in the success state
20526 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
20530 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
20531 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
20532 impl Drop for CResult_UntrustedStringDecodeErrorZ {
20533 fn drop(&mut self) {
20534 if self.result_ok {
20535 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20536 let _ = unsafe { Box::from_raw(self.contents.result) };
20539 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20540 let _ = unsafe { Box::from_raw(self.contents.err) };
20545 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
20546 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
20547 let contents = if o.result_ok {
20548 let result = unsafe { o.contents.result };
20549 unsafe { o.contents.result = core::ptr::null_mut() };
20550 CResult_UntrustedStringDecodeErrorZPtr { result }
20552 let err = unsafe { o.contents.err };
20553 unsafe { o.contents.err = core::ptr::null_mut(); }
20554 CResult_UntrustedStringDecodeErrorZPtr { err }
20558 result_ok: o.result_ok,
20562 impl Clone for CResult_UntrustedStringDecodeErrorZ {
20563 fn clone(&self) -> Self {
20564 if self.result_ok {
20565 Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
20566 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
20569 Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
20570 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20576 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
20577 /// but with all dynamically-allocated buffers duplicated in new buffers.
20578 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
20580 /// The contents of CResult_PaymentIdPaymentErrorZ
20581 pub union CResult_PaymentIdPaymentErrorZPtr {
20582 /// A pointer to the contents in the success state.
20583 /// Reading from this pointer when `result_ok` is not set is undefined.
20584 pub result: *mut crate::c_types::ThirtyTwoBytes,
20585 /// A pointer to the contents in the error state.
20586 /// Reading from this pointer when `result_ok` is set is undefined.
20587 pub err: *mut crate::lightning_invoice::payment::PaymentError,
20590 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
20591 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
20592 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20593 pub struct CResult_PaymentIdPaymentErrorZ {
20594 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
20595 /// `err` or `result` depending on the state of `result_ok`.
20596 pub contents: CResult_PaymentIdPaymentErrorZPtr,
20597 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
20598 pub result_ok: bool,
20601 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
20602 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
20603 CResult_PaymentIdPaymentErrorZ {
20604 contents: CResult_PaymentIdPaymentErrorZPtr {
20605 result: Box::into_raw(Box::new(o)),
20611 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
20612 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
20613 CResult_PaymentIdPaymentErrorZ {
20614 contents: CResult_PaymentIdPaymentErrorZPtr {
20615 err: Box::into_raw(Box::new(e)),
20620 /// Checks if the given object is currently in the success state
20622 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
20626 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
20627 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
20628 impl Drop for CResult_PaymentIdPaymentErrorZ {
20629 fn drop(&mut self) {
20630 if self.result_ok {
20631 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20632 let _ = unsafe { Box::from_raw(self.contents.result) };
20635 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20636 let _ = unsafe { Box::from_raw(self.contents.err) };
20641 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
20642 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
20643 let contents = if o.result_ok {
20644 let result = unsafe { o.contents.result };
20645 unsafe { o.contents.result = core::ptr::null_mut() };
20646 CResult_PaymentIdPaymentErrorZPtr { result }
20648 let err = unsafe { o.contents.err };
20649 unsafe { o.contents.err = core::ptr::null_mut(); }
20650 CResult_PaymentIdPaymentErrorZPtr { err }
20654 result_ok: o.result_ok,
20658 impl Clone for CResult_PaymentIdPaymentErrorZ {
20659 fn clone(&self) -> Self {
20660 if self.result_ok {
20661 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
20662 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
20665 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
20666 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
20672 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
20673 /// but with all dynamically-allocated buffers duplicated in new buffers.
20674 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
20676 /// The contents of CResult_NonePaymentErrorZ
20677 pub union CResult_NonePaymentErrorZPtr {
20678 /// Note that this value is always NULL, as there are no contents in the OK variant
20679 pub result: *mut core::ffi::c_void,
20680 /// A pointer to the contents in the error state.
20681 /// Reading from this pointer when `result_ok` is set is undefined.
20682 pub err: *mut crate::lightning_invoice::payment::PaymentError,
20685 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
20686 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
20687 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20688 pub struct CResult_NonePaymentErrorZ {
20689 /// The contents of this CResult_NonePaymentErrorZ, accessible via either
20690 /// `err` or `result` depending on the state of `result_ok`.
20691 pub contents: CResult_NonePaymentErrorZPtr,
20692 /// Whether this CResult_NonePaymentErrorZ represents a success state.
20693 pub result_ok: bool,
20696 /// Creates a new CResult_NonePaymentErrorZ in the success state.
20697 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
20698 CResult_NonePaymentErrorZ {
20699 contents: CResult_NonePaymentErrorZPtr {
20700 result: core::ptr::null_mut(),
20706 /// Creates a new CResult_NonePaymentErrorZ in the error state.
20707 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
20708 CResult_NonePaymentErrorZ {
20709 contents: CResult_NonePaymentErrorZPtr {
20710 err: Box::into_raw(Box::new(e)),
20715 /// Checks if the given object is currently in the success state
20717 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
20721 /// Frees any resources used by the CResult_NonePaymentErrorZ.
20722 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
20723 impl Drop for CResult_NonePaymentErrorZ {
20724 fn drop(&mut self) {
20725 if self.result_ok {
20727 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20728 let _ = unsafe { Box::from_raw(self.contents.err) };
20733 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
20734 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
20735 let contents = if o.result_ok {
20736 let _ = unsafe { Box::from_raw(o.contents.result) };
20737 o.contents.result = core::ptr::null_mut();
20738 CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
20740 let err = unsafe { o.contents.err };
20741 unsafe { o.contents.err = core::ptr::null_mut(); }
20742 CResult_NonePaymentErrorZPtr { err }
20746 result_ok: o.result_ok,
20750 impl Clone for CResult_NonePaymentErrorZ {
20751 fn clone(&self) -> Self {
20752 if self.result_ok {
20753 Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
20754 result: core::ptr::null_mut()
20757 Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
20758 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
20764 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
20765 /// but with all dynamically-allocated buffers duplicated in new buffers.
20766 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
20768 /// The contents of CResult_StringErrorZ
20769 pub union CResult_StringErrorZPtr {
20770 /// A pointer to the contents in the success state.
20771 /// Reading from this pointer when `result_ok` is not set is undefined.
20772 pub result: *mut crate::c_types::Str,
20773 /// A pointer to the contents in the error state.
20774 /// Reading from this pointer when `result_ok` is set is undefined.
20775 pub err: *mut crate::c_types::Secp256k1Error,
20778 /// A CResult_StringErrorZ represents the result of a fallible operation,
20779 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
20780 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20781 pub struct CResult_StringErrorZ {
20782 /// The contents of this CResult_StringErrorZ, accessible via either
20783 /// `err` or `result` depending on the state of `result_ok`.
20784 pub contents: CResult_StringErrorZPtr,
20785 /// Whether this CResult_StringErrorZ represents a success state.
20786 pub result_ok: bool,
20789 /// Creates a new CResult_StringErrorZ in the success state.
20790 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
20791 CResult_StringErrorZ {
20792 contents: CResult_StringErrorZPtr {
20793 result: Box::into_raw(Box::new(o)),
20799 /// Creates a new CResult_StringErrorZ in the error state.
20800 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
20801 CResult_StringErrorZ {
20802 contents: CResult_StringErrorZPtr {
20803 err: Box::into_raw(Box::new(e)),
20808 /// Checks if the given object is currently in the success state
20810 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
20814 /// Frees any resources used by the CResult_StringErrorZ.
20815 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
20816 impl Drop for CResult_StringErrorZ {
20817 fn drop(&mut self) {
20818 if self.result_ok {
20819 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20820 let _ = unsafe { Box::from_raw(self.contents.result) };
20823 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20824 let _ = unsafe { Box::from_raw(self.contents.err) };
20829 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
20830 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
20831 let contents = if o.result_ok {
20832 let result = unsafe { o.contents.result };
20833 unsafe { o.contents.result = core::ptr::null_mut() };
20834 CResult_StringErrorZPtr { result }
20836 let err = unsafe { o.contents.err };
20837 unsafe { o.contents.err = core::ptr::null_mut(); }
20838 CResult_StringErrorZPtr { err }
20842 result_ok: o.result_ok,
20846 impl Clone for CResult_StringErrorZ {
20847 fn clone(&self) -> Self {
20848 if self.result_ok {
20849 Self { result_ok: true, contents: CResult_StringErrorZPtr {
20850 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
20853 Self { result_ok: false, contents: CResult_StringErrorZPtr {
20854 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
20860 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
20861 /// but with all dynamically-allocated buffers duplicated in new buffers.
20862 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
20864 /// The contents of CResult_TxOutUtxoLookupErrorZ
20865 pub union CResult_TxOutUtxoLookupErrorZPtr {
20866 /// A pointer to the contents in the success state.
20867 /// Reading from this pointer when `result_ok` is not set is undefined.
20868 pub result: *mut crate::c_types::TxOut,
20869 /// A pointer to the contents in the error state.
20870 /// Reading from this pointer when `result_ok` is set is undefined.
20871 pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
20874 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
20875 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
20876 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20877 pub struct CResult_TxOutUtxoLookupErrorZ {
20878 /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
20879 /// `err` or `result` depending on the state of `result_ok`.
20880 pub contents: CResult_TxOutUtxoLookupErrorZPtr,
20881 /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
20882 pub result_ok: bool,
20885 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
20886 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
20887 CResult_TxOutUtxoLookupErrorZ {
20888 contents: CResult_TxOutUtxoLookupErrorZPtr {
20889 result: Box::into_raw(Box::new(o)),
20895 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
20896 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
20897 CResult_TxOutUtxoLookupErrorZ {
20898 contents: CResult_TxOutUtxoLookupErrorZPtr {
20899 err: Box::into_raw(Box::new(e)),
20904 /// Checks if the given object is currently in the success state
20906 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
20910 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
20911 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
20912 impl Drop for CResult_TxOutUtxoLookupErrorZ {
20913 fn drop(&mut self) {
20914 if self.result_ok {
20915 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20916 let _ = unsafe { Box::from_raw(self.contents.result) };
20919 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20920 let _ = unsafe { Box::from_raw(self.contents.err) };
20925 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
20926 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
20927 let contents = if o.result_ok {
20928 let result = unsafe { o.contents.result };
20929 unsafe { o.contents.result = core::ptr::null_mut() };
20930 CResult_TxOutUtxoLookupErrorZPtr { result }
20932 let err = unsafe { o.contents.err };
20933 unsafe { o.contents.err = core::ptr::null_mut(); }
20934 CResult_TxOutUtxoLookupErrorZPtr { err }
20938 result_ok: o.result_ok,
20942 impl Clone for CResult_TxOutUtxoLookupErrorZ {
20943 fn clone(&self) -> Self {
20944 if self.result_ok {
20945 Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
20946 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
20949 Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
20950 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
20956 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
20957 /// but with all dynamically-allocated buffers duplicated in new buffers.
20958 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
20960 /// The contents of CResult_OnionMessagePathNoneZ
20961 pub union CResult_OnionMessagePathNoneZPtr {
20962 /// A pointer to the contents in the success state.
20963 /// Reading from this pointer when `result_ok` is not set is undefined.
20964 pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
20965 /// Note that this value is always NULL, as there are no contents in the Err variant
20966 pub err: *mut core::ffi::c_void,
20969 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
20970 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
20971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20972 pub struct CResult_OnionMessagePathNoneZ {
20973 /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
20974 /// `err` or `result` depending on the state of `result_ok`.
20975 pub contents: CResult_OnionMessagePathNoneZPtr,
20976 /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
20977 pub result_ok: bool,
20980 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
20981 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
20982 CResult_OnionMessagePathNoneZ {
20983 contents: CResult_OnionMessagePathNoneZPtr {
20984 result: Box::into_raw(Box::new(o)),
20990 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
20991 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
20992 CResult_OnionMessagePathNoneZ {
20993 contents: CResult_OnionMessagePathNoneZPtr {
20994 err: core::ptr::null_mut(),
20999 /// Checks if the given object is currently in the success state
21001 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
21005 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
21006 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
21007 impl Drop for CResult_OnionMessagePathNoneZ {
21008 fn drop(&mut self) {
21009 if self.result_ok {
21010 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21011 let _ = unsafe { Box::from_raw(self.contents.result) };
21017 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
21018 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
21019 let contents = if o.result_ok {
21020 let result = unsafe { o.contents.result };
21021 unsafe { o.contents.result = core::ptr::null_mut() };
21022 CResult_OnionMessagePathNoneZPtr { result }
21024 let _ = unsafe { Box::from_raw(o.contents.err) };
21025 o.contents.err = core::ptr::null_mut();
21026 CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
21030 result_ok: o.result_ok,
21034 impl Clone for CResult_OnionMessagePathNoneZ {
21035 fn clone(&self) -> Self {
21036 if self.result_ok {
21037 Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
21038 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
21041 Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
21042 err: core::ptr::null_mut()
21048 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
21049 /// but with all dynamically-allocated buffers duplicated in new buffers.
21050 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
21052 /// The contents of CResult_NoneSendErrorZ
21053 pub union CResult_NoneSendErrorZPtr {
21054 /// Note that this value is always NULL, as there are no contents in the OK variant
21055 pub result: *mut core::ffi::c_void,
21056 /// A pointer to the contents in the error state.
21057 /// Reading from this pointer when `result_ok` is set is undefined.
21058 pub err: *mut crate::lightning::onion_message::messenger::SendError,
21061 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
21062 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
21063 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21064 pub struct CResult_NoneSendErrorZ {
21065 /// The contents of this CResult_NoneSendErrorZ, accessible via either
21066 /// `err` or `result` depending on the state of `result_ok`.
21067 pub contents: CResult_NoneSendErrorZPtr,
21068 /// Whether this CResult_NoneSendErrorZ represents a success state.
21069 pub result_ok: bool,
21072 /// Creates a new CResult_NoneSendErrorZ in the success state.
21073 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
21074 CResult_NoneSendErrorZ {
21075 contents: CResult_NoneSendErrorZPtr {
21076 result: core::ptr::null_mut(),
21082 /// Creates a new CResult_NoneSendErrorZ in the error state.
21083 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
21084 CResult_NoneSendErrorZ {
21085 contents: CResult_NoneSendErrorZPtr {
21086 err: Box::into_raw(Box::new(e)),
21091 /// Checks if the given object is currently in the success state
21093 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
21097 /// Frees any resources used by the CResult_NoneSendErrorZ.
21098 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
21099 impl Drop for CResult_NoneSendErrorZ {
21100 fn drop(&mut self) {
21101 if self.result_ok {
21103 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21104 let _ = unsafe { Box::from_raw(self.contents.err) };
21109 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
21110 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
21111 let contents = if o.result_ok {
21112 let _ = unsafe { Box::from_raw(o.contents.result) };
21113 o.contents.result = core::ptr::null_mut();
21114 CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
21116 let err = unsafe { o.contents.err };
21117 unsafe { o.contents.err = core::ptr::null_mut(); }
21118 CResult_NoneSendErrorZPtr { err }
21122 result_ok: o.result_ok,
21127 /// The contents of CResult_BlindedPathNoneZ
21128 pub union CResult_BlindedPathNoneZPtr {
21129 /// A pointer to the contents in the success state.
21130 /// Reading from this pointer when `result_ok` is not set is undefined.
21131 pub result: *mut crate::lightning::blinded_path::BlindedPath,
21132 /// Note that this value is always NULL, as there are no contents in the Err variant
21133 pub err: *mut core::ffi::c_void,
21136 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
21137 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
21138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21139 pub struct CResult_BlindedPathNoneZ {
21140 /// The contents of this CResult_BlindedPathNoneZ, accessible via either
21141 /// `err` or `result` depending on the state of `result_ok`.
21142 pub contents: CResult_BlindedPathNoneZPtr,
21143 /// Whether this CResult_BlindedPathNoneZ represents a success state.
21144 pub result_ok: bool,
21147 /// Creates a new CResult_BlindedPathNoneZ in the success state.
21148 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
21149 CResult_BlindedPathNoneZ {
21150 contents: CResult_BlindedPathNoneZPtr {
21151 result: Box::into_raw(Box::new(o)),
21157 /// Creates a new CResult_BlindedPathNoneZ in the error state.
21158 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
21159 CResult_BlindedPathNoneZ {
21160 contents: CResult_BlindedPathNoneZPtr {
21161 err: core::ptr::null_mut(),
21166 /// Checks if the given object is currently in the success state
21168 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
21172 /// Frees any resources used by the CResult_BlindedPathNoneZ.
21173 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
21174 impl Drop for CResult_BlindedPathNoneZ {
21175 fn drop(&mut self) {
21176 if self.result_ok {
21177 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21178 let _ = unsafe { Box::from_raw(self.contents.result) };
21184 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
21185 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
21186 let contents = if o.result_ok {
21187 let result = unsafe { o.contents.result };
21188 unsafe { o.contents.result = core::ptr::null_mut() };
21189 CResult_BlindedPathNoneZPtr { result }
21191 let _ = unsafe { Box::from_raw(o.contents.err) };
21192 o.contents.err = core::ptr::null_mut();
21193 CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
21197 result_ok: o.result_ok,
21201 impl Clone for CResult_BlindedPathNoneZ {
21202 fn clone(&self) -> Self {
21203 if self.result_ok {
21204 Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
21205 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
21208 Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
21209 err: core::ptr::null_mut()
21215 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
21216 /// but with all dynamically-allocated buffers duplicated in new buffers.
21217 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
21219 /// The contents of CResult_BlindedPathDecodeErrorZ
21220 pub union CResult_BlindedPathDecodeErrorZPtr {
21221 /// A pointer to the contents in the success state.
21222 /// Reading from this pointer when `result_ok` is not set is undefined.
21223 pub result: *mut crate::lightning::blinded_path::BlindedPath,
21224 /// A pointer to the contents in the error state.
21225 /// Reading from this pointer when `result_ok` is set is undefined.
21226 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21229 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
21230 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
21231 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21232 pub struct CResult_BlindedPathDecodeErrorZ {
21233 /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
21234 /// `err` or `result` depending on the state of `result_ok`.
21235 pub contents: CResult_BlindedPathDecodeErrorZPtr,
21236 /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
21237 pub result_ok: bool,
21240 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
21241 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
21242 CResult_BlindedPathDecodeErrorZ {
21243 contents: CResult_BlindedPathDecodeErrorZPtr {
21244 result: Box::into_raw(Box::new(o)),
21250 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
21251 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
21252 CResult_BlindedPathDecodeErrorZ {
21253 contents: CResult_BlindedPathDecodeErrorZPtr {
21254 err: Box::into_raw(Box::new(e)),
21259 /// Checks if the given object is currently in the success state
21261 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
21265 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
21266 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
21267 impl Drop for CResult_BlindedPathDecodeErrorZ {
21268 fn drop(&mut self) {
21269 if self.result_ok {
21270 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21271 let _ = unsafe { Box::from_raw(self.contents.result) };
21274 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21275 let _ = unsafe { Box::from_raw(self.contents.err) };
21280 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
21281 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
21282 let contents = if o.result_ok {
21283 let result = unsafe { o.contents.result };
21284 unsafe { o.contents.result = core::ptr::null_mut() };
21285 CResult_BlindedPathDecodeErrorZPtr { result }
21287 let err = unsafe { o.contents.err };
21288 unsafe { o.contents.err = core::ptr::null_mut(); }
21289 CResult_BlindedPathDecodeErrorZPtr { err }
21293 result_ok: o.result_ok,
21297 impl Clone for CResult_BlindedPathDecodeErrorZ {
21298 fn clone(&self) -> Self {
21299 if self.result_ok {
21300 Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
21301 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
21304 Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
21305 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21311 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
21312 /// but with all dynamically-allocated buffers duplicated in new buffers.
21313 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
21315 /// The contents of CResult_BlindedHopDecodeErrorZ
21316 pub union CResult_BlindedHopDecodeErrorZPtr {
21317 /// A pointer to the contents in the success state.
21318 /// Reading from this pointer when `result_ok` is not set is undefined.
21319 pub result: *mut crate::lightning::blinded_path::BlindedHop,
21320 /// A pointer to the contents in the error state.
21321 /// Reading from this pointer when `result_ok` is set is undefined.
21322 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21325 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
21326 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
21327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21328 pub struct CResult_BlindedHopDecodeErrorZ {
21329 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
21330 /// `err` or `result` depending on the state of `result_ok`.
21331 pub contents: CResult_BlindedHopDecodeErrorZPtr,
21332 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
21333 pub result_ok: bool,
21336 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
21337 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
21338 CResult_BlindedHopDecodeErrorZ {
21339 contents: CResult_BlindedHopDecodeErrorZPtr {
21340 result: Box::into_raw(Box::new(o)),
21346 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
21347 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
21348 CResult_BlindedHopDecodeErrorZ {
21349 contents: CResult_BlindedHopDecodeErrorZPtr {
21350 err: Box::into_raw(Box::new(e)),
21355 /// Checks if the given object is currently in the success state
21357 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
21361 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
21362 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
21363 impl Drop for CResult_BlindedHopDecodeErrorZ {
21364 fn drop(&mut self) {
21365 if self.result_ok {
21366 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21367 let _ = unsafe { Box::from_raw(self.contents.result) };
21370 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21371 let _ = unsafe { Box::from_raw(self.contents.err) };
21376 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
21377 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
21378 let contents = if o.result_ok {
21379 let result = unsafe { o.contents.result };
21380 unsafe { o.contents.result = core::ptr::null_mut() };
21381 CResult_BlindedHopDecodeErrorZPtr { result }
21383 let err = unsafe { o.contents.err };
21384 unsafe { o.contents.err = core::ptr::null_mut(); }
21385 CResult_BlindedHopDecodeErrorZPtr { err }
21389 result_ok: o.result_ok,
21393 impl Clone for CResult_BlindedHopDecodeErrorZ {
21394 fn clone(&self) -> Self {
21395 if self.result_ok {
21396 Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
21397 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
21400 Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
21401 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21407 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
21408 /// but with all dynamically-allocated buffers duplicated in new buffers.
21409 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
21411 /// The contents of CResult_InvoiceErrorDecodeErrorZ
21412 pub union CResult_InvoiceErrorDecodeErrorZPtr {
21413 /// A pointer to the contents in the success state.
21414 /// Reading from this pointer when `result_ok` is not set is undefined.
21415 pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
21416 /// A pointer to the contents in the error state.
21417 /// Reading from this pointer when `result_ok` is set is undefined.
21418 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21421 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
21422 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
21423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21424 pub struct CResult_InvoiceErrorDecodeErrorZ {
21425 /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
21426 /// `err` or `result` depending on the state of `result_ok`.
21427 pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
21428 /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
21429 pub result_ok: bool,
21432 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
21433 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
21434 CResult_InvoiceErrorDecodeErrorZ {
21435 contents: CResult_InvoiceErrorDecodeErrorZPtr {
21436 result: Box::into_raw(Box::new(o)),
21442 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
21443 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
21444 CResult_InvoiceErrorDecodeErrorZ {
21445 contents: CResult_InvoiceErrorDecodeErrorZPtr {
21446 err: Box::into_raw(Box::new(e)),
21451 /// Checks if the given object is currently in the success state
21453 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
21457 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
21458 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
21459 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
21460 fn drop(&mut self) {
21461 if self.result_ok {
21462 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21463 let _ = unsafe { Box::from_raw(self.contents.result) };
21466 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21467 let _ = unsafe { Box::from_raw(self.contents.err) };
21472 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
21473 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
21474 let contents = if o.result_ok {
21475 let result = unsafe { o.contents.result };
21476 unsafe { o.contents.result = core::ptr::null_mut() };
21477 CResult_InvoiceErrorDecodeErrorZPtr { result }
21479 let err = unsafe { o.contents.err };
21480 unsafe { o.contents.err = core::ptr::null_mut(); }
21481 CResult_InvoiceErrorDecodeErrorZPtr { err }
21485 result_ok: o.result_ok,
21489 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
21490 fn clone(&self) -> Self {
21491 if self.result_ok {
21492 Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
21493 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
21496 Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
21497 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21503 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
21504 /// but with all dynamically-allocated buffers duplicated in new buffers.
21505 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
21507 /// An enum which can either contain a crate::lightning::chain::Filter or not
21508 pub enum COption_FilterZ {
21509 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
21510 Some(crate::lightning::chain::Filter),
21511 /// When we're in this state, this COption_FilterZ contains nothing
21514 impl COption_FilterZ {
21515 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21516 if let Self::None = self { false } else { true }
21518 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21521 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
21522 if let Self::Some(v) = self { v } else { unreachable!() }
21526 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
21527 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
21528 COption_FilterZ::Some(o)
21531 /// Constructs a new COption_FilterZ containing nothing
21532 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
21533 COption_FilterZ::None
21536 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
21537 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
21539 /// The contents of CResult_LockedChannelMonitorNoneZ
21540 pub union CResult_LockedChannelMonitorNoneZPtr {
21541 /// A pointer to the contents in the success state.
21542 /// Reading from this pointer when `result_ok` is not set is undefined.
21543 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
21544 /// Note that this value is always NULL, as there are no contents in the Err variant
21545 pub err: *mut core::ffi::c_void,
21548 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
21549 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
21550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21551 pub struct CResult_LockedChannelMonitorNoneZ {
21552 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
21553 /// `err` or `result` depending on the state of `result_ok`.
21554 pub contents: CResult_LockedChannelMonitorNoneZPtr,
21555 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
21556 pub result_ok: bool,
21559 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
21560 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
21561 CResult_LockedChannelMonitorNoneZ {
21562 contents: CResult_LockedChannelMonitorNoneZPtr {
21563 result: Box::into_raw(Box::new(o)),
21569 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
21570 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
21571 CResult_LockedChannelMonitorNoneZ {
21572 contents: CResult_LockedChannelMonitorNoneZPtr {
21573 err: core::ptr::null_mut(),
21578 /// Checks if the given object is currently in the success state
21580 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
21584 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
21585 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
21586 impl Drop for CResult_LockedChannelMonitorNoneZ {
21587 fn drop(&mut self) {
21588 if self.result_ok {
21589 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21590 let _ = unsafe { Box::from_raw(self.contents.result) };
21596 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
21597 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
21598 let contents = if o.result_ok {
21599 let result = unsafe { o.contents.result };
21600 unsafe { o.contents.result = core::ptr::null_mut() };
21601 CResult_LockedChannelMonitorNoneZPtr { result }
21603 let _ = unsafe { Box::from_raw(o.contents.err) };
21604 o.contents.err = core::ptr::null_mut();
21605 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
21609 result_ok: o.result_ok,
21614 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
21615 /// This corresponds to std::vector in C++
21616 pub struct CVec_OutPointZ {
21617 /// The elements in the array.
21618 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21619 pub data: *mut crate::lightning::chain::transaction::OutPoint,
21620 /// The number of elements pointed to by `data`.
21623 impl CVec_OutPointZ {
21624 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
21625 if self.datalen == 0 { return Vec::new(); }
21626 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21627 self.data = core::ptr::null_mut();
21631 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
21632 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21635 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
21636 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
21637 let datalen = v.len();
21638 let data = Box::into_raw(v.into_boxed_slice());
21639 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21643 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21644 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
21645 impl Drop for CVec_OutPointZ {
21646 fn drop(&mut self) {
21647 if self.datalen == 0 { return; }
21648 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21651 impl Clone for CVec_OutPointZ {
21652 fn clone(&self) -> Self {
21653 let mut res = Vec::new();
21654 if self.datalen == 0 { return Self::from(res); }
21655 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
21660 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
21661 /// This corresponds to std::vector in C++
21662 pub struct CVec_MonitorUpdateIdZ {
21663 /// The elements in the array.
21664 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21665 pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
21666 /// The number of elements pointed to by `data`.
21669 impl CVec_MonitorUpdateIdZ {
21670 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
21671 if self.datalen == 0 { return Vec::new(); }
21672 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21673 self.data = core::ptr::null_mut();
21677 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
21678 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21681 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
21682 fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
21683 let datalen = v.len();
21684 let data = Box::into_raw(v.into_boxed_slice());
21685 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21689 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21690 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
21691 impl Drop for CVec_MonitorUpdateIdZ {
21692 fn drop(&mut self) {
21693 if self.datalen == 0 { return; }
21694 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21697 impl Clone for CVec_MonitorUpdateIdZ {
21698 fn clone(&self) -> Self {
21699 let mut res = Vec::new();
21700 if self.datalen == 0 { return Self::from(res); }
21701 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
21706 /// A tuple of 2 elements. See the individual fields for the types contained.
21707 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
21708 /// The element at position 0
21709 pub a: crate::lightning::chain::transaction::OutPoint,
21710 /// The element at position 1
21711 pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
21713 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
21714 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
21721 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
21722 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
21726 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
21727 fn clone(&self) -> Self {
21729 a: Clone::clone(&self.a),
21730 b: Clone::clone(&self.b),
21735 /// Creates a new tuple which has the same data as `orig`
21736 /// but with all dynamically-allocated buffers duplicated in new buffers.
21737 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
21738 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
21740 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
21741 C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
21745 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
21746 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
21748 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
21749 /// This corresponds to std::vector in C++
21750 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
21751 /// The elements in the array.
21752 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21753 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
21754 /// The number of elements pointed to by `data`.
21757 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
21758 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
21759 if self.datalen == 0 { return Vec::new(); }
21760 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21761 self.data = core::ptr::null_mut();
21765 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
21766 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21769 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
21770 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
21771 let datalen = v.len();
21772 let data = Box::into_raw(v.into_boxed_slice());
21773 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21777 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21778 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
21779 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
21780 fn drop(&mut self) {
21781 if self.datalen == 0 { return; }
21782 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21785 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
21786 fn clone(&self) -> Self {
21787 let mut res = Vec::new();
21788 if self.datalen == 0 { return Self::from(res); }
21789 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });