2 use alloc::str::FromStr;
3 use alloc::string::String;
5 use core::convert::Infallible;
6 use bitcoin::hashes::Hash;
8 #[cfg(feature="no-std")]
9 use alloc::{vec::Vec, boxed::Box};
12 /// A dynamically-allocated array of u8s of arbitrary size.
13 /// This corresponds to std::vector in C++
15 /// The elements in the array.
16 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18 /// The number of elements pointed to by `data`.
22 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
23 if self.datalen == 0 { return Vec::new(); }
24 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
25 self.data = core::ptr::null_mut();
29 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
30 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
33 impl From<Vec<u8>> for CVec_u8Z {
34 fn from(v: Vec<u8>) -> Self {
35 let datalen = v.len();
36 let data = Box::into_raw(v.into_boxed_slice());
37 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
41 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
42 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
43 impl Drop for CVec_u8Z {
45 if self.datalen == 0 { return; }
46 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
49 impl Clone for CVec_u8Z {
50 fn clone(&self) -> Self {
51 let mut res = Vec::new();
52 if self.datalen == 0 { return Self::from(res); }
53 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
58 /// The contents of CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ
59 pub union CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
60 /// A pointer to the contents in the success state.
61 /// Reading from this pointer when `result_ok` is not set is undefined.
62 pub result: *mut crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder,
63 /// A pointer to the contents in the error state.
64 /// Reading from this pointer when `result_ok` is set is undefined.
65 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
68 /// A CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
69 /// containing a crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
70 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
71 pub struct CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
72 /// The contents of this CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either
73 /// `err` or `result` depending on the state of `result_ok`.
74 pub contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr,
75 /// Whether this CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state.
79 /// Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state.
80 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder) -> CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
81 CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
82 contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
83 result: Box::into_raw(Box::new(o)),
89 /// Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state.
90 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
91 CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
92 contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
93 err: Box::into_raw(Box::new(e)),
98 /// Checks if the given object is currently in the success state
100 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> bool {
104 /// Frees any resources used by the CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ.
105 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ) { }
106 impl Drop for CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
109 if unsafe { !(self.contents.result as *mut ()).is_null() } {
110 let _ = unsafe { Box::from_raw(self.contents.result) };
113 if unsafe { !(self.contents.err as *mut ()).is_null() } {
114 let _ = unsafe { Box::from_raw(self.contents.err) };
119 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
120 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
121 let contents = if o.result_ok {
122 let result = unsafe { o.contents.result };
123 unsafe { o.contents.result = core::ptr::null_mut() };
124 CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { result }
126 let err = unsafe { o.contents.err };
127 unsafe { o.contents.err = core::ptr::null_mut(); }
128 CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { err }
132 result_ok: o.result_ok,
137 /// The contents of CResult_RefundBolt12SemanticErrorZ
138 pub union CResult_RefundBolt12SemanticErrorZPtr {
139 /// A pointer to the contents in the success state.
140 /// Reading from this pointer when `result_ok` is not set is undefined.
141 pub result: *mut crate::lightning::offers::refund::Refund,
142 /// A pointer to the contents in the error state.
143 /// Reading from this pointer when `result_ok` is set is undefined.
144 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
147 /// A CResult_RefundBolt12SemanticErrorZ represents the result of a fallible operation,
148 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
150 pub struct CResult_RefundBolt12SemanticErrorZ {
151 /// The contents of this CResult_RefundBolt12SemanticErrorZ, accessible via either
152 /// `err` or `result` depending on the state of `result_ok`.
153 pub contents: CResult_RefundBolt12SemanticErrorZPtr,
154 /// Whether this CResult_RefundBolt12SemanticErrorZ represents a success state.
158 /// Creates a new CResult_RefundBolt12SemanticErrorZ in the success state.
159 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12SemanticErrorZ {
160 CResult_RefundBolt12SemanticErrorZ {
161 contents: CResult_RefundBolt12SemanticErrorZPtr {
162 result: Box::into_raw(Box::new(o)),
168 /// Creates a new CResult_RefundBolt12SemanticErrorZ in the error state.
169 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_RefundBolt12SemanticErrorZ {
170 CResult_RefundBolt12SemanticErrorZ {
171 contents: CResult_RefundBolt12SemanticErrorZPtr {
172 err: Box::into_raw(Box::new(e)),
177 /// Checks if the given object is currently in the success state
179 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_is_ok(o: &CResult_RefundBolt12SemanticErrorZ) -> bool {
183 /// Frees any resources used by the CResult_RefundBolt12SemanticErrorZ.
184 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_free(_res: CResult_RefundBolt12SemanticErrorZ) { }
185 impl Drop for CResult_RefundBolt12SemanticErrorZ {
188 if unsafe { !(self.contents.result as *mut ()).is_null() } {
189 let _ = unsafe { Box::from_raw(self.contents.result) };
192 if unsafe { !(self.contents.err as *mut ()).is_null() } {
193 let _ = unsafe { Box::from_raw(self.contents.err) };
198 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_RefundBolt12SemanticErrorZ {
199 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
200 let contents = if o.result_ok {
201 let result = unsafe { o.contents.result };
202 unsafe { o.contents.result = core::ptr::null_mut() };
203 CResult_RefundBolt12SemanticErrorZPtr { result }
205 let err = unsafe { o.contents.err };
206 unsafe { o.contents.err = core::ptr::null_mut(); }
207 CResult_RefundBolt12SemanticErrorZPtr { err }
211 result_ok: o.result_ok,
215 impl Clone for CResult_RefundBolt12SemanticErrorZ {
216 fn clone(&self) -> Self {
218 Self { result_ok: true, contents: CResult_RefundBolt12SemanticErrorZPtr {
219 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
222 Self { result_ok: false, contents: CResult_RefundBolt12SemanticErrorZPtr {
223 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
229 /// Creates a new CResult_RefundBolt12SemanticErrorZ which has the same data as `orig`
230 /// but with all dynamically-allocated buffers duplicated in new buffers.
231 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_clone(orig: &CResult_RefundBolt12SemanticErrorZ) -> CResult_RefundBolt12SemanticErrorZ { Clone::clone(&orig) }
234 /// An enum which can either contain a u64 or not
235 pub enum COption_u64Z {
236 /// When we're in this state, this COption_u64Z contains a u64
238 /// When we're in this state, this COption_u64Z contains nothing
242 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
243 if let Self::None = self { false } else { true }
245 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
248 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
249 if let Self::Some(v) = self { v } else { unreachable!() }
253 /// Constructs a new COption_u64Z containing a u64
254 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
255 COption_u64Z::Some(o)
258 /// Constructs a new COption_u64Z containing nothing
259 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
263 /// Frees any resources associated with the u64, if we are in the Some state
264 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
266 /// Creates a new COption_u64Z which has the same data as `orig`
267 /// but with all dynamically-allocated buffers duplicated in new buffers.
268 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
270 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
271 /// This corresponds to std::vector in C++
272 pub struct CVec_BlindedPathZ {
273 /// The elements in the array.
274 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
275 pub data: *mut crate::lightning::blinded_path::BlindedPath,
276 /// The number of elements pointed to by `data`.
279 impl CVec_BlindedPathZ {
280 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedPath> {
281 if self.datalen == 0 { return Vec::new(); }
282 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
283 self.data = core::ptr::null_mut();
287 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedPath] {
288 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
291 impl From<Vec<crate::lightning::blinded_path::BlindedPath>> for CVec_BlindedPathZ {
292 fn from(v: Vec<crate::lightning::blinded_path::BlindedPath>) -> Self {
293 let datalen = v.len();
294 let data = Box::into_raw(v.into_boxed_slice());
295 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
299 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
300 pub extern "C" fn CVec_BlindedPathZ_free(_res: CVec_BlindedPathZ) { }
301 impl Drop for CVec_BlindedPathZ {
303 if self.datalen == 0 { return; }
304 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
307 impl Clone for CVec_BlindedPathZ {
308 fn clone(&self) -> Self {
309 let mut res = Vec::new();
310 if self.datalen == 0 { return Self::from(res); }
311 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
316 /// The contents of CResult_RefundBolt12ParseErrorZ
317 pub union CResult_RefundBolt12ParseErrorZPtr {
318 /// A pointer to the contents in the success state.
319 /// Reading from this pointer when `result_ok` is not set is undefined.
320 pub result: *mut crate::lightning::offers::refund::Refund,
321 /// A pointer to the contents in the error state.
322 /// Reading from this pointer when `result_ok` is set is undefined.
323 pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
326 /// A CResult_RefundBolt12ParseErrorZ represents the result of a fallible operation,
327 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
328 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
329 pub struct CResult_RefundBolt12ParseErrorZ {
330 /// The contents of this CResult_RefundBolt12ParseErrorZ, accessible via either
331 /// `err` or `result` depending on the state of `result_ok`.
332 pub contents: CResult_RefundBolt12ParseErrorZPtr,
333 /// Whether this CResult_RefundBolt12ParseErrorZ represents a success state.
337 /// Creates a new CResult_RefundBolt12ParseErrorZ in the success state.
338 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12ParseErrorZ {
339 CResult_RefundBolt12ParseErrorZ {
340 contents: CResult_RefundBolt12ParseErrorZPtr {
341 result: Box::into_raw(Box::new(o)),
347 /// Creates a new CResult_RefundBolt12ParseErrorZ in the error state.
348 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_RefundBolt12ParseErrorZ {
349 CResult_RefundBolt12ParseErrorZ {
350 contents: CResult_RefundBolt12ParseErrorZPtr {
351 err: Box::into_raw(Box::new(e)),
356 /// Checks if the given object is currently in the success state
358 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_is_ok(o: &CResult_RefundBolt12ParseErrorZ) -> bool {
362 /// Frees any resources used by the CResult_RefundBolt12ParseErrorZ.
363 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_free(_res: CResult_RefundBolt12ParseErrorZ) { }
364 impl Drop for CResult_RefundBolt12ParseErrorZ {
367 if unsafe { !(self.contents.result as *mut ()).is_null() } {
368 let _ = unsafe { Box::from_raw(self.contents.result) };
371 if unsafe { !(self.contents.err as *mut ()).is_null() } {
372 let _ = unsafe { Box::from_raw(self.contents.err) };
377 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_RefundBolt12ParseErrorZ {
378 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
379 let contents = if o.result_ok {
380 let result = unsafe { o.contents.result };
381 unsafe { o.contents.result = core::ptr::null_mut() };
382 CResult_RefundBolt12ParseErrorZPtr { result }
384 let err = unsafe { o.contents.err };
385 unsafe { o.contents.err = core::ptr::null_mut(); }
386 CResult_RefundBolt12ParseErrorZPtr { err }
390 result_ok: o.result_ok,
394 impl Clone for CResult_RefundBolt12ParseErrorZ {
395 fn clone(&self) -> Self {
397 Self { result_ok: true, contents: CResult_RefundBolt12ParseErrorZPtr {
398 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
401 Self { result_ok: false, contents: CResult_RefundBolt12ParseErrorZPtr {
402 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
408 /// Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig`
409 /// but with all dynamically-allocated buffers duplicated in new buffers.
410 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_clone(orig: &CResult_RefundBolt12ParseErrorZ) -> CResult_RefundBolt12ParseErrorZ { Clone::clone(&orig) }
412 /// The contents of CResult_RetryDecodeErrorZ
413 pub union CResult_RetryDecodeErrorZPtr {
414 /// A pointer to the contents in the success state.
415 /// Reading from this pointer when `result_ok` is not set is undefined.
416 pub result: *mut crate::lightning::ln::outbound_payment::Retry,
417 /// A pointer to the contents in the error state.
418 /// Reading from this pointer when `result_ok` is set is undefined.
419 pub err: *mut crate::lightning::ln::msgs::DecodeError,
422 /// A CResult_RetryDecodeErrorZ represents the result of a fallible operation,
423 /// containing a crate::lightning::ln::outbound_payment::Retry on success and a crate::lightning::ln::msgs::DecodeError on failure.
424 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
425 pub struct CResult_RetryDecodeErrorZ {
426 /// The contents of this CResult_RetryDecodeErrorZ, accessible via either
427 /// `err` or `result` depending on the state of `result_ok`.
428 pub contents: CResult_RetryDecodeErrorZPtr,
429 /// Whether this CResult_RetryDecodeErrorZ represents a success state.
433 /// Creates a new CResult_RetryDecodeErrorZ in the success state.
434 pub extern "C" fn CResult_RetryDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::Retry) -> CResult_RetryDecodeErrorZ {
435 CResult_RetryDecodeErrorZ {
436 contents: CResult_RetryDecodeErrorZPtr {
437 result: Box::into_raw(Box::new(o)),
443 /// Creates a new CResult_RetryDecodeErrorZ in the error state.
444 pub extern "C" fn CResult_RetryDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RetryDecodeErrorZ {
445 CResult_RetryDecodeErrorZ {
446 contents: CResult_RetryDecodeErrorZPtr {
447 err: Box::into_raw(Box::new(e)),
452 /// Checks if the given object is currently in the success state
454 pub extern "C" fn CResult_RetryDecodeErrorZ_is_ok(o: &CResult_RetryDecodeErrorZ) -> bool {
458 /// Frees any resources used by the CResult_RetryDecodeErrorZ.
459 pub extern "C" fn CResult_RetryDecodeErrorZ_free(_res: CResult_RetryDecodeErrorZ) { }
460 impl Drop for CResult_RetryDecodeErrorZ {
463 if unsafe { !(self.contents.result as *mut ()).is_null() } {
464 let _ = unsafe { Box::from_raw(self.contents.result) };
467 if unsafe { !(self.contents.err as *mut ()).is_null() } {
468 let _ = unsafe { Box::from_raw(self.contents.err) };
473 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>> for CResult_RetryDecodeErrorZ {
474 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>) -> Self {
475 let contents = if o.result_ok {
476 let result = unsafe { o.contents.result };
477 unsafe { o.contents.result = core::ptr::null_mut() };
478 CResult_RetryDecodeErrorZPtr { result }
480 let err = unsafe { o.contents.err };
481 unsafe { o.contents.err = core::ptr::null_mut(); }
482 CResult_RetryDecodeErrorZPtr { err }
486 result_ok: o.result_ok,
490 impl Clone for CResult_RetryDecodeErrorZ {
491 fn clone(&self) -> Self {
493 Self { result_ok: true, contents: CResult_RetryDecodeErrorZPtr {
494 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::Retry>::clone(unsafe { &*self.contents.result })))
497 Self { result_ok: false, contents: CResult_RetryDecodeErrorZPtr {
498 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
504 /// Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig`
505 /// but with all dynamically-allocated buffers duplicated in new buffers.
506 pub extern "C" fn CResult_RetryDecodeErrorZ_clone(orig: &CResult_RetryDecodeErrorZ) -> CResult_RetryDecodeErrorZ { Clone::clone(&orig) }
508 /// The contents of CResult_NoneAPIErrorZ
509 pub union CResult_NoneAPIErrorZPtr {
510 /// Note that this value is always NULL, as there are no contents in the OK variant
511 pub result: *mut core::ffi::c_void,
512 /// A pointer to the contents in the error state.
513 /// Reading from this pointer when `result_ok` is set is undefined.
514 pub err: *mut crate::lightning::util::errors::APIError,
517 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
518 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
520 pub struct CResult_NoneAPIErrorZ {
521 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
522 /// `err` or `result` depending on the state of `result_ok`.
523 pub contents: CResult_NoneAPIErrorZPtr,
524 /// Whether this CResult_NoneAPIErrorZ represents a success state.
528 /// Creates a new CResult_NoneAPIErrorZ in the success state.
529 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
530 CResult_NoneAPIErrorZ {
531 contents: CResult_NoneAPIErrorZPtr {
532 result: core::ptr::null_mut(),
538 /// Creates a new CResult_NoneAPIErrorZ in the error state.
539 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
540 CResult_NoneAPIErrorZ {
541 contents: CResult_NoneAPIErrorZPtr {
542 err: Box::into_raw(Box::new(e)),
547 /// Checks if the given object is currently in the success state
549 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
553 /// Frees any resources used by the CResult_NoneAPIErrorZ.
554 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
555 impl Drop for CResult_NoneAPIErrorZ {
559 if unsafe { !(self.contents.err as *mut ()).is_null() } {
560 let _ = unsafe { Box::from_raw(self.contents.err) };
565 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
566 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
567 let contents = if o.result_ok {
568 let _ = unsafe { Box::from_raw(o.contents.result) };
569 o.contents.result = core::ptr::null_mut();
570 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
572 let err = unsafe { o.contents.err };
573 unsafe { o.contents.err = core::ptr::null_mut(); }
574 CResult_NoneAPIErrorZPtr { err }
578 result_ok: o.result_ok,
582 impl Clone for CResult_NoneAPIErrorZ {
583 fn clone(&self) -> Self {
585 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
586 result: core::ptr::null_mut()
589 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
590 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
596 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
597 /// but with all dynamically-allocated buffers duplicated in new buffers.
598 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
600 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
601 /// This corresponds to std::vector in C++
602 pub struct CVec_CResult_NoneAPIErrorZZ {
603 /// The elements in the array.
604 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
605 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
606 /// The number of elements pointed to by `data`.
609 impl CVec_CResult_NoneAPIErrorZZ {
610 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
611 if self.datalen == 0 { return Vec::new(); }
612 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
613 self.data = core::ptr::null_mut();
617 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
618 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
621 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
622 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
623 let datalen = v.len();
624 let data = Box::into_raw(v.into_boxed_slice());
625 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
629 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
630 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
631 impl Drop for CVec_CResult_NoneAPIErrorZZ {
633 if self.datalen == 0 { return; }
634 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
637 impl Clone for CVec_CResult_NoneAPIErrorZZ {
638 fn clone(&self) -> Self {
639 let mut res = Vec::new();
640 if self.datalen == 0 { return Self::from(res); }
641 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
646 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
647 /// This corresponds to std::vector in C++
648 pub struct CVec_APIErrorZ {
649 /// The elements in the array.
650 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
651 pub data: *mut crate::lightning::util::errors::APIError,
652 /// The number of elements pointed to by `data`.
655 impl CVec_APIErrorZ {
656 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
657 if self.datalen == 0 { return Vec::new(); }
658 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
659 self.data = core::ptr::null_mut();
663 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
664 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
667 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
668 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
669 let datalen = v.len();
670 let data = Box::into_raw(v.into_boxed_slice());
671 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
675 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
676 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
677 impl Drop for CVec_APIErrorZ {
679 if self.datalen == 0 { return; }
680 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
683 impl Clone for CVec_APIErrorZ {
684 fn clone(&self) -> Self {
685 let mut res = Vec::new();
686 if self.datalen == 0 { return Self::from(res); }
687 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
693 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
694 pub enum COption_ThirtyTwoBytesZ {
695 /// When we're in this state, this COption_ThirtyTwoBytesZ contains a crate::c_types::ThirtyTwoBytes
696 Some(crate::c_types::ThirtyTwoBytes),
697 /// When we're in this state, this COption_ThirtyTwoBytesZ contains nothing
700 impl COption_ThirtyTwoBytesZ {
701 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
702 if let Self::None = self { false } else { true }
704 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
707 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
708 if let Self::Some(v) = self { v } else { unreachable!() }
712 /// Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes
713 pub extern "C" fn COption_ThirtyTwoBytesZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_ThirtyTwoBytesZ {
714 COption_ThirtyTwoBytesZ::Some(o)
717 /// Constructs a new COption_ThirtyTwoBytesZ containing nothing
718 pub extern "C" fn COption_ThirtyTwoBytesZ_none() -> COption_ThirtyTwoBytesZ {
719 COption_ThirtyTwoBytesZ::None
722 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
723 pub extern "C" fn COption_ThirtyTwoBytesZ_free(_res: COption_ThirtyTwoBytesZ) { }
725 /// Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig`
726 /// but with all dynamically-allocated buffers duplicated in new buffers.
727 pub extern "C" fn COption_ThirtyTwoBytesZ_clone(orig: &COption_ThirtyTwoBytesZ) -> COption_ThirtyTwoBytesZ { Clone::clone(&orig) }
730 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
731 pub enum COption_CVec_u8ZZ {
732 /// When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
733 Some(crate::c_types::derived::CVec_u8Z),
734 /// When we're in this state, this COption_CVec_u8ZZ contains nothing
737 impl COption_CVec_u8ZZ {
738 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
739 if let Self::None = self { false } else { true }
741 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
744 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
745 if let Self::Some(v) = self { v } else { unreachable!() }
749 /// Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
750 pub extern "C" fn COption_CVec_u8ZZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_CVec_u8ZZ {
751 COption_CVec_u8ZZ::Some(o)
754 /// Constructs a new COption_CVec_u8ZZ containing nothing
755 pub extern "C" fn COption_CVec_u8ZZ_none() -> COption_CVec_u8ZZ {
756 COption_CVec_u8ZZ::None
759 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
760 pub extern "C" fn COption_CVec_u8ZZ_free(_res: COption_CVec_u8ZZ) { }
762 /// Creates a new COption_CVec_u8ZZ which has the same data as `orig`
763 /// but with all dynamically-allocated buffers duplicated in new buffers.
764 pub extern "C" fn COption_CVec_u8ZZ_clone(orig: &COption_CVec_u8ZZ) -> COption_CVec_u8ZZ { Clone::clone(&orig) }
766 /// The contents of CResult_RecipientOnionFieldsDecodeErrorZ
767 pub union CResult_RecipientOnionFieldsDecodeErrorZPtr {
768 /// A pointer to the contents in the success state.
769 /// Reading from this pointer when `result_ok` is not set is undefined.
770 pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
771 /// A pointer to the contents in the error state.
772 /// Reading from this pointer when `result_ok` is set is undefined.
773 pub err: *mut crate::lightning::ln::msgs::DecodeError,
776 /// A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
777 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
778 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
779 pub struct CResult_RecipientOnionFieldsDecodeErrorZ {
780 /// The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
781 /// `err` or `result` depending on the state of `result_ok`.
782 pub contents: CResult_RecipientOnionFieldsDecodeErrorZPtr,
783 /// Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
787 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
788 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsDecodeErrorZ {
789 CResult_RecipientOnionFieldsDecodeErrorZ {
790 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
791 result: Box::into_raw(Box::new(o)),
797 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
798 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RecipientOnionFieldsDecodeErrorZ {
799 CResult_RecipientOnionFieldsDecodeErrorZ {
800 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
801 err: Box::into_raw(Box::new(e)),
806 /// Checks if the given object is currently in the success state
808 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o: &CResult_RecipientOnionFieldsDecodeErrorZ) -> bool {
812 /// Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
813 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_free(_res: CResult_RecipientOnionFieldsDecodeErrorZ) { }
814 impl Drop for CResult_RecipientOnionFieldsDecodeErrorZ {
817 if unsafe { !(self.contents.result as *mut ()).is_null() } {
818 let _ = unsafe { Box::from_raw(self.contents.result) };
821 if unsafe { !(self.contents.err as *mut ()).is_null() } {
822 let _ = unsafe { Box::from_raw(self.contents.err) };
827 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>> for CResult_RecipientOnionFieldsDecodeErrorZ {
828 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
829 let contents = if o.result_ok {
830 let result = unsafe { o.contents.result };
831 unsafe { o.contents.result = core::ptr::null_mut() };
832 CResult_RecipientOnionFieldsDecodeErrorZPtr { result }
834 let err = unsafe { o.contents.err };
835 unsafe { o.contents.err = core::ptr::null_mut(); }
836 CResult_RecipientOnionFieldsDecodeErrorZPtr { err }
840 result_ok: o.result_ok,
844 impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ {
845 fn clone(&self) -> Self {
847 Self { result_ok: true, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
848 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
851 Self { result_ok: false, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
852 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
858 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
859 /// but with all dynamically-allocated buffers duplicated in new buffers.
860 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) }
862 /// A tuple of 2 elements. See the individual fields for the types contained.
863 pub struct C2Tuple_u64CVec_u8ZZ {
864 /// The element at position 0
866 /// The element at position 1
867 pub b: crate::c_types::derived::CVec_u8Z,
869 impl From<(u64, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u64CVec_u8ZZ {
870 fn from (tup: (u64, crate::c_types::derived::CVec_u8Z)) -> Self {
877 impl C2Tuple_u64CVec_u8ZZ {
878 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, crate::c_types::derived::CVec_u8Z) {
882 impl Clone for C2Tuple_u64CVec_u8ZZ {
883 fn clone(&self) -> Self {
885 a: Clone::clone(&self.a),
886 b: Clone::clone(&self.b),
891 /// Creates a new tuple which has the same data as `orig`
892 /// but with all dynamically-allocated buffers duplicated in new buffers.
893 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_clone(orig: &C2Tuple_u64CVec_u8ZZ) -> C2Tuple_u64CVec_u8ZZ { Clone::clone(&orig) }
894 /// Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements.
896 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_new(a: u64, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u64CVec_u8ZZ {
897 C2Tuple_u64CVec_u8ZZ { a, b, }
901 /// Frees any resources used by the C2Tuple_u64CVec_u8ZZ.
902 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_free(_res: C2Tuple_u64CVec_u8ZZ) { }
904 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64CVec_u8ZZs of arbitrary size.
905 /// This corresponds to std::vector in C++
906 pub struct CVec_C2Tuple_u64CVec_u8ZZZ {
907 /// The elements in the array.
908 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
909 pub data: *mut crate::c_types::derived::C2Tuple_u64CVec_u8ZZ,
910 /// The number of elements pointed to by `data`.
913 impl CVec_C2Tuple_u64CVec_u8ZZZ {
914 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ> {
915 if self.datalen == 0 { return Vec::new(); }
916 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
917 self.data = core::ptr::null_mut();
921 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u64CVec_u8ZZ] {
922 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
925 impl From<Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>> for CVec_C2Tuple_u64CVec_u8ZZZ {
926 fn from(v: Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>) -> Self {
927 let datalen = v.len();
928 let data = Box::into_raw(v.into_boxed_slice());
929 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
933 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
934 pub extern "C" fn CVec_C2Tuple_u64CVec_u8ZZZ_free(_res: CVec_C2Tuple_u64CVec_u8ZZZ) { }
935 impl Drop for CVec_C2Tuple_u64CVec_u8ZZZ {
937 if self.datalen == 0 { return; }
938 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
941 impl Clone for CVec_C2Tuple_u64CVec_u8ZZZ {
942 fn clone(&self) -> Self {
943 let mut res = Vec::new();
944 if self.datalen == 0 { return Self::from(res); }
945 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
950 /// The contents of CResult_RecipientOnionFieldsNoneZ
951 pub union CResult_RecipientOnionFieldsNoneZPtr {
952 /// A pointer to the contents in the success state.
953 /// Reading from this pointer when `result_ok` is not set is undefined.
954 pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
955 /// Note that this value is always NULL, as there are no contents in the Err variant
956 pub err: *mut core::ffi::c_void,
959 /// A CResult_RecipientOnionFieldsNoneZ represents the result of a fallible operation,
960 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a () on failure.
961 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
962 pub struct CResult_RecipientOnionFieldsNoneZ {
963 /// The contents of this CResult_RecipientOnionFieldsNoneZ, accessible via either
964 /// `err` or `result` depending on the state of `result_ok`.
965 pub contents: CResult_RecipientOnionFieldsNoneZPtr,
966 /// Whether this CResult_RecipientOnionFieldsNoneZ represents a success state.
970 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the success state.
971 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsNoneZ {
972 CResult_RecipientOnionFieldsNoneZ {
973 contents: CResult_RecipientOnionFieldsNoneZPtr {
974 result: Box::into_raw(Box::new(o)),
980 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the error state.
981 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_err() -> CResult_RecipientOnionFieldsNoneZ {
982 CResult_RecipientOnionFieldsNoneZ {
983 contents: CResult_RecipientOnionFieldsNoneZPtr {
984 err: core::ptr::null_mut(),
989 /// Checks if the given object is currently in the success state
991 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_is_ok(o: &CResult_RecipientOnionFieldsNoneZ) -> bool {
995 /// Frees any resources used by the CResult_RecipientOnionFieldsNoneZ.
996 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_free(_res: CResult_RecipientOnionFieldsNoneZ) { }
997 impl Drop for CResult_RecipientOnionFieldsNoneZ {
1000 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1001 let _ = unsafe { Box::from_raw(self.contents.result) };
1007 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, ()>> for CResult_RecipientOnionFieldsNoneZ {
1008 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, ()>) -> Self {
1009 let contents = if o.result_ok {
1010 let result = unsafe { o.contents.result };
1011 unsafe { o.contents.result = core::ptr::null_mut() };
1012 CResult_RecipientOnionFieldsNoneZPtr { result }
1014 let _ = unsafe { Box::from_raw(o.contents.err) };
1015 o.contents.err = core::ptr::null_mut();
1016 CResult_RecipientOnionFieldsNoneZPtr { err: core::ptr::null_mut() }
1020 result_ok: o.result_ok,
1024 impl Clone for CResult_RecipientOnionFieldsNoneZ {
1025 fn clone(&self) -> Self {
1027 Self { result_ok: true, contents: CResult_RecipientOnionFieldsNoneZPtr {
1028 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
1031 Self { result_ok: false, contents: CResult_RecipientOnionFieldsNoneZPtr {
1032 err: core::ptr::null_mut()
1038 /// Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig`
1039 /// but with all dynamically-allocated buffers duplicated in new buffers.
1040 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_clone(orig: &CResult_RecipientOnionFieldsNoneZ) -> CResult_RecipientOnionFieldsNoneZ { Clone::clone(&orig) }
1042 /// The contents of CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ
1043 pub union CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1044 /// A pointer to the contents in the success state.
1045 /// Reading from this pointer when `result_ok` is not set is undefined.
1046 pub result: *mut crate::lightning::offers::invoice::UnsignedBolt12Invoice,
1047 /// A pointer to the contents in the error state.
1048 /// Reading from this pointer when `result_ok` is set is undefined.
1049 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
1052 /// A CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation,
1053 /// containing a crate::lightning::offers::invoice::UnsignedBolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
1054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1055 pub struct CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1056 /// The contents of this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ, accessible via either
1057 /// `err` or `result` depending on the state of `result_ok`.
1058 pub contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr,
1059 /// Whether this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents a success state.
1060 pub result_ok: bool,
1063 /// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the success state.
1064 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1065 CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1066 contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1067 result: Box::into_raw(Box::new(o)),
1073 /// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the error state.
1074 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1075 CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1076 contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1077 err: Box::into_raw(Box::new(e)),
1082 /// Checks if the given object is currently in the success state
1084 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) -> bool {
1088 /// Frees any resources used by the CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ.
1089 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) { }
1090 impl Drop for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1091 fn drop(&mut self) {
1093 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1094 let _ = unsafe { Box::from_raw(self.contents.result) };
1097 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1098 let _ = unsafe { Box::from_raw(self.contents.err) };
1103 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::UnsignedBolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1104 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::UnsignedBolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
1105 let contents = if o.result_ok {
1106 let result = unsafe { o.contents.result };
1107 unsafe { o.contents.result = core::ptr::null_mut() };
1108 CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { result }
1110 let err = unsafe { o.contents.err };
1111 unsafe { o.contents.err = core::ptr::null_mut(); }
1112 CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { err }
1116 result_ok: o.result_ok,
1121 /// The contents of CResult_Bolt12InvoiceBolt12SemanticErrorZ
1122 pub union CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1123 /// A pointer to the contents in the success state.
1124 /// Reading from this pointer when `result_ok` is not set is undefined.
1125 pub result: *mut crate::lightning::offers::invoice::Bolt12Invoice,
1126 /// A pointer to the contents in the error state.
1127 /// Reading from this pointer when `result_ok` is set is undefined.
1128 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
1131 /// A CResult_Bolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation,
1132 /// containing a crate::lightning::offers::invoice::Bolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
1133 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1134 pub struct CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1135 /// The contents of this CResult_Bolt12InvoiceBolt12SemanticErrorZ, accessible via either
1136 /// `err` or `result` depending on the state of `result_ok`.
1137 pub contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr,
1138 /// Whether this CResult_Bolt12InvoiceBolt12SemanticErrorZ represents a success state.
1139 pub result_ok: bool,
1142 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the success state.
1143 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::Bolt12Invoice) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1144 CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1145 contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1146 result: Box::into_raw(Box::new(o)),
1152 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the error state.
1153 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1154 CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1155 contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1156 err: Box::into_raw(Box::new(e)),
1161 /// Checks if the given object is currently in the success state
1163 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> bool {
1167 /// Frees any resources used by the CResult_Bolt12InvoiceBolt12SemanticErrorZ.
1168 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_Bolt12InvoiceBolt12SemanticErrorZ) { }
1169 impl Drop for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1170 fn drop(&mut self) {
1172 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1173 let _ = unsafe { Box::from_raw(self.contents.result) };
1176 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1177 let _ = unsafe { Box::from_raw(self.contents.err) };
1182 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::Bolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1183 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::Bolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
1184 let contents = if o.result_ok {
1185 let result = unsafe { o.contents.result };
1186 unsafe { o.contents.result = core::ptr::null_mut() };
1187 CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { result }
1189 let err = unsafe { o.contents.err };
1190 unsafe { o.contents.err = core::ptr::null_mut(); }
1191 CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { err }
1195 result_ok: o.result_ok,
1199 impl Clone for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1200 fn clone(&self) -> Self {
1202 Self { result_ok: true, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1203 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::Bolt12Invoice>::clone(unsafe { &*self.contents.result })))
1206 Self { result_ok: false, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1207 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
1213 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig`
1214 /// but with all dynamically-allocated buffers duplicated in new buffers.
1215 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ { Clone::clone(&orig) }
1217 /// The contents of CResult_SchnorrSignatureNoneZ
1218 pub union CResult_SchnorrSignatureNoneZPtr {
1219 /// A pointer to the contents in the success state.
1220 /// Reading from this pointer when `result_ok` is not set is undefined.
1221 pub result: *mut crate::c_types::SchnorrSignature,
1222 /// Note that this value is always NULL, as there are no contents in the Err variant
1223 pub err: *mut core::ffi::c_void,
1226 /// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation,
1227 /// containing a crate::c_types::SchnorrSignature on success and a () on failure.
1228 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1229 pub struct CResult_SchnorrSignatureNoneZ {
1230 /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either
1231 /// `err` or `result` depending on the state of `result_ok`.
1232 pub contents: CResult_SchnorrSignatureNoneZPtr,
1233 /// Whether this CResult_SchnorrSignatureNoneZ represents a success state.
1234 pub result_ok: bool,
1237 /// Creates a new CResult_SchnorrSignatureNoneZ in the success state.
1238 pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ {
1239 CResult_SchnorrSignatureNoneZ {
1240 contents: CResult_SchnorrSignatureNoneZPtr {
1241 result: Box::into_raw(Box::new(o)),
1247 /// Creates a new CResult_SchnorrSignatureNoneZ in the error state.
1248 pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ {
1249 CResult_SchnorrSignatureNoneZ {
1250 contents: CResult_SchnorrSignatureNoneZPtr {
1251 err: core::ptr::null_mut(),
1256 /// Checks if the given object is currently in the success state
1258 pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool {
1262 /// Frees any resources used by the CResult_SchnorrSignatureNoneZ.
1263 pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { }
1264 impl Drop for CResult_SchnorrSignatureNoneZ {
1265 fn drop(&mut self) {
1267 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1268 let _ = unsafe { Box::from_raw(self.contents.result) };
1274 impl From<crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>> for CResult_SchnorrSignatureNoneZ {
1275 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>) -> Self {
1276 let contents = if o.result_ok {
1277 let result = unsafe { o.contents.result };
1278 unsafe { o.contents.result = core::ptr::null_mut() };
1279 CResult_SchnorrSignatureNoneZPtr { result }
1281 let _ = unsafe { Box::from_raw(o.contents.err) };
1282 o.contents.err = core::ptr::null_mut();
1283 CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() }
1287 result_ok: o.result_ok,
1291 impl Clone for CResult_SchnorrSignatureNoneZ {
1292 fn clone(&self) -> Self {
1294 Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr {
1295 result: Box::into_raw(Box::new(<crate::c_types::SchnorrSignature>::clone(unsafe { &*self.contents.result })))
1298 Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr {
1299 err: core::ptr::null_mut()
1305 /// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig`
1306 /// but with all dynamically-allocated buffers duplicated in new buffers.
1307 pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) }
1309 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1310 /// This corresponds to std::vector in C++
1311 pub struct CVec_ThirtyTwoBytesZ {
1312 /// The elements in the array.
1313 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1314 pub data: *mut crate::c_types::ThirtyTwoBytes,
1315 /// The number of elements pointed to by `data`.
1318 impl CVec_ThirtyTwoBytesZ {
1319 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
1320 if self.datalen == 0 { return Vec::new(); }
1321 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1322 self.data = core::ptr::null_mut();
1326 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
1327 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1330 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
1331 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
1332 let datalen = v.len();
1333 let data = Box::into_raw(v.into_boxed_slice());
1334 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1338 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1339 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
1340 impl Drop for CVec_ThirtyTwoBytesZ {
1341 fn drop(&mut self) {
1342 if self.datalen == 0 { return; }
1343 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1346 impl Clone for CVec_ThirtyTwoBytesZ {
1347 fn clone(&self) -> Self {
1348 let mut res = Vec::new();
1349 if self.datalen == 0 { return Self::from(res); }
1350 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1356 /// An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not
1357 pub enum COption_CVec_ThirtyTwoBytesZZ {
1358 /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ
1359 Some(crate::c_types::derived::CVec_ThirtyTwoBytesZ),
1360 /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing
1363 impl COption_CVec_ThirtyTwoBytesZZ {
1364 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1365 if let Self::None = self { false } else { true }
1367 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1370 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
1371 if let Self::Some(v) = self { v } else { unreachable!() }
1375 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ
1376 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_some(o: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> COption_CVec_ThirtyTwoBytesZZ {
1377 COption_CVec_ThirtyTwoBytesZZ::Some(o)
1380 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing
1381 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_none() -> COption_CVec_ThirtyTwoBytesZZ {
1382 COption_CVec_ThirtyTwoBytesZZ::None
1385 /// Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state
1386 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_free(_res: COption_CVec_ThirtyTwoBytesZZ) { }
1388 /// Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig`
1389 /// but with all dynamically-allocated buffers duplicated in new buffers.
1390 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_clone(orig: &COption_CVec_ThirtyTwoBytesZZ) -> COption_CVec_ThirtyTwoBytesZZ { Clone::clone(&orig) }
1393 /// An enum which can either contain a crate::lightning::offers::offer::Amount or not
1394 pub enum COption_AmountZ {
1395 /// When we're in this state, this COption_AmountZ contains a crate::lightning::offers::offer::Amount
1396 Some(crate::lightning::offers::offer::Amount),
1397 /// When we're in this state, this COption_AmountZ contains nothing
1400 impl COption_AmountZ {
1401 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1402 if let Self::None = self { false } else { true }
1404 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1407 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::offers::offer::Amount {
1408 if let Self::Some(v) = self { v } else { unreachable!() }
1412 /// Constructs a new COption_AmountZ containing a crate::lightning::offers::offer::Amount
1413 pub extern "C" fn COption_AmountZ_some(o: crate::lightning::offers::offer::Amount) -> COption_AmountZ {
1414 COption_AmountZ::Some(o)
1417 /// Constructs a new COption_AmountZ containing nothing
1418 pub extern "C" fn COption_AmountZ_none() -> COption_AmountZ {
1419 COption_AmountZ::None
1422 /// Frees any resources associated with the crate::lightning::offers::offer::Amount, if we are in the Some state
1423 pub extern "C" fn COption_AmountZ_free(_res: COption_AmountZ) { }
1425 /// Creates a new COption_AmountZ which has the same data as `orig`
1426 /// but with all dynamically-allocated buffers duplicated in new buffers.
1427 pub extern "C" fn COption_AmountZ_clone(orig: &COption_AmountZ) -> COption_AmountZ { Clone::clone(&orig) }
1430 /// An enum which can either contain a crate::lightning::offers::offer::Quantity or not
1431 pub enum COption_QuantityZ {
1432 /// When we're in this state, this COption_QuantityZ contains a crate::lightning::offers::offer::Quantity
1433 Some(crate::lightning::offers::offer::Quantity),
1434 /// When we're in this state, this COption_QuantityZ contains nothing
1437 impl COption_QuantityZ {
1438 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1439 if let Self::None = self { false } else { true }
1441 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1444 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::offers::offer::Quantity {
1445 if let Self::Some(v) = self { v } else { unreachable!() }
1449 /// Constructs a new COption_QuantityZ containing a crate::lightning::offers::offer::Quantity
1450 pub extern "C" fn COption_QuantityZ_some(o: crate::lightning::offers::offer::Quantity) -> COption_QuantityZ {
1451 COption_QuantityZ::Some(o)
1454 /// Constructs a new COption_QuantityZ containing nothing
1455 pub extern "C" fn COption_QuantityZ_none() -> COption_QuantityZ {
1456 COption_QuantityZ::None
1459 /// Frees any resources associated with the crate::lightning::offers::offer::Quantity, if we are in the Some state
1460 pub extern "C" fn COption_QuantityZ_free(_res: COption_QuantityZ) { }
1462 /// Creates a new COption_QuantityZ which has the same data as `orig`
1463 /// but with all dynamically-allocated buffers duplicated in new buffers.
1464 pub extern "C" fn COption_QuantityZ_clone(orig: &COption_QuantityZ) -> COption_QuantityZ { Clone::clone(&orig) }
1466 /// The contents of CResult_ThirtyTwoBytesNoneZ
1467 pub union CResult_ThirtyTwoBytesNoneZPtr {
1468 /// A pointer to the contents in the success state.
1469 /// Reading from this pointer when `result_ok` is not set is undefined.
1470 pub result: *mut crate::c_types::ThirtyTwoBytes,
1471 /// Note that this value is always NULL, as there are no contents in the Err variant
1472 pub err: *mut core::ffi::c_void,
1475 /// A CResult_ThirtyTwoBytesNoneZ represents the result of a fallible operation,
1476 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
1477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1478 pub struct CResult_ThirtyTwoBytesNoneZ {
1479 /// The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either
1480 /// `err` or `result` depending on the state of `result_ok`.
1481 pub contents: CResult_ThirtyTwoBytesNoneZPtr,
1482 /// Whether this CResult_ThirtyTwoBytesNoneZ represents a success state.
1483 pub result_ok: bool,
1486 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the success state.
1487 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesNoneZ {
1488 CResult_ThirtyTwoBytesNoneZ {
1489 contents: CResult_ThirtyTwoBytesNoneZPtr {
1490 result: Box::into_raw(Box::new(o)),
1496 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the error state.
1497 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_err() -> CResult_ThirtyTwoBytesNoneZ {
1498 CResult_ThirtyTwoBytesNoneZ {
1499 contents: CResult_ThirtyTwoBytesNoneZPtr {
1500 err: core::ptr::null_mut(),
1505 /// Checks if the given object is currently in the success state
1507 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_is_ok(o: &CResult_ThirtyTwoBytesNoneZ) -> bool {
1511 /// Frees any resources used by the CResult_ThirtyTwoBytesNoneZ.
1512 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_free(_res: CResult_ThirtyTwoBytesNoneZ) { }
1513 impl Drop for CResult_ThirtyTwoBytesNoneZ {
1514 fn drop(&mut self) {
1516 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1517 let _ = unsafe { Box::from_raw(self.contents.result) };
1523 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_ThirtyTwoBytesNoneZ {
1524 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
1525 let contents = if o.result_ok {
1526 let result = unsafe { o.contents.result };
1527 unsafe { o.contents.result = core::ptr::null_mut() };
1528 CResult_ThirtyTwoBytesNoneZPtr { result }
1530 let _ = unsafe { Box::from_raw(o.contents.err) };
1531 o.contents.err = core::ptr::null_mut();
1532 CResult_ThirtyTwoBytesNoneZPtr { err: core::ptr::null_mut() }
1536 result_ok: o.result_ok,
1540 impl Clone for CResult_ThirtyTwoBytesNoneZ {
1541 fn clone(&self) -> Self {
1543 Self { result_ok: true, contents: CResult_ThirtyTwoBytesNoneZPtr {
1544 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
1547 Self { result_ok: false, contents: CResult_ThirtyTwoBytesNoneZPtr {
1548 err: core::ptr::null_mut()
1554 /// Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig`
1555 /// but with all dynamically-allocated buffers duplicated in new buffers.
1556 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_clone(orig: &CResult_ThirtyTwoBytesNoneZ) -> CResult_ThirtyTwoBytesNoneZ { Clone::clone(&orig) }
1558 /// The contents of CResult_BlindedPayInfoDecodeErrorZ
1559 pub union CResult_BlindedPayInfoDecodeErrorZPtr {
1560 /// A pointer to the contents in the success state.
1561 /// Reading from this pointer when `result_ok` is not set is undefined.
1562 pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo,
1563 /// A pointer to the contents in the error state.
1564 /// Reading from this pointer when `result_ok` is set is undefined.
1565 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1568 /// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
1569 /// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
1570 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1571 pub struct CResult_BlindedPayInfoDecodeErrorZ {
1572 /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
1573 /// `err` or `result` depending on the state of `result_ok`.
1574 pub contents: CResult_BlindedPayInfoDecodeErrorZPtr,
1575 /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
1576 pub result_ok: bool,
1579 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
1580 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ {
1581 CResult_BlindedPayInfoDecodeErrorZ {
1582 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1583 result: Box::into_raw(Box::new(o)),
1589 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
1590 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ {
1591 CResult_BlindedPayInfoDecodeErrorZ {
1592 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1593 err: Box::into_raw(Box::new(e)),
1598 /// Checks if the given object is currently in the success state
1600 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool {
1604 /// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
1605 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { }
1606 impl Drop for CResult_BlindedPayInfoDecodeErrorZ {
1607 fn drop(&mut self) {
1609 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1610 let _ = unsafe { Box::from_raw(self.contents.result) };
1613 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1614 let _ = unsafe { Box::from_raw(self.contents.err) };
1619 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPayInfoDecodeErrorZ {
1620 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
1621 let contents = if o.result_ok {
1622 let result = unsafe { o.contents.result };
1623 unsafe { o.contents.result = core::ptr::null_mut() };
1624 CResult_BlindedPayInfoDecodeErrorZPtr { result }
1626 let err = unsafe { o.contents.err };
1627 unsafe { o.contents.err = core::ptr::null_mut(); }
1628 CResult_BlindedPayInfoDecodeErrorZPtr { err }
1632 result_ok: o.result_ok,
1636 impl Clone for CResult_BlindedPayInfoDecodeErrorZ {
1637 fn clone(&self) -> Self {
1639 Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1640 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::BlindedPayInfo>::clone(unsafe { &*self.contents.result })))
1643 Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1644 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1650 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
1651 /// but with all dynamically-allocated buffers duplicated in new buffers.
1652 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) }
1654 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
1655 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1656 /// A pointer to the contents in the success state.
1657 /// Reading from this pointer when `result_ok` is not set is undefined.
1658 pub result: *mut crate::lightning::sign::DelayedPaymentOutputDescriptor,
1659 /// A pointer to the contents in the error state.
1660 /// Reading from this pointer when `result_ok` is set is undefined.
1661 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1664 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1665 /// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1666 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1667 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1668 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
1669 /// `err` or `result` depending on the state of `result_ok`.
1670 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
1671 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
1672 pub result_ok: bool,
1675 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
1676 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1677 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1678 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1679 result: Box::into_raw(Box::new(o)),
1685 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
1686 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1687 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1688 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1689 err: Box::into_raw(Box::new(e)),
1694 /// Checks if the given object is currently in the success state
1696 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
1700 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
1701 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
1702 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1703 fn drop(&mut self) {
1705 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1706 let _ = unsafe { Box::from_raw(self.contents.result) };
1709 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1710 let _ = unsafe { Box::from_raw(self.contents.err) };
1715 impl From<crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1716 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1717 let contents = if o.result_ok {
1718 let result = unsafe { o.contents.result };
1719 unsafe { o.contents.result = core::ptr::null_mut() };
1720 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
1722 let err = unsafe { o.contents.err };
1723 unsafe { o.contents.err = core::ptr::null_mut(); }
1724 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
1728 result_ok: o.result_ok,
1732 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1733 fn clone(&self) -> Self {
1735 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1736 result: Box::into_raw(Box::new(<crate::lightning::sign::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1739 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1740 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1746 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1747 /// but with all dynamically-allocated buffers duplicated in new buffers.
1748 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1750 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
1751 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1752 /// A pointer to the contents in the success state.
1753 /// Reading from this pointer when `result_ok` is not set is undefined.
1754 pub result: *mut crate::lightning::sign::StaticPaymentOutputDescriptor,
1755 /// A pointer to the contents in the error state.
1756 /// Reading from this pointer when `result_ok` is set is undefined.
1757 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1760 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1761 /// containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1762 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1763 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1764 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
1765 /// `err` or `result` depending on the state of `result_ok`.
1766 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
1767 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
1768 pub result_ok: bool,
1771 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
1772 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1773 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1774 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1775 result: Box::into_raw(Box::new(o)),
1781 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
1782 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1783 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1784 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1785 err: Box::into_raw(Box::new(e)),
1790 /// Checks if the given object is currently in the success state
1792 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
1796 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
1797 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
1798 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1799 fn drop(&mut self) {
1801 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1802 let _ = unsafe { Box::from_raw(self.contents.result) };
1805 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1806 let _ = unsafe { Box::from_raw(self.contents.err) };
1811 impl From<crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1812 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1813 let contents = if o.result_ok {
1814 let result = unsafe { o.contents.result };
1815 unsafe { o.contents.result = core::ptr::null_mut() };
1816 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
1818 let err = unsafe { o.contents.err };
1819 unsafe { o.contents.err = core::ptr::null_mut(); }
1820 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
1824 result_ok: o.result_ok,
1828 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1829 fn clone(&self) -> Self {
1831 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1832 result: Box::into_raw(Box::new(<crate::lightning::sign::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1835 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1836 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1842 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1843 /// but with all dynamically-allocated buffers duplicated in new buffers.
1844 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1846 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
1847 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1848 /// A pointer to the contents in the success state.
1849 /// Reading from this pointer when `result_ok` is not set is undefined.
1850 pub result: *mut crate::lightning::sign::SpendableOutputDescriptor,
1851 /// A pointer to the contents in the error state.
1852 /// Reading from this pointer when `result_ok` is set is undefined.
1853 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1856 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1857 /// containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1858 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1859 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
1860 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
1861 /// `err` or `result` depending on the state of `result_ok`.
1862 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
1863 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
1864 pub result_ok: bool,
1867 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
1868 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1869 CResult_SpendableOutputDescriptorDecodeErrorZ {
1870 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1871 result: Box::into_raw(Box::new(o)),
1877 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
1878 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1879 CResult_SpendableOutputDescriptorDecodeErrorZ {
1880 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1881 err: Box::into_raw(Box::new(e)),
1886 /// Checks if the given object is currently in the success state
1888 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
1892 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
1893 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
1894 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
1895 fn drop(&mut self) {
1897 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1898 let _ = unsafe { Box::from_raw(self.contents.result) };
1901 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1902 let _ = unsafe { Box::from_raw(self.contents.err) };
1907 impl From<crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
1908 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1909 let contents = if o.result_ok {
1910 let result = unsafe { o.contents.result };
1911 unsafe { o.contents.result = core::ptr::null_mut() };
1912 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
1914 let err = unsafe { o.contents.err };
1915 unsafe { o.contents.err = core::ptr::null_mut(); }
1916 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
1920 result_ok: o.result_ok,
1924 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
1925 fn clone(&self) -> Self {
1927 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1928 result: Box::into_raw(Box::new(<crate::lightning::sign::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1931 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1932 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1938 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
1939 /// but with all dynamically-allocated buffers duplicated in new buffers.
1940 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1942 /// A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size.
1943 /// This corresponds to std::vector in C++
1944 pub struct CVec_SpendableOutputDescriptorZ {
1945 /// The elements in the array.
1946 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1947 pub data: *mut crate::lightning::sign::SpendableOutputDescriptor,
1948 /// The number of elements pointed to by `data`.
1951 impl CVec_SpendableOutputDescriptorZ {
1952 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::SpendableOutputDescriptor> {
1953 if self.datalen == 0 { return Vec::new(); }
1954 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1955 self.data = core::ptr::null_mut();
1959 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::SpendableOutputDescriptor] {
1960 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1963 impl From<Vec<crate::lightning::sign::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
1964 fn from(v: Vec<crate::lightning::sign::SpendableOutputDescriptor>) -> Self {
1965 let datalen = v.len();
1966 let data = Box::into_raw(v.into_boxed_slice());
1967 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1971 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1972 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
1973 impl Drop for CVec_SpendableOutputDescriptorZ {
1974 fn drop(&mut self) {
1975 if self.datalen == 0 { return; }
1976 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1979 impl Clone for CVec_SpendableOutputDescriptorZ {
1980 fn clone(&self) -> Self {
1981 let mut res = Vec::new();
1982 if self.datalen == 0 { return Self::from(res); }
1983 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1988 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
1989 /// This corresponds to std::vector in C++
1990 pub struct CVec_TxOutZ {
1991 /// The elements in the array.
1992 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1993 pub data: *mut crate::c_types::TxOut,
1994 /// The number of elements pointed to by `data`.
1998 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
1999 if self.datalen == 0 { return Vec::new(); }
2000 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2001 self.data = core::ptr::null_mut();
2005 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
2006 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2009 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
2010 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
2011 let datalen = v.len();
2012 let data = Box::into_raw(v.into_boxed_slice());
2013 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2017 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2018 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
2019 impl Drop for CVec_TxOutZ {
2020 fn drop(&mut self) {
2021 if self.datalen == 0 { return; }
2022 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2025 impl Clone for CVec_TxOutZ {
2026 fn clone(&self) -> Self {
2027 let mut res = Vec::new();
2028 if self.datalen == 0 { return Self::from(res); }
2029 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2035 /// An enum which can either contain a u32 or not
2036 pub enum COption_u32Z {
2037 /// When we're in this state, this COption_u32Z contains a u32
2039 /// When we're in this state, this COption_u32Z contains nothing
2043 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2044 if let Self::None = self { false } else { true }
2046 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2049 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
2050 if let Self::Some(v) = self { v } else { unreachable!() }
2054 /// Constructs a new COption_u32Z containing a u32
2055 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
2056 COption_u32Z::Some(o)
2059 /// Constructs a new COption_u32Z containing nothing
2060 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
2064 /// Frees any resources associated with the u32, if we are in the Some state
2065 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
2067 /// Creates a new COption_u32Z which has the same data as `orig`
2068 /// but with all dynamically-allocated buffers duplicated in new buffers.
2069 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
2071 /// A tuple of 2 elements. See the individual fields for the types contained.
2072 pub struct C2Tuple_CVec_u8Zu64Z {
2073 /// The element at position 0
2074 pub a: crate::c_types::derived::CVec_u8Z,
2075 /// The element at position 1
2078 impl From<(crate::c_types::derived::CVec_u8Z, u64)> for C2Tuple_CVec_u8Zu64Z {
2079 fn from (tup: (crate::c_types::derived::CVec_u8Z, u64)) -> Self {
2086 impl C2Tuple_CVec_u8Zu64Z {
2087 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, u64) {
2091 impl Clone for C2Tuple_CVec_u8Zu64Z {
2092 fn clone(&self) -> Self {
2094 a: Clone::clone(&self.a),
2095 b: Clone::clone(&self.b),
2100 /// Creates a new tuple which has the same data as `orig`
2101 /// but with all dynamically-allocated buffers duplicated in new buffers.
2102 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_clone(orig: &C2Tuple_CVec_u8Zu64Z) -> C2Tuple_CVec_u8Zu64Z { Clone::clone(&orig) }
2103 /// Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements.
2105 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_new(a: crate::c_types::derived::CVec_u8Z, b: u64) -> C2Tuple_CVec_u8Zu64Z {
2106 C2Tuple_CVec_u8Zu64Z { a, b, }
2110 /// Frees any resources used by the C2Tuple_CVec_u8Zu64Z.
2111 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_free(_res: C2Tuple_CVec_u8Zu64Z) { }
2113 /// The contents of CResult_C2Tuple_CVec_u8Zu64ZNoneZ
2114 pub union CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2115 /// A pointer to the contents in the success state.
2116 /// Reading from this pointer when `result_ok` is not set is undefined.
2117 pub result: *mut crate::c_types::derived::C2Tuple_CVec_u8Zu64Z,
2118 /// Note that this value is always NULL, as there are no contents in the Err variant
2119 pub err: *mut core::ffi::c_void,
2122 /// A CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents the result of a fallible operation,
2123 /// containing a crate::c_types::derived::C2Tuple_CVec_u8Zu64Z on success and a () on failure.
2124 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2125 pub struct CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2126 /// The contents of this CResult_C2Tuple_CVec_u8Zu64ZNoneZ, accessible via either
2127 /// `err` or `result` depending on the state of `result_ok`.
2128 pub contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr,
2129 /// Whether this CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents a success state.
2130 pub result_ok: bool,
2133 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state.
2134 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8Zu64Z) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2135 CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2136 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2137 result: Box::into_raw(Box::new(o)),
2143 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state.
2144 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2145 CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2146 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2147 err: core::ptr::null_mut(),
2152 /// Checks if the given object is currently in the success state
2154 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> bool {
2158 /// Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ.
2159 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res: CResult_C2Tuple_CVec_u8Zu64ZNoneZ) { }
2160 impl Drop for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2161 fn drop(&mut self) {
2163 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2164 let _ = unsafe { Box::from_raw(self.contents.result) };
2170 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, ()>> for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2171 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, ()>) -> Self {
2172 let contents = if o.result_ok {
2173 let result = unsafe { o.contents.result };
2174 unsafe { o.contents.result = core::ptr::null_mut() };
2175 CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { result }
2177 let _ = unsafe { Box::from_raw(o.contents.err) };
2178 o.contents.err = core::ptr::null_mut();
2179 CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { err: core::ptr::null_mut() }
2183 result_ok: o.result_ok,
2187 impl Clone for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2188 fn clone(&self) -> Self {
2190 Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2191 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z>::clone(unsafe { &*self.contents.result })))
2194 Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2195 err: core::ptr::null_mut()
2201 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig`
2202 /// but with all dynamically-allocated buffers duplicated in new buffers.
2203 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { Clone::clone(&orig) }
2205 /// The contents of CResult_ChannelDerivationParametersDecodeErrorZ
2206 pub union CResult_ChannelDerivationParametersDecodeErrorZPtr {
2207 /// A pointer to the contents in the success state.
2208 /// Reading from this pointer when `result_ok` is not set is undefined.
2209 pub result: *mut crate::lightning::sign::ChannelDerivationParameters,
2210 /// A pointer to the contents in the error state.
2211 /// Reading from this pointer when `result_ok` is set is undefined.
2212 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2215 /// A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
2216 /// containing a crate::lightning::sign::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2217 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2218 pub struct CResult_ChannelDerivationParametersDecodeErrorZ {
2219 /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
2220 /// `err` or `result` depending on the state of `result_ok`.
2221 pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr,
2222 /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
2223 pub result_ok: bool,
2226 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
2227 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::sign::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ {
2228 CResult_ChannelDerivationParametersDecodeErrorZ {
2229 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2230 result: Box::into_raw(Box::new(o)),
2236 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
2237 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ {
2238 CResult_ChannelDerivationParametersDecodeErrorZ {
2239 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2240 err: Box::into_raw(Box::new(e)),
2245 /// Checks if the given object is currently in the success state
2247 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool {
2251 /// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
2252 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { }
2253 impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ {
2254 fn drop(&mut self) {
2256 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2257 let _ = unsafe { Box::from_raw(self.contents.result) };
2260 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2261 let _ = unsafe { Box::from_raw(self.contents.err) };
2266 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDerivationParametersDecodeErrorZ {
2267 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2268 let contents = if o.result_ok {
2269 let result = unsafe { o.contents.result };
2270 unsafe { o.contents.result = core::ptr::null_mut() };
2271 CResult_ChannelDerivationParametersDecodeErrorZPtr { result }
2273 let err = unsafe { o.contents.err };
2274 unsafe { o.contents.err = core::ptr::null_mut(); }
2275 CResult_ChannelDerivationParametersDecodeErrorZPtr { err }
2279 result_ok: o.result_ok,
2283 impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ {
2284 fn clone(&self) -> Self {
2286 Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2287 result: Box::into_raw(Box::new(<crate::lightning::sign::ChannelDerivationParameters>::clone(unsafe { &*self.contents.result })))
2290 Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2291 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2297 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
2298 /// but with all dynamically-allocated buffers duplicated in new buffers.
2299 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) }
2301 /// The contents of CResult_HTLCDescriptorDecodeErrorZ
2302 pub union CResult_HTLCDescriptorDecodeErrorZPtr {
2303 /// A pointer to the contents in the success state.
2304 /// Reading from this pointer when `result_ok` is not set is undefined.
2305 pub result: *mut crate::lightning::sign::HTLCDescriptor,
2306 /// A pointer to the contents in the error state.
2307 /// Reading from this pointer when `result_ok` is set is undefined.
2308 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2311 /// A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
2312 /// containing a crate::lightning::sign::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2313 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2314 pub struct CResult_HTLCDescriptorDecodeErrorZ {
2315 /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
2316 /// `err` or `result` depending on the state of `result_ok`.
2317 pub contents: CResult_HTLCDescriptorDecodeErrorZPtr,
2318 /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
2319 pub result_ok: bool,
2322 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
2323 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ {
2324 CResult_HTLCDescriptorDecodeErrorZ {
2325 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2326 result: Box::into_raw(Box::new(o)),
2332 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
2333 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ {
2334 CResult_HTLCDescriptorDecodeErrorZ {
2335 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2336 err: Box::into_raw(Box::new(e)),
2341 /// Checks if the given object is currently in the success state
2343 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool {
2347 /// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
2348 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { }
2349 impl Drop for CResult_HTLCDescriptorDecodeErrorZ {
2350 fn drop(&mut self) {
2352 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2353 let _ = unsafe { Box::from_raw(self.contents.result) };
2356 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2357 let _ = unsafe { Box::from_raw(self.contents.err) };
2362 impl From<crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCDescriptorDecodeErrorZ {
2363 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2364 let contents = if o.result_ok {
2365 let result = unsafe { o.contents.result };
2366 unsafe { o.contents.result = core::ptr::null_mut() };
2367 CResult_HTLCDescriptorDecodeErrorZPtr { result }
2369 let err = unsafe { o.contents.err };
2370 unsafe { o.contents.err = core::ptr::null_mut(); }
2371 CResult_HTLCDescriptorDecodeErrorZPtr { err }
2375 result_ok: o.result_ok,
2379 impl Clone for CResult_HTLCDescriptorDecodeErrorZ {
2380 fn clone(&self) -> Self {
2382 Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2383 result: Box::into_raw(Box::new(<crate::lightning::sign::HTLCDescriptor>::clone(unsafe { &*self.contents.result })))
2386 Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2387 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2393 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
2394 /// but with all dynamically-allocated buffers duplicated in new buffers.
2395 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) }
2397 /// The contents of CResult_NoneNoneZ
2398 pub union CResult_NoneNoneZPtr {
2399 /// Note that this value is always NULL, as there are no contents in the OK variant
2400 pub result: *mut core::ffi::c_void,
2401 /// Note that this value is always NULL, as there are no contents in the Err variant
2402 pub err: *mut core::ffi::c_void,
2405 /// A CResult_NoneNoneZ represents the result of a fallible operation,
2406 /// containing a () on success and a () on failure.
2407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2408 pub struct CResult_NoneNoneZ {
2409 /// The contents of this CResult_NoneNoneZ, accessible via either
2410 /// `err` or `result` depending on the state of `result_ok`.
2411 pub contents: CResult_NoneNoneZPtr,
2412 /// Whether this CResult_NoneNoneZ represents a success state.
2413 pub result_ok: bool,
2416 /// Creates a new CResult_NoneNoneZ in the success state.
2417 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
2419 contents: CResult_NoneNoneZPtr {
2420 result: core::ptr::null_mut(),
2426 /// Creates a new CResult_NoneNoneZ in the error state.
2427 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
2429 contents: CResult_NoneNoneZPtr {
2430 err: core::ptr::null_mut(),
2435 /// Checks if the given object is currently in the success state
2437 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
2441 /// Frees any resources used by the CResult_NoneNoneZ.
2442 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
2443 impl Drop for CResult_NoneNoneZ {
2444 fn drop(&mut self) {
2450 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
2451 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
2452 let contents = if o.result_ok {
2453 let _ = unsafe { Box::from_raw(o.contents.result) };
2454 o.contents.result = core::ptr::null_mut();
2455 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
2457 let _ = unsafe { Box::from_raw(o.contents.err) };
2458 o.contents.err = core::ptr::null_mut();
2459 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
2463 result_ok: o.result_ok,
2467 impl Clone for CResult_NoneNoneZ {
2468 fn clone(&self) -> Self {
2470 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
2471 result: core::ptr::null_mut()
2474 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
2475 err: core::ptr::null_mut()
2481 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
2482 /// but with all dynamically-allocated buffers duplicated in new buffers.
2483 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
2485 /// The contents of CResult_PublicKeyNoneZ
2486 pub union CResult_PublicKeyNoneZPtr {
2487 /// A pointer to the contents in the success state.
2488 /// Reading from this pointer when `result_ok` is not set is undefined.
2489 pub result: *mut crate::c_types::PublicKey,
2490 /// Note that this value is always NULL, as there are no contents in the Err variant
2491 pub err: *mut core::ffi::c_void,
2494 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
2495 /// containing a crate::c_types::PublicKey on success and a () on failure.
2496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2497 pub struct CResult_PublicKeyNoneZ {
2498 /// The contents of this CResult_PublicKeyNoneZ, accessible via either
2499 /// `err` or `result` depending on the state of `result_ok`.
2500 pub contents: CResult_PublicKeyNoneZPtr,
2501 /// Whether this CResult_PublicKeyNoneZ represents a success state.
2502 pub result_ok: bool,
2505 /// Creates a new CResult_PublicKeyNoneZ in the success state.
2506 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
2507 CResult_PublicKeyNoneZ {
2508 contents: CResult_PublicKeyNoneZPtr {
2509 result: Box::into_raw(Box::new(o)),
2515 /// Creates a new CResult_PublicKeyNoneZ in the error state.
2516 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
2517 CResult_PublicKeyNoneZ {
2518 contents: CResult_PublicKeyNoneZPtr {
2519 err: core::ptr::null_mut(),
2524 /// Checks if the given object is currently in the success state
2526 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
2530 /// Frees any resources used by the CResult_PublicKeyNoneZ.
2531 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
2532 impl Drop for CResult_PublicKeyNoneZ {
2533 fn drop(&mut self) {
2535 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2536 let _ = unsafe { Box::from_raw(self.contents.result) };
2542 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
2543 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
2544 let contents = if o.result_ok {
2545 let result = unsafe { o.contents.result };
2546 unsafe { o.contents.result = core::ptr::null_mut() };
2547 CResult_PublicKeyNoneZPtr { result }
2549 let _ = unsafe { Box::from_raw(o.contents.err) };
2550 o.contents.err = core::ptr::null_mut();
2551 CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
2555 result_ok: o.result_ok,
2559 impl Clone for CResult_PublicKeyNoneZ {
2560 fn clone(&self) -> Self {
2562 Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
2563 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
2566 Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
2567 err: core::ptr::null_mut()
2573 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
2574 /// but with all dynamically-allocated buffers duplicated in new buffers.
2575 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
2578 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
2579 pub enum COption_BigEndianScalarZ {
2580 /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar
2581 Some(crate::c_types::BigEndianScalar),
2582 /// When we're in this state, this COption_BigEndianScalarZ contains nothing
2585 impl COption_BigEndianScalarZ {
2586 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2587 if let Self::None = self { false } else { true }
2589 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2592 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
2593 if let Self::Some(v) = self { v } else { unreachable!() }
2597 /// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar
2598 pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ {
2599 COption_BigEndianScalarZ::Some(o)
2602 /// Constructs a new COption_BigEndianScalarZ containing nothing
2603 pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ {
2604 COption_BigEndianScalarZ::None
2607 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
2608 pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { }
2610 /// Creates a new COption_BigEndianScalarZ which has the same data as `orig`
2611 /// but with all dynamically-allocated buffers duplicated in new buffers.
2612 pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) }
2614 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2615 /// This corresponds to std::vector in C++
2616 pub struct CVec_U5Z {
2617 /// The elements in the array.
2618 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2619 pub data: *mut crate::c_types::U5,
2620 /// The number of elements pointed to by `data`.
2624 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
2625 if self.datalen == 0 { return Vec::new(); }
2626 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2627 self.data = core::ptr::null_mut();
2631 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
2632 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2635 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
2636 fn from(v: Vec<crate::c_types::U5>) -> Self {
2637 let datalen = v.len();
2638 let data = Box::into_raw(v.into_boxed_slice());
2639 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2643 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2644 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
2645 impl Drop for CVec_U5Z {
2646 fn drop(&mut self) {
2647 if self.datalen == 0 { return; }
2648 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2651 impl Clone for CVec_U5Z {
2652 fn clone(&self) -> Self {
2653 let mut res = Vec::new();
2654 if self.datalen == 0 { return Self::from(res); }
2655 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2660 /// The contents of CResult_RecoverableSignatureNoneZ
2661 pub union CResult_RecoverableSignatureNoneZPtr {
2662 /// A pointer to the contents in the success state.
2663 /// Reading from this pointer when `result_ok` is not set is undefined.
2664 pub result: *mut crate::c_types::RecoverableSignature,
2665 /// Note that this value is always NULL, as there are no contents in the Err variant
2666 pub err: *mut core::ffi::c_void,
2669 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2670 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
2671 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2672 pub struct CResult_RecoverableSignatureNoneZ {
2673 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2674 /// `err` or `result` depending on the state of `result_ok`.
2675 pub contents: CResult_RecoverableSignatureNoneZPtr,
2676 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
2677 pub result_ok: bool,
2680 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
2681 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
2682 CResult_RecoverableSignatureNoneZ {
2683 contents: CResult_RecoverableSignatureNoneZPtr {
2684 result: Box::into_raw(Box::new(o)),
2690 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
2691 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
2692 CResult_RecoverableSignatureNoneZ {
2693 contents: CResult_RecoverableSignatureNoneZPtr {
2694 err: core::ptr::null_mut(),
2699 /// Checks if the given object is currently in the success state
2701 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
2705 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
2706 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
2707 impl Drop for CResult_RecoverableSignatureNoneZ {
2708 fn drop(&mut self) {
2710 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2711 let _ = unsafe { Box::from_raw(self.contents.result) };
2717 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2718 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2719 let contents = if o.result_ok {
2720 let result = unsafe { o.contents.result };
2721 unsafe { o.contents.result = core::ptr::null_mut() };
2722 CResult_RecoverableSignatureNoneZPtr { result }
2724 let _ = unsafe { Box::from_raw(o.contents.err) };
2725 o.contents.err = core::ptr::null_mut();
2726 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2730 result_ok: o.result_ok,
2734 impl Clone for CResult_RecoverableSignatureNoneZ {
2735 fn clone(&self) -> Self {
2737 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2738 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2741 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2742 err: core::ptr::null_mut()
2748 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2749 /// but with all dynamically-allocated buffers duplicated in new buffers.
2750 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2752 /// The contents of CResult_ECDSASignatureNoneZ
2753 pub union CResult_ECDSASignatureNoneZPtr {
2754 /// A pointer to the contents in the success state.
2755 /// Reading from this pointer when `result_ok` is not set is undefined.
2756 pub result: *mut crate::c_types::ECDSASignature,
2757 /// Note that this value is always NULL, as there are no contents in the Err variant
2758 pub err: *mut core::ffi::c_void,
2761 /// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation,
2762 /// containing a crate::c_types::ECDSASignature on success and a () on failure.
2763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2764 pub struct CResult_ECDSASignatureNoneZ {
2765 /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either
2766 /// `err` or `result` depending on the state of `result_ok`.
2767 pub contents: CResult_ECDSASignatureNoneZPtr,
2768 /// Whether this CResult_ECDSASignatureNoneZ represents a success state.
2769 pub result_ok: bool,
2772 /// Creates a new CResult_ECDSASignatureNoneZ in the success state.
2773 pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ {
2774 CResult_ECDSASignatureNoneZ {
2775 contents: CResult_ECDSASignatureNoneZPtr {
2776 result: Box::into_raw(Box::new(o)),
2782 /// Creates a new CResult_ECDSASignatureNoneZ in the error state.
2783 pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ {
2784 CResult_ECDSASignatureNoneZ {
2785 contents: CResult_ECDSASignatureNoneZPtr {
2786 err: core::ptr::null_mut(),
2791 /// Checks if the given object is currently in the success state
2793 pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool {
2797 /// Frees any resources used by the CResult_ECDSASignatureNoneZ.
2798 pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { }
2799 impl Drop for CResult_ECDSASignatureNoneZ {
2800 fn drop(&mut self) {
2802 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2803 let _ = unsafe { Box::from_raw(self.contents.result) };
2809 impl From<crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>> for CResult_ECDSASignatureNoneZ {
2810 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>) -> Self {
2811 let contents = if o.result_ok {
2812 let result = unsafe { o.contents.result };
2813 unsafe { o.contents.result = core::ptr::null_mut() };
2814 CResult_ECDSASignatureNoneZPtr { result }
2816 let _ = unsafe { Box::from_raw(o.contents.err) };
2817 o.contents.err = core::ptr::null_mut();
2818 CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() }
2822 result_ok: o.result_ok,
2826 impl Clone for CResult_ECDSASignatureNoneZ {
2827 fn clone(&self) -> Self {
2829 Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr {
2830 result: Box::into_raw(Box::new(<crate::c_types::ECDSASignature>::clone(unsafe { &*self.contents.result })))
2833 Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr {
2834 err: core::ptr::null_mut()
2840 /// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig`
2841 /// but with all dynamically-allocated buffers duplicated in new buffers.
2842 pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) }
2844 /// The contents of CResult_TransactionNoneZ
2845 pub union CResult_TransactionNoneZPtr {
2846 /// A pointer to the contents in the success state.
2847 /// Reading from this pointer when `result_ok` is not set is undefined.
2848 pub result: *mut crate::c_types::Transaction,
2849 /// Note that this value is always NULL, as there are no contents in the Err variant
2850 pub err: *mut core::ffi::c_void,
2853 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
2854 /// containing a crate::c_types::Transaction on success and a () on failure.
2855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2856 pub struct CResult_TransactionNoneZ {
2857 /// The contents of this CResult_TransactionNoneZ, accessible via either
2858 /// `err` or `result` depending on the state of `result_ok`.
2859 pub contents: CResult_TransactionNoneZPtr,
2860 /// Whether this CResult_TransactionNoneZ represents a success state.
2861 pub result_ok: bool,
2864 /// Creates a new CResult_TransactionNoneZ in the success state.
2865 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
2866 CResult_TransactionNoneZ {
2867 contents: CResult_TransactionNoneZPtr {
2868 result: Box::into_raw(Box::new(o)),
2874 /// Creates a new CResult_TransactionNoneZ in the error state.
2875 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
2876 CResult_TransactionNoneZ {
2877 contents: CResult_TransactionNoneZPtr {
2878 err: core::ptr::null_mut(),
2883 /// Checks if the given object is currently in the success state
2885 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
2889 /// Frees any resources used by the CResult_TransactionNoneZ.
2890 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
2891 impl Drop for CResult_TransactionNoneZ {
2892 fn drop(&mut self) {
2894 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2895 let _ = unsafe { Box::from_raw(self.contents.result) };
2901 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
2902 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
2903 let contents = if o.result_ok {
2904 let result = unsafe { o.contents.result };
2905 unsafe { o.contents.result = core::ptr::null_mut() };
2906 CResult_TransactionNoneZPtr { result }
2908 let _ = unsafe { Box::from_raw(o.contents.err) };
2909 o.contents.err = core::ptr::null_mut();
2910 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
2914 result_ok: o.result_ok,
2918 impl Clone for CResult_TransactionNoneZ {
2919 fn clone(&self) -> Self {
2921 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
2922 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
2925 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
2926 err: core::ptr::null_mut()
2932 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
2933 /// but with all dynamically-allocated buffers duplicated in new buffers.
2934 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
2936 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2937 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2938 /// A pointer to the contents in the success state.
2939 /// Reading from this pointer when `result_ok` is not set is undefined.
2940 pub result: *mut crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner,
2941 /// A pointer to the contents in the error state.
2942 /// Reading from this pointer when `result_ok` is set is undefined.
2943 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2946 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2947 /// containing a crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2948 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2949 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2950 /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2951 /// `err` or `result` depending on the state of `result_ok`.
2952 pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2953 /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2954 pub result_ok: bool,
2957 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2958 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2959 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2960 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2961 result: Box::into_raw(Box::new(o)),
2967 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
2968 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2969 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2970 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2971 err: Box::into_raw(Box::new(e)),
2976 /// Checks if the given object is currently in the success state
2978 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
2982 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
2983 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
2984 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2985 fn drop(&mut self) {
2987 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2988 let _ = unsafe { Box::from_raw(self.contents.result) };
2991 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2992 let _ = unsafe { Box::from_raw(self.contents.err) };
2997 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2998 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
2999 let contents = if o.result_ok {
3000 let result = unsafe { o.contents.result };
3001 unsafe { o.contents.result = core::ptr::null_mut() };
3002 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
3004 let err = unsafe { o.contents.err };
3005 unsafe { o.contents.err = core::ptr::null_mut(); }
3006 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
3010 result_ok: o.result_ok,
3014 impl Clone for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3015 fn clone(&self) -> Self {
3017 Self { result_ok: true, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
3018 result: Box::into_raw(Box::new(<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner>::clone(unsafe { &*self.contents.result })))
3021 Self { result_ok: false, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
3022 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3028 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig`
3029 /// but with all dynamically-allocated buffers duplicated in new buffers.
3030 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) }
3032 /// The contents of CResult_CVec_u8ZNoneZ
3033 pub union CResult_CVec_u8ZNoneZPtr {
3034 /// A pointer to the contents in the success state.
3035 /// Reading from this pointer when `result_ok` is not set is undefined.
3036 pub result: *mut crate::c_types::derived::CVec_u8Z,
3037 /// Note that this value is always NULL, as there are no contents in the Err variant
3038 pub err: *mut core::ffi::c_void,
3041 /// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation,
3042 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
3043 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3044 pub struct CResult_CVec_u8ZNoneZ {
3045 /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either
3046 /// `err` or `result` depending on the state of `result_ok`.
3047 pub contents: CResult_CVec_u8ZNoneZPtr,
3048 /// Whether this CResult_CVec_u8ZNoneZ represents a success state.
3049 pub result_ok: bool,
3052 /// Creates a new CResult_CVec_u8ZNoneZ in the success state.
3053 pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ {
3054 CResult_CVec_u8ZNoneZ {
3055 contents: CResult_CVec_u8ZNoneZPtr {
3056 result: Box::into_raw(Box::new(o)),
3062 /// Creates a new CResult_CVec_u8ZNoneZ in the error state.
3063 pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ {
3064 CResult_CVec_u8ZNoneZ {
3065 contents: CResult_CVec_u8ZNoneZPtr {
3066 err: core::ptr::null_mut(),
3071 /// Checks if the given object is currently in the success state
3073 pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool {
3077 /// Frees any resources used by the CResult_CVec_u8ZNoneZ.
3078 pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { }
3079 impl Drop for CResult_CVec_u8ZNoneZ {
3080 fn drop(&mut self) {
3082 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3083 let _ = unsafe { Box::from_raw(self.contents.result) };
3089 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_CVec_u8ZNoneZ {
3090 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
3091 let contents = if o.result_ok {
3092 let result = unsafe { o.contents.result };
3093 unsafe { o.contents.result = core::ptr::null_mut() };
3094 CResult_CVec_u8ZNoneZPtr { result }
3096 let _ = unsafe { Box::from_raw(o.contents.err) };
3097 o.contents.err = core::ptr::null_mut();
3098 CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() }
3102 result_ok: o.result_ok,
3106 impl Clone for CResult_CVec_u8ZNoneZ {
3107 fn clone(&self) -> Self {
3109 Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr {
3110 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
3113 Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr {
3114 err: core::ptr::null_mut()
3120 /// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig`
3121 /// but with all dynamically-allocated buffers duplicated in new buffers.
3122 pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) }
3124 /// The contents of CResult_ShutdownScriptNoneZ
3125 pub union CResult_ShutdownScriptNoneZPtr {
3126 /// A pointer to the contents in the success state.
3127 /// Reading from this pointer when `result_ok` is not set is undefined.
3128 pub result: *mut crate::lightning::ln::script::ShutdownScript,
3129 /// Note that this value is always NULL, as there are no contents in the Err variant
3130 pub err: *mut core::ffi::c_void,
3133 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
3134 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
3135 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3136 pub struct CResult_ShutdownScriptNoneZ {
3137 /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
3138 /// `err` or `result` depending on the state of `result_ok`.
3139 pub contents: CResult_ShutdownScriptNoneZPtr,
3140 /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
3141 pub result_ok: bool,
3144 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
3145 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
3146 CResult_ShutdownScriptNoneZ {
3147 contents: CResult_ShutdownScriptNoneZPtr {
3148 result: Box::into_raw(Box::new(o)),
3154 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
3155 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
3156 CResult_ShutdownScriptNoneZ {
3157 contents: CResult_ShutdownScriptNoneZPtr {
3158 err: core::ptr::null_mut(),
3163 /// Checks if the given object is currently in the success state
3165 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
3169 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
3170 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
3171 impl Drop for CResult_ShutdownScriptNoneZ {
3172 fn drop(&mut self) {
3174 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3175 let _ = unsafe { Box::from_raw(self.contents.result) };
3181 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
3182 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
3183 let contents = if o.result_ok {
3184 let result = unsafe { o.contents.result };
3185 unsafe { o.contents.result = core::ptr::null_mut() };
3186 CResult_ShutdownScriptNoneZPtr { result }
3188 let _ = unsafe { Box::from_raw(o.contents.err) };
3189 o.contents.err = core::ptr::null_mut();
3190 CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
3194 result_ok: o.result_ok,
3198 impl Clone for CResult_ShutdownScriptNoneZ {
3199 fn clone(&self) -> Self {
3201 Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
3202 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
3205 Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
3206 err: core::ptr::null_mut()
3212 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
3213 /// but with all dynamically-allocated buffers duplicated in new buffers.
3214 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
3217 /// An enum which can either contain a u16 or not
3218 pub enum COption_u16Z {
3219 /// When we're in this state, this COption_u16Z contains a u16
3221 /// When we're in this state, this COption_u16Z contains nothing
3225 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3226 if let Self::None = self { false } else { true }
3228 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3231 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
3232 if let Self::Some(v) = self { v } else { unreachable!() }
3236 /// Constructs a new COption_u16Z containing a u16
3237 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
3238 COption_u16Z::Some(o)
3241 /// Constructs a new COption_u16Z containing nothing
3242 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
3246 /// Frees any resources associated with the u16, if we are in the Some state
3247 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
3249 /// Creates a new COption_u16Z which has the same data as `orig`
3250 /// but with all dynamically-allocated buffers duplicated in new buffers.
3251 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
3254 /// An enum which can either contain a bool or not
3255 pub enum COption_boolZ {
3256 /// When we're in this state, this COption_boolZ contains a bool
3258 /// When we're in this state, this COption_boolZ contains nothing
3261 impl COption_boolZ {
3262 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3263 if let Self::None = self { false } else { true }
3265 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3268 #[allow(unused)] pub(crate) fn take(mut self) -> bool {
3269 if let Self::Some(v) = self { v } else { unreachable!() }
3273 /// Constructs a new COption_boolZ containing a bool
3274 pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ {
3275 COption_boolZ::Some(o)
3278 /// Constructs a new COption_boolZ containing nothing
3279 pub extern "C" fn COption_boolZ_none() -> COption_boolZ {
3283 /// Frees any resources associated with the bool, if we are in the Some state
3284 pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { }
3286 /// Creates a new COption_boolZ which has the same data as `orig`
3287 /// but with all dynamically-allocated buffers duplicated in new buffers.
3288 pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) }
3290 /// The contents of CResult_WitnessNoneZ
3291 pub union CResult_WitnessNoneZPtr {
3292 /// A pointer to the contents in the success state.
3293 /// Reading from this pointer when `result_ok` is not set is undefined.
3294 pub result: *mut crate::c_types::Witness,
3295 /// Note that this value is always NULL, as there are no contents in the Err variant
3296 pub err: *mut core::ffi::c_void,
3299 /// A CResult_WitnessNoneZ represents the result of a fallible operation,
3300 /// containing a crate::c_types::Witness on success and a () on failure.
3301 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3302 pub struct CResult_WitnessNoneZ {
3303 /// The contents of this CResult_WitnessNoneZ, accessible via either
3304 /// `err` or `result` depending on the state of `result_ok`.
3305 pub contents: CResult_WitnessNoneZPtr,
3306 /// Whether this CResult_WitnessNoneZ represents a success state.
3307 pub result_ok: bool,
3310 /// Creates a new CResult_WitnessNoneZ in the success state.
3311 pub extern "C" fn CResult_WitnessNoneZ_ok(o: crate::c_types::Witness) -> CResult_WitnessNoneZ {
3312 CResult_WitnessNoneZ {
3313 contents: CResult_WitnessNoneZPtr {
3314 result: Box::into_raw(Box::new(o)),
3320 /// Creates a new CResult_WitnessNoneZ in the error state.
3321 pub extern "C" fn CResult_WitnessNoneZ_err() -> CResult_WitnessNoneZ {
3322 CResult_WitnessNoneZ {
3323 contents: CResult_WitnessNoneZPtr {
3324 err: core::ptr::null_mut(),
3329 /// Checks if the given object is currently in the success state
3331 pub extern "C" fn CResult_WitnessNoneZ_is_ok(o: &CResult_WitnessNoneZ) -> bool {
3335 /// Frees any resources used by the CResult_WitnessNoneZ.
3336 pub extern "C" fn CResult_WitnessNoneZ_free(_res: CResult_WitnessNoneZ) { }
3337 impl Drop for CResult_WitnessNoneZ {
3338 fn drop(&mut self) {
3340 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3341 let _ = unsafe { Box::from_raw(self.contents.result) };
3347 impl From<crate::c_types::CResultTempl<crate::c_types::Witness, ()>> for CResult_WitnessNoneZ {
3348 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Witness, ()>) -> Self {
3349 let contents = if o.result_ok {
3350 let result = unsafe { o.contents.result };
3351 unsafe { o.contents.result = core::ptr::null_mut() };
3352 CResult_WitnessNoneZPtr { result }
3354 let _ = unsafe { Box::from_raw(o.contents.err) };
3355 o.contents.err = core::ptr::null_mut();
3356 CResult_WitnessNoneZPtr { err: core::ptr::null_mut() }
3360 result_ok: o.result_ok,
3364 impl Clone for CResult_WitnessNoneZ {
3365 fn clone(&self) -> Self {
3367 Self { result_ok: true, contents: CResult_WitnessNoneZPtr {
3368 result: Box::into_raw(Box::new(<crate::c_types::Witness>::clone(unsafe { &*self.contents.result })))
3371 Self { result_ok: false, contents: CResult_WitnessNoneZPtr {
3372 err: core::ptr::null_mut()
3378 /// Creates a new CResult_WitnessNoneZ which has the same data as `orig`
3379 /// but with all dynamically-allocated buffers duplicated in new buffers.
3380 pub extern "C" fn CResult_WitnessNoneZ_clone(orig: &CResult_WitnessNoneZ) -> CResult_WitnessNoneZ { Clone::clone(&orig) }
3382 /// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size.
3383 /// This corresponds to std::vector in C++
3384 pub struct CVec_ECDSASignatureZ {
3385 /// The elements in the array.
3386 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3387 pub data: *mut crate::c_types::ECDSASignature,
3388 /// The number of elements pointed to by `data`.
3391 impl CVec_ECDSASignatureZ {
3392 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ECDSASignature> {
3393 if self.datalen == 0 { return Vec::new(); }
3394 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3395 self.data = core::ptr::null_mut();
3399 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] {
3400 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3403 impl From<Vec<crate::c_types::ECDSASignature>> for CVec_ECDSASignatureZ {
3404 fn from(v: Vec<crate::c_types::ECDSASignature>) -> Self {
3405 let datalen = v.len();
3406 let data = Box::into_raw(v.into_boxed_slice());
3407 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3411 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3412 pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { }
3413 impl Drop for CVec_ECDSASignatureZ {
3414 fn drop(&mut self) {
3415 if self.datalen == 0 { return; }
3416 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3419 impl Clone for CVec_ECDSASignatureZ {
3420 fn clone(&self) -> Self {
3421 let mut res = Vec::new();
3422 if self.datalen == 0 { return Self::from(res); }
3423 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3428 /// A tuple of 2 elements. See the individual fields for the types contained.
3429 pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3430 /// The element at position 0
3431 pub a: crate::c_types::ECDSASignature,
3432 /// The element at position 1
3433 pub b: crate::c_types::derived::CVec_ECDSASignatureZ,
3435 impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3436 fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self {
3443 impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3444 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) {
3448 impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3449 fn clone(&self) -> Self {
3451 a: Clone::clone(&self.a),
3452 b: Clone::clone(&self.b),
3457 /// Creates a new tuple which has the same data as `orig`
3458 /// but with all dynamically-allocated buffers duplicated in new buffers.
3459 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) }
3460 /// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements.
3462 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3463 C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, }
3467 /// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ.
3468 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { }
3470 /// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ
3471 pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3472 /// A pointer to the contents in the success state.
3473 /// Reading from this pointer when `result_ok` is not set is undefined.
3474 pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ,
3475 /// Note that this value is always NULL, as there are no contents in the Err variant
3476 pub err: *mut core::ffi::c_void,
3479 /// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation,
3480 /// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure.
3481 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3482 pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3483 /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either
3484 /// `err` or `result` depending on the state of `result_ok`.
3485 pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr,
3486 /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state.
3487 pub result_ok: bool,
3490 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state.
3491 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3492 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3493 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3494 result: Box::into_raw(Box::new(o)),
3500 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state.
3501 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3502 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3503 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3504 err: core::ptr::null_mut(),
3509 /// Checks if the given object is currently in the success state
3511 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool {
3515 /// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.
3516 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { }
3517 impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3518 fn drop(&mut self) {
3520 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3521 let _ = unsafe { Box::from_raw(self.contents.result) };
3527 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3528 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>) -> Self {
3529 let contents = if o.result_ok {
3530 let result = unsafe { o.contents.result };
3531 unsafe { o.contents.result = core::ptr::null_mut() };
3532 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result }
3534 let _ = unsafe { Box::from_raw(o.contents.err) };
3535 o.contents.err = core::ptr::null_mut();
3536 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() }
3540 result_ok: o.result_ok,
3544 impl Clone for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3545 fn clone(&self) -> Self {
3547 Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3548 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ>::clone(unsafe { &*self.contents.result })))
3551 Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3552 err: core::ptr::null_mut()
3558 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig`
3559 /// but with all dynamically-allocated buffers duplicated in new buffers.
3560 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) }
3562 /// The contents of CResult_InMemorySignerDecodeErrorZ
3563 pub union CResult_InMemorySignerDecodeErrorZPtr {
3564 /// A pointer to the contents in the success state.
3565 /// Reading from this pointer when `result_ok` is not set is undefined.
3566 pub result: *mut crate::lightning::sign::InMemorySigner,
3567 /// A pointer to the contents in the error state.
3568 /// Reading from this pointer when `result_ok` is set is undefined.
3569 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3572 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3573 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3575 pub struct CResult_InMemorySignerDecodeErrorZ {
3576 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3577 /// `err` or `result` depending on the state of `result_ok`.
3578 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3579 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3580 pub result_ok: bool,
3583 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3584 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3585 CResult_InMemorySignerDecodeErrorZ {
3586 contents: CResult_InMemorySignerDecodeErrorZPtr {
3587 result: Box::into_raw(Box::new(o)),
3593 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3594 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3595 CResult_InMemorySignerDecodeErrorZ {
3596 contents: CResult_InMemorySignerDecodeErrorZPtr {
3597 err: Box::into_raw(Box::new(e)),
3602 /// Checks if the given object is currently in the success state
3604 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
3608 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3609 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3610 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3611 fn drop(&mut self) {
3613 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3614 let _ = unsafe { Box::from_raw(self.contents.result) };
3617 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3618 let _ = unsafe { Box::from_raw(self.contents.err) };
3623 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3624 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3625 let contents = if o.result_ok {
3626 let result = unsafe { o.contents.result };
3627 unsafe { o.contents.result = core::ptr::null_mut() };
3628 CResult_InMemorySignerDecodeErrorZPtr { result }
3630 let err = unsafe { o.contents.err };
3631 unsafe { o.contents.err = core::ptr::null_mut(); }
3632 CResult_InMemorySignerDecodeErrorZPtr { err }
3636 result_ok: o.result_ok,
3640 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3641 fn clone(&self) -> Self {
3643 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3644 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3647 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3648 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3654 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3655 /// but with all dynamically-allocated buffers duplicated in new buffers.
3656 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
3658 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
3659 pub enum COption_WriteableScoreZ {
3660 /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
3661 Some(crate::lightning::routing::scoring::WriteableScore),
3662 /// When we're in this state, this COption_WriteableScoreZ contains nothing
3665 impl COption_WriteableScoreZ {
3666 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3667 if let Self::None = self { false } else { true }
3669 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3672 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
3673 if let Self::Some(v) = self { v } else { unreachable!() }
3677 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
3678 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
3679 COption_WriteableScoreZ::Some(o)
3682 /// Constructs a new COption_WriteableScoreZ containing nothing
3683 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
3684 COption_WriteableScoreZ::None
3687 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
3688 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
3690 /// The contents of CResult_NoneIOErrorZ
3691 pub union CResult_NoneIOErrorZPtr {
3692 /// Note that this value is always NULL, as there are no contents in the OK variant
3693 pub result: *mut core::ffi::c_void,
3694 /// A pointer to the contents in the error state.
3695 /// Reading from this pointer when `result_ok` is set is undefined.
3696 pub err: *mut crate::c_types::IOError,
3699 /// A CResult_NoneIOErrorZ represents the result of a fallible operation,
3700 /// containing a () on success and a crate::c_types::IOError on failure.
3701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3702 pub struct CResult_NoneIOErrorZ {
3703 /// The contents of this CResult_NoneIOErrorZ, accessible via either
3704 /// `err` or `result` depending on the state of `result_ok`.
3705 pub contents: CResult_NoneIOErrorZPtr,
3706 /// Whether this CResult_NoneIOErrorZ represents a success state.
3707 pub result_ok: bool,
3710 /// Creates a new CResult_NoneIOErrorZ in the success state.
3711 pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ {
3712 CResult_NoneIOErrorZ {
3713 contents: CResult_NoneIOErrorZPtr {
3714 result: core::ptr::null_mut(),
3720 /// Creates a new CResult_NoneIOErrorZ in the error state.
3721 pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ {
3722 CResult_NoneIOErrorZ {
3723 contents: CResult_NoneIOErrorZPtr {
3724 err: Box::into_raw(Box::new(e)),
3729 /// Checks if the given object is currently in the success state
3731 pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool {
3735 /// Frees any resources used by the CResult_NoneIOErrorZ.
3736 pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { }
3737 impl Drop for CResult_NoneIOErrorZ {
3738 fn drop(&mut self) {
3741 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3742 let _ = unsafe { Box::from_raw(self.contents.err) };
3747 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneIOErrorZ {
3748 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
3749 let contents = if o.result_ok {
3750 let _ = unsafe { Box::from_raw(o.contents.result) };
3751 o.contents.result = core::ptr::null_mut();
3752 CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() }
3754 let err = unsafe { o.contents.err };
3755 unsafe { o.contents.err = core::ptr::null_mut(); }
3756 CResult_NoneIOErrorZPtr { err }
3760 result_ok: o.result_ok,
3764 impl Clone for CResult_NoneIOErrorZ {
3765 fn clone(&self) -> Self {
3767 Self { result_ok: true, contents: CResult_NoneIOErrorZPtr {
3768 result: core::ptr::null_mut()
3771 Self { result_ok: false, contents: CResult_NoneIOErrorZPtr {
3772 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
3778 /// Creates a new CResult_NoneIOErrorZ which has the same data as `orig`
3779 /// but with all dynamically-allocated buffers duplicated in new buffers.
3780 pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) }
3782 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3783 /// This corresponds to std::vector in C++
3784 pub struct CVec_ChannelDetailsZ {
3785 /// The elements in the array.
3786 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3787 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3788 /// The number of elements pointed to by `data`.
3791 impl CVec_ChannelDetailsZ {
3792 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3793 if self.datalen == 0 { return Vec::new(); }
3794 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3795 self.data = core::ptr::null_mut();
3799 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3800 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3803 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3804 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3805 let datalen = v.len();
3806 let data = Box::into_raw(v.into_boxed_slice());
3807 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3811 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3812 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3813 impl Drop for CVec_ChannelDetailsZ {
3814 fn drop(&mut self) {
3815 if self.datalen == 0 { return; }
3816 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3819 impl Clone for CVec_ChannelDetailsZ {
3820 fn clone(&self) -> Self {
3821 let mut res = Vec::new();
3822 if self.datalen == 0 { return Self::from(res); }
3823 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3828 /// The contents of CResult_RouteLightningErrorZ
3829 pub union CResult_RouteLightningErrorZPtr {
3830 /// A pointer to the contents in the success state.
3831 /// Reading from this pointer when `result_ok` is not set is undefined.
3832 pub result: *mut crate::lightning::routing::router::Route,
3833 /// A pointer to the contents in the error state.
3834 /// Reading from this pointer when `result_ok` is set is undefined.
3835 pub err: *mut crate::lightning::ln::msgs::LightningError,
3838 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3839 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3841 pub struct CResult_RouteLightningErrorZ {
3842 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3843 /// `err` or `result` depending on the state of `result_ok`.
3844 pub contents: CResult_RouteLightningErrorZPtr,
3845 /// Whether this CResult_RouteLightningErrorZ represents a success state.
3846 pub result_ok: bool,
3849 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3850 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3851 CResult_RouteLightningErrorZ {
3852 contents: CResult_RouteLightningErrorZPtr {
3853 result: Box::into_raw(Box::new(o)),
3859 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3860 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3861 CResult_RouteLightningErrorZ {
3862 contents: CResult_RouteLightningErrorZPtr {
3863 err: Box::into_raw(Box::new(e)),
3868 /// Checks if the given object is currently in the success state
3870 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3874 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3875 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3876 impl Drop for CResult_RouteLightningErrorZ {
3877 fn drop(&mut self) {
3879 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3880 let _ = unsafe { Box::from_raw(self.contents.result) };
3883 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3884 let _ = unsafe { Box::from_raw(self.contents.err) };
3889 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3890 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3891 let contents = if o.result_ok {
3892 let result = unsafe { o.contents.result };
3893 unsafe { o.contents.result = core::ptr::null_mut() };
3894 CResult_RouteLightningErrorZPtr { result }
3896 let err = unsafe { o.contents.err };
3897 unsafe { o.contents.err = core::ptr::null_mut(); }
3898 CResult_RouteLightningErrorZPtr { err }
3902 result_ok: o.result_ok,
3906 impl Clone for CResult_RouteLightningErrorZ {
3907 fn clone(&self) -> Self {
3909 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3910 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3913 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3914 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3920 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3921 /// but with all dynamically-allocated buffers duplicated in new buffers.
3922 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3924 /// A tuple of 2 elements. See the individual fields for the types contained.
3925 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
3926 /// The element at position 0
3927 pub a: crate::lightning::offers::invoice::BlindedPayInfo,
3928 /// The element at position 1
3929 pub b: crate::lightning::blinded_path::BlindedPath,
3931 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
3932 fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
3939 impl C2Tuple_BlindedPayInfoBlindedPathZ {
3940 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
3944 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
3945 fn clone(&self) -> Self {
3947 a: Clone::clone(&self.a),
3948 b: Clone::clone(&self.b),
3953 /// Creates a new tuple which has the same data as `orig`
3954 /// but with all dynamically-allocated buffers duplicated in new buffers.
3955 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
3956 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
3958 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
3959 C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
3963 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
3964 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
3966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
3967 /// This corresponds to std::vector in C++
3968 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3969 /// The elements in the array.
3970 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3971 pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
3972 /// The number of elements pointed to by `data`.
3975 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3976 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
3977 if self.datalen == 0 { return Vec::new(); }
3978 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3979 self.data = core::ptr::null_mut();
3983 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
3984 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3987 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3988 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
3989 let datalen = v.len();
3990 let data = Box::into_raw(v.into_boxed_slice());
3991 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3996 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
3997 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3998 fn drop(&mut self) {
3999 if self.datalen == 0 { return; }
4000 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4003 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4004 fn clone(&self) -> Self {
4005 let mut res = Vec::new();
4006 if self.datalen == 0 { return Self::from(res); }
4007 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4012 /// The contents of CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ
4013 pub union CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4014 /// A pointer to the contents in the success state.
4015 /// Reading from this pointer when `result_ok` is not set is undefined.
4016 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ,
4017 /// Note that this value is always NULL, as there are no contents in the Err variant
4018 pub err: *mut core::ffi::c_void,
4021 /// A CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents the result of a fallible operation,
4022 /// containing a crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ on success and a () on failure.
4023 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4024 pub struct CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4025 /// The contents of this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ, accessible via either
4026 /// `err` or `result` depending on the state of `result_ok`.
4027 pub contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr,
4028 /// Whether this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents a success state.
4029 pub result_ok: bool,
4032 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the success state.
4033 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4034 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4035 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4036 result: Box::into_raw(Box::new(o)),
4042 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the error state.
4043 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4044 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4045 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4046 err: core::ptr::null_mut(),
4051 /// Checks if the given object is currently in the success state
4053 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> bool {
4057 /// Frees any resources used by the CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ.
4058 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) { }
4059 impl Drop for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4060 fn drop(&mut self) {
4062 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4063 let _ = unsafe { Box::from_raw(self.contents.result) };
4069 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>> for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4070 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>) -> Self {
4071 let contents = if o.result_ok {
4072 let result = unsafe { o.contents.result };
4073 unsafe { o.contents.result = core::ptr::null_mut() };
4074 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { result }
4076 let _ = unsafe { Box::from_raw(o.contents.err) };
4077 o.contents.err = core::ptr::null_mut();
4078 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { err: core::ptr::null_mut() }
4082 result_ok: o.result_ok,
4086 impl Clone for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4087 fn clone(&self) -> Self {
4089 Self { result_ok: true, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4090 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ>::clone(unsafe { &*self.contents.result })))
4093 Self { result_ok: false, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4094 err: core::ptr::null_mut()
4100 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ which has the same data as `orig`
4101 /// but with all dynamically-allocated buffers duplicated in new buffers.
4102 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ { Clone::clone(&orig) }
4104 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4105 /// This corresponds to std::vector in C++
4106 pub struct CVec_PublicKeyZ {
4107 /// The elements in the array.
4108 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4109 pub data: *mut crate::c_types::PublicKey,
4110 /// The number of elements pointed to by `data`.
4113 impl CVec_PublicKeyZ {
4114 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4115 if self.datalen == 0 { return Vec::new(); }
4116 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4117 self.data = core::ptr::null_mut();
4121 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4122 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4125 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4126 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4127 let datalen = v.len();
4128 let data = Box::into_raw(v.into_boxed_slice());
4129 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4133 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4134 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4135 impl Drop for CVec_PublicKeyZ {
4136 fn drop(&mut self) {
4137 if self.datalen == 0 { return; }
4138 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4141 impl Clone for CVec_PublicKeyZ {
4142 fn clone(&self) -> Self {
4143 let mut res = Vec::new();
4144 if self.datalen == 0 { return Self::from(res); }
4145 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4150 /// The contents of CResult_OnionMessagePathNoneZ
4151 pub union CResult_OnionMessagePathNoneZPtr {
4152 /// A pointer to the contents in the success state.
4153 /// Reading from this pointer when `result_ok` is not set is undefined.
4154 pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
4155 /// Note that this value is always NULL, as there are no contents in the Err variant
4156 pub err: *mut core::ffi::c_void,
4159 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
4160 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
4161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4162 pub struct CResult_OnionMessagePathNoneZ {
4163 /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
4164 /// `err` or `result` depending on the state of `result_ok`.
4165 pub contents: CResult_OnionMessagePathNoneZPtr,
4166 /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
4167 pub result_ok: bool,
4170 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
4171 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
4172 CResult_OnionMessagePathNoneZ {
4173 contents: CResult_OnionMessagePathNoneZPtr {
4174 result: Box::into_raw(Box::new(o)),
4180 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
4181 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
4182 CResult_OnionMessagePathNoneZ {
4183 contents: CResult_OnionMessagePathNoneZPtr {
4184 err: core::ptr::null_mut(),
4189 /// Checks if the given object is currently in the success state
4191 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
4195 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
4196 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
4197 impl Drop for CResult_OnionMessagePathNoneZ {
4198 fn drop(&mut self) {
4200 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4201 let _ = unsafe { Box::from_raw(self.contents.result) };
4207 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
4208 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
4209 let contents = if o.result_ok {
4210 let result = unsafe { o.contents.result };
4211 unsafe { o.contents.result = core::ptr::null_mut() };
4212 CResult_OnionMessagePathNoneZPtr { result }
4214 let _ = unsafe { Box::from_raw(o.contents.err) };
4215 o.contents.err = core::ptr::null_mut();
4216 CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
4220 result_ok: o.result_ok,
4224 impl Clone for CResult_OnionMessagePathNoneZ {
4225 fn clone(&self) -> Self {
4227 Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
4228 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
4231 Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
4232 err: core::ptr::null_mut()
4238 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
4239 /// but with all dynamically-allocated buffers duplicated in new buffers.
4240 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
4242 /// The contents of CResult_CVec_BlindedPathZNoneZ
4243 pub union CResult_CVec_BlindedPathZNoneZPtr {
4244 /// A pointer to the contents in the success state.
4245 /// Reading from this pointer when `result_ok` is not set is undefined.
4246 pub result: *mut crate::c_types::derived::CVec_BlindedPathZ,
4247 /// Note that this value is always NULL, as there are no contents in the Err variant
4248 pub err: *mut core::ffi::c_void,
4251 /// A CResult_CVec_BlindedPathZNoneZ represents the result of a fallible operation,
4252 /// containing a crate::c_types::derived::CVec_BlindedPathZ on success and a () on failure.
4253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4254 pub struct CResult_CVec_BlindedPathZNoneZ {
4255 /// The contents of this CResult_CVec_BlindedPathZNoneZ, accessible via either
4256 /// `err` or `result` depending on the state of `result_ok`.
4257 pub contents: CResult_CVec_BlindedPathZNoneZPtr,
4258 /// Whether this CResult_CVec_BlindedPathZNoneZ represents a success state.
4259 pub result_ok: bool,
4262 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the success state.
4263 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedPathZ) -> CResult_CVec_BlindedPathZNoneZ {
4264 CResult_CVec_BlindedPathZNoneZ {
4265 contents: CResult_CVec_BlindedPathZNoneZPtr {
4266 result: Box::into_raw(Box::new(o)),
4272 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the error state.
4273 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_err() -> CResult_CVec_BlindedPathZNoneZ {
4274 CResult_CVec_BlindedPathZNoneZ {
4275 contents: CResult_CVec_BlindedPathZNoneZPtr {
4276 err: core::ptr::null_mut(),
4281 /// Checks if the given object is currently in the success state
4283 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_is_ok(o: &CResult_CVec_BlindedPathZNoneZ) -> bool {
4287 /// Frees any resources used by the CResult_CVec_BlindedPathZNoneZ.
4288 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_free(_res: CResult_CVec_BlindedPathZNoneZ) { }
4289 impl Drop for CResult_CVec_BlindedPathZNoneZ {
4290 fn drop(&mut self) {
4292 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4293 let _ = unsafe { Box::from_raw(self.contents.result) };
4299 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>> for CResult_CVec_BlindedPathZNoneZ {
4300 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>) -> Self {
4301 let contents = if o.result_ok {
4302 let result = unsafe { o.contents.result };
4303 unsafe { o.contents.result = core::ptr::null_mut() };
4304 CResult_CVec_BlindedPathZNoneZPtr { result }
4306 let _ = unsafe { Box::from_raw(o.contents.err) };
4307 o.contents.err = core::ptr::null_mut();
4308 CResult_CVec_BlindedPathZNoneZPtr { err: core::ptr::null_mut() }
4312 result_ok: o.result_ok,
4316 impl Clone for CResult_CVec_BlindedPathZNoneZ {
4317 fn clone(&self) -> Self {
4319 Self { result_ok: true, contents: CResult_CVec_BlindedPathZNoneZPtr {
4320 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_BlindedPathZ>::clone(unsafe { &*self.contents.result })))
4323 Self { result_ok: false, contents: CResult_CVec_BlindedPathZNoneZPtr {
4324 err: core::ptr::null_mut()
4330 /// Creates a new CResult_CVec_BlindedPathZNoneZ which has the same data as `orig`
4331 /// but with all dynamically-allocated buffers duplicated in new buffers.
4332 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_clone(orig: &CResult_CVec_BlindedPathZNoneZ) -> CResult_CVec_BlindedPathZNoneZ { Clone::clone(&orig) }
4334 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
4335 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
4336 /// A pointer to the contents in the success state.
4337 /// Reading from this pointer when `result_ok` is not set is undefined.
4338 pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
4339 /// A pointer to the contents in the error state.
4340 /// Reading from this pointer when `result_ok` is set is undefined.
4341 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4344 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
4345 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
4346 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4347 pub struct CResult_InFlightHtlcsDecodeErrorZ {
4348 /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
4349 /// `err` or `result` depending on the state of `result_ok`.
4350 pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
4351 /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
4352 pub result_ok: bool,
4355 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
4356 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
4357 CResult_InFlightHtlcsDecodeErrorZ {
4358 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4359 result: Box::into_raw(Box::new(o)),
4365 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
4366 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
4367 CResult_InFlightHtlcsDecodeErrorZ {
4368 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4369 err: Box::into_raw(Box::new(e)),
4374 /// Checks if the given object is currently in the success state
4376 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
4380 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
4381 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
4382 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
4383 fn drop(&mut self) {
4385 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4386 let _ = unsafe { Box::from_raw(self.contents.result) };
4389 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4390 let _ = unsafe { Box::from_raw(self.contents.err) };
4395 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
4396 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
4397 let contents = if o.result_ok {
4398 let result = unsafe { o.contents.result };
4399 unsafe { o.contents.result = core::ptr::null_mut() };
4400 CResult_InFlightHtlcsDecodeErrorZPtr { result }
4402 let err = unsafe { o.contents.err };
4403 unsafe { o.contents.err = core::ptr::null_mut(); }
4404 CResult_InFlightHtlcsDecodeErrorZPtr { err }
4408 result_ok: o.result_ok,
4412 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
4413 fn clone(&self) -> Self {
4415 Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4416 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
4419 Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4420 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4426 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
4427 /// but with all dynamically-allocated buffers duplicated in new buffers.
4428 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
4430 /// The contents of CResult_RouteHopDecodeErrorZ
4431 pub union CResult_RouteHopDecodeErrorZPtr {
4432 /// A pointer to the contents in the success state.
4433 /// Reading from this pointer when `result_ok` is not set is undefined.
4434 pub result: *mut crate::lightning::routing::router::RouteHop,
4435 /// A pointer to the contents in the error state.
4436 /// Reading from this pointer when `result_ok` is set is undefined.
4437 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4440 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
4441 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4442 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4443 pub struct CResult_RouteHopDecodeErrorZ {
4444 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
4445 /// `err` or `result` depending on the state of `result_ok`.
4446 pub contents: CResult_RouteHopDecodeErrorZPtr,
4447 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
4448 pub result_ok: bool,
4451 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
4452 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
4453 CResult_RouteHopDecodeErrorZ {
4454 contents: CResult_RouteHopDecodeErrorZPtr {
4455 result: Box::into_raw(Box::new(o)),
4461 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
4462 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
4463 CResult_RouteHopDecodeErrorZ {
4464 contents: CResult_RouteHopDecodeErrorZPtr {
4465 err: Box::into_raw(Box::new(e)),
4470 /// Checks if the given object is currently in the success state
4472 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
4476 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
4477 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
4478 impl Drop for CResult_RouteHopDecodeErrorZ {
4479 fn drop(&mut self) {
4481 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4482 let _ = unsafe { Box::from_raw(self.contents.result) };
4485 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4486 let _ = unsafe { Box::from_raw(self.contents.err) };
4491 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
4492 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4493 let contents = if o.result_ok {
4494 let result = unsafe { o.contents.result };
4495 unsafe { o.contents.result = core::ptr::null_mut() };
4496 CResult_RouteHopDecodeErrorZPtr { result }
4498 let err = unsafe { o.contents.err };
4499 unsafe { o.contents.err = core::ptr::null_mut(); }
4500 CResult_RouteHopDecodeErrorZPtr { err }
4504 result_ok: o.result_ok,
4508 impl Clone for CResult_RouteHopDecodeErrorZ {
4509 fn clone(&self) -> Self {
4511 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
4512 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
4515 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
4516 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4522 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
4523 /// but with all dynamically-allocated buffers duplicated in new buffers.
4524 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
4526 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
4527 /// This corresponds to std::vector in C++
4528 pub struct CVec_BlindedHopZ {
4529 /// The elements in the array.
4530 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4531 pub data: *mut crate::lightning::blinded_path::BlindedHop,
4532 /// The number of elements pointed to by `data`.
4535 impl CVec_BlindedHopZ {
4536 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
4537 if self.datalen == 0 { return Vec::new(); }
4538 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4539 self.data = core::ptr::null_mut();
4543 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
4544 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4547 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
4548 fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
4549 let datalen = v.len();
4550 let data = Box::into_raw(v.into_boxed_slice());
4551 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4555 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4556 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
4557 impl Drop for CVec_BlindedHopZ {
4558 fn drop(&mut self) {
4559 if self.datalen == 0 { return; }
4560 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4563 impl Clone for CVec_BlindedHopZ {
4564 fn clone(&self) -> Self {
4565 let mut res = Vec::new();
4566 if self.datalen == 0 { return Self::from(res); }
4567 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4572 /// The contents of CResult_BlindedTailDecodeErrorZ
4573 pub union CResult_BlindedTailDecodeErrorZPtr {
4574 /// A pointer to the contents in the success state.
4575 /// Reading from this pointer when `result_ok` is not set is undefined.
4576 pub result: *mut crate::lightning::routing::router::BlindedTail,
4577 /// A pointer to the contents in the error state.
4578 /// Reading from this pointer when `result_ok` is set is undefined.
4579 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4582 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
4583 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
4584 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4585 pub struct CResult_BlindedTailDecodeErrorZ {
4586 /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
4587 /// `err` or `result` depending on the state of `result_ok`.
4588 pub contents: CResult_BlindedTailDecodeErrorZPtr,
4589 /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
4590 pub result_ok: bool,
4593 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
4594 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
4595 CResult_BlindedTailDecodeErrorZ {
4596 contents: CResult_BlindedTailDecodeErrorZPtr {
4597 result: Box::into_raw(Box::new(o)),
4603 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
4604 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
4605 CResult_BlindedTailDecodeErrorZ {
4606 contents: CResult_BlindedTailDecodeErrorZPtr {
4607 err: Box::into_raw(Box::new(e)),
4612 /// Checks if the given object is currently in the success state
4614 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
4618 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
4619 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
4620 impl Drop for CResult_BlindedTailDecodeErrorZ {
4621 fn drop(&mut self) {
4623 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4624 let _ = unsafe { Box::from_raw(self.contents.result) };
4627 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4628 let _ = unsafe { Box::from_raw(self.contents.err) };
4633 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
4634 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
4635 let contents = if o.result_ok {
4636 let result = unsafe { o.contents.result };
4637 unsafe { o.contents.result = core::ptr::null_mut() };
4638 CResult_BlindedTailDecodeErrorZPtr { result }
4640 let err = unsafe { o.contents.err };
4641 unsafe { o.contents.err = core::ptr::null_mut(); }
4642 CResult_BlindedTailDecodeErrorZPtr { err }
4646 result_ok: o.result_ok,
4650 impl Clone for CResult_BlindedTailDecodeErrorZ {
4651 fn clone(&self) -> Self {
4653 Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
4654 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
4657 Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
4658 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4664 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
4665 /// but with all dynamically-allocated buffers duplicated in new buffers.
4666 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
4668 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
4669 /// This corresponds to std::vector in C++
4670 pub struct CVec_RouteHopZ {
4671 /// The elements in the array.
4672 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4673 pub data: *mut crate::lightning::routing::router::RouteHop,
4674 /// The number of elements pointed to by `data`.
4677 impl CVec_RouteHopZ {
4678 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
4679 if self.datalen == 0 { return Vec::new(); }
4680 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4681 self.data = core::ptr::null_mut();
4685 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
4686 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4689 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
4690 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
4691 let datalen = v.len();
4692 let data = Box::into_raw(v.into_boxed_slice());
4693 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4697 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4698 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
4699 impl Drop for CVec_RouteHopZ {
4700 fn drop(&mut self) {
4701 if self.datalen == 0 { return; }
4702 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4705 impl Clone for CVec_RouteHopZ {
4706 fn clone(&self) -> Self {
4707 let mut res = Vec::new();
4708 if self.datalen == 0 { return Self::from(res); }
4709 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4714 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
4715 /// This corresponds to std::vector in C++
4716 pub struct CVec_PathZ {
4717 /// The elements in the array.
4718 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4719 pub data: *mut crate::lightning::routing::router::Path,
4720 /// The number of elements pointed to by `data`.
4724 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
4725 if self.datalen == 0 { return Vec::new(); }
4726 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4727 self.data = core::ptr::null_mut();
4731 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
4732 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4735 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
4736 fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
4737 let datalen = v.len();
4738 let data = Box::into_raw(v.into_boxed_slice());
4739 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4743 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4744 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
4745 impl Drop for CVec_PathZ {
4746 fn drop(&mut self) {
4747 if self.datalen == 0 { return; }
4748 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4751 impl Clone for CVec_PathZ {
4752 fn clone(&self) -> Self {
4753 let mut res = Vec::new();
4754 if self.datalen == 0 { return Self::from(res); }
4755 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4760 /// The contents of CResult_RouteDecodeErrorZ
4761 pub union CResult_RouteDecodeErrorZPtr {
4762 /// A pointer to the contents in the success state.
4763 /// Reading from this pointer when `result_ok` is not set is undefined.
4764 pub result: *mut crate::lightning::routing::router::Route,
4765 /// A pointer to the contents in the error state.
4766 /// Reading from this pointer when `result_ok` is set is undefined.
4767 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4770 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
4771 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
4772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4773 pub struct CResult_RouteDecodeErrorZ {
4774 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
4775 /// `err` or `result` depending on the state of `result_ok`.
4776 pub contents: CResult_RouteDecodeErrorZPtr,
4777 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
4778 pub result_ok: bool,
4781 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
4782 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
4783 CResult_RouteDecodeErrorZ {
4784 contents: CResult_RouteDecodeErrorZPtr {
4785 result: Box::into_raw(Box::new(o)),
4791 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
4792 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
4793 CResult_RouteDecodeErrorZ {
4794 contents: CResult_RouteDecodeErrorZPtr {
4795 err: Box::into_raw(Box::new(e)),
4800 /// Checks if the given object is currently in the success state
4802 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
4806 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
4807 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
4808 impl Drop for CResult_RouteDecodeErrorZ {
4809 fn drop(&mut self) {
4811 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4812 let _ = unsafe { Box::from_raw(self.contents.result) };
4815 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4816 let _ = unsafe { Box::from_raw(self.contents.err) };
4821 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
4822 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
4823 let contents = if o.result_ok {
4824 let result = unsafe { o.contents.result };
4825 unsafe { o.contents.result = core::ptr::null_mut() };
4826 CResult_RouteDecodeErrorZPtr { result }
4828 let err = unsafe { o.contents.err };
4829 unsafe { o.contents.err = core::ptr::null_mut(); }
4830 CResult_RouteDecodeErrorZPtr { err }
4834 result_ok: o.result_ok,
4838 impl Clone for CResult_RouteDecodeErrorZ {
4839 fn clone(&self) -> Self {
4841 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
4842 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4845 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
4846 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4852 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
4853 /// but with all dynamically-allocated buffers duplicated in new buffers.
4854 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
4856 /// The contents of CResult_RouteParametersDecodeErrorZ
4857 pub union CResult_RouteParametersDecodeErrorZPtr {
4858 /// A pointer to the contents in the success state.
4859 /// Reading from this pointer when `result_ok` is not set is undefined.
4860 pub result: *mut crate::lightning::routing::router::RouteParameters,
4861 /// A pointer to the contents in the error state.
4862 /// Reading from this pointer when `result_ok` is set is undefined.
4863 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4866 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
4867 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4869 pub struct CResult_RouteParametersDecodeErrorZ {
4870 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
4871 /// `err` or `result` depending on the state of `result_ok`.
4872 pub contents: CResult_RouteParametersDecodeErrorZPtr,
4873 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
4874 pub result_ok: bool,
4877 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
4878 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
4879 CResult_RouteParametersDecodeErrorZ {
4880 contents: CResult_RouteParametersDecodeErrorZPtr {
4881 result: Box::into_raw(Box::new(o)),
4887 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
4888 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
4889 CResult_RouteParametersDecodeErrorZ {
4890 contents: CResult_RouteParametersDecodeErrorZPtr {
4891 err: Box::into_raw(Box::new(e)),
4896 /// Checks if the given object is currently in the success state
4898 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
4902 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
4903 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
4904 impl Drop for CResult_RouteParametersDecodeErrorZ {
4905 fn drop(&mut self) {
4907 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4908 let _ = unsafe { Box::from_raw(self.contents.result) };
4911 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4912 let _ = unsafe { Box::from_raw(self.contents.err) };
4917 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
4918 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4919 let contents = if o.result_ok {
4920 let result = unsafe { o.contents.result };
4921 unsafe { o.contents.result = core::ptr::null_mut() };
4922 CResult_RouteParametersDecodeErrorZPtr { result }
4924 let err = unsafe { o.contents.err };
4925 unsafe { o.contents.err = core::ptr::null_mut(); }
4926 CResult_RouteParametersDecodeErrorZPtr { err }
4930 result_ok: o.result_ok,
4934 impl Clone for CResult_RouteParametersDecodeErrorZ {
4935 fn clone(&self) -> Self {
4937 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
4938 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
4941 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
4942 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4948 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
4949 /// but with all dynamically-allocated buffers duplicated in new buffers.
4950 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
4952 /// A dynamically-allocated array of u64s of arbitrary size.
4953 /// This corresponds to std::vector in C++
4954 pub struct CVec_u64Z {
4955 /// The elements in the array.
4956 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4958 /// The number of elements pointed to by `data`.
4962 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4963 if self.datalen == 0 { return Vec::new(); }
4964 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4965 self.data = core::ptr::null_mut();
4969 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
4970 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4973 impl From<Vec<u64>> for CVec_u64Z {
4974 fn from(v: Vec<u64>) -> Self {
4975 let datalen = v.len();
4976 let data = Box::into_raw(v.into_boxed_slice());
4977 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4981 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4982 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
4983 impl Drop for CVec_u64Z {
4984 fn drop(&mut self) {
4985 if self.datalen == 0 { return; }
4986 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4989 impl Clone for CVec_u64Z {
4990 fn clone(&self) -> Self {
4991 let mut res = Vec::new();
4992 if self.datalen == 0 { return Self::from(res); }
4993 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4998 /// The contents of CResult_PaymentParametersDecodeErrorZ
4999 pub union CResult_PaymentParametersDecodeErrorZPtr {
5000 /// A pointer to the contents in the success state.
5001 /// Reading from this pointer when `result_ok` is not set is undefined.
5002 pub result: *mut crate::lightning::routing::router::PaymentParameters,
5003 /// A pointer to the contents in the error state.
5004 /// Reading from this pointer when `result_ok` is set is undefined.
5005 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5008 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
5009 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
5010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5011 pub struct CResult_PaymentParametersDecodeErrorZ {
5012 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
5013 /// `err` or `result` depending on the state of `result_ok`.
5014 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
5015 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
5016 pub result_ok: bool,
5019 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
5020 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
5021 CResult_PaymentParametersDecodeErrorZ {
5022 contents: CResult_PaymentParametersDecodeErrorZPtr {
5023 result: Box::into_raw(Box::new(o)),
5029 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
5030 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
5031 CResult_PaymentParametersDecodeErrorZ {
5032 contents: CResult_PaymentParametersDecodeErrorZPtr {
5033 err: Box::into_raw(Box::new(e)),
5038 /// Checks if the given object is currently in the success state
5040 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
5044 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
5045 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
5046 impl Drop for CResult_PaymentParametersDecodeErrorZ {
5047 fn drop(&mut self) {
5049 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5050 let _ = unsafe { Box::from_raw(self.contents.result) };
5053 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5054 let _ = unsafe { Box::from_raw(self.contents.err) };
5059 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
5060 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
5061 let contents = if o.result_ok {
5062 let result = unsafe { o.contents.result };
5063 unsafe { o.contents.result = core::ptr::null_mut() };
5064 CResult_PaymentParametersDecodeErrorZPtr { result }
5066 let err = unsafe { o.contents.err };
5067 unsafe { o.contents.err = core::ptr::null_mut(); }
5068 CResult_PaymentParametersDecodeErrorZPtr { err }
5072 result_ok: o.result_ok,
5076 impl Clone for CResult_PaymentParametersDecodeErrorZ {
5077 fn clone(&self) -> Self {
5079 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
5080 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
5083 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
5084 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5090 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
5091 /// but with all dynamically-allocated buffers duplicated in new buffers.
5092 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
5094 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
5095 /// This corresponds to std::vector in C++
5096 pub struct CVec_RouteHintZ {
5097 /// The elements in the array.
5098 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5099 pub data: *mut crate::lightning::routing::router::RouteHint,
5100 /// The number of elements pointed to by `data`.
5103 impl CVec_RouteHintZ {
5104 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
5105 if self.datalen == 0 { return Vec::new(); }
5106 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5107 self.data = core::ptr::null_mut();
5111 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
5112 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5115 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
5116 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
5117 let datalen = v.len();
5118 let data = Box::into_raw(v.into_boxed_slice());
5119 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5123 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5124 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
5125 impl Drop for CVec_RouteHintZ {
5126 fn drop(&mut self) {
5127 if self.datalen == 0 { return; }
5128 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5131 impl Clone for CVec_RouteHintZ {
5132 fn clone(&self) -> Self {
5133 let mut res = Vec::new();
5134 if self.datalen == 0 { return Self::from(res); }
5135 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5140 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
5141 /// This corresponds to std::vector in C++
5142 pub struct CVec_RouteHintHopZ {
5143 /// The elements in the array.
5144 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5145 pub data: *mut crate::lightning::routing::router::RouteHintHop,
5146 /// The number of elements pointed to by `data`.
5149 impl CVec_RouteHintHopZ {
5150 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
5151 if self.datalen == 0 { return Vec::new(); }
5152 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5153 self.data = core::ptr::null_mut();
5157 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
5158 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5161 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
5162 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
5163 let datalen = v.len();
5164 let data = Box::into_raw(v.into_boxed_slice());
5165 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5169 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5170 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
5171 impl Drop for CVec_RouteHintHopZ {
5172 fn drop(&mut self) {
5173 if self.datalen == 0 { return; }
5174 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5177 impl Clone for CVec_RouteHintHopZ {
5178 fn clone(&self) -> Self {
5179 let mut res = Vec::new();
5180 if self.datalen == 0 { return Self::from(res); }
5181 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5186 /// The contents of CResult_RouteHintDecodeErrorZ
5187 pub union CResult_RouteHintDecodeErrorZPtr {
5188 /// A pointer to the contents in the success state.
5189 /// Reading from this pointer when `result_ok` is not set is undefined.
5190 pub result: *mut crate::lightning::routing::router::RouteHint,
5191 /// A pointer to the contents in the error state.
5192 /// Reading from this pointer when `result_ok` is set is undefined.
5193 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5196 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
5197 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5198 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5199 pub struct CResult_RouteHintDecodeErrorZ {
5200 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
5201 /// `err` or `result` depending on the state of `result_ok`.
5202 pub contents: CResult_RouteHintDecodeErrorZPtr,
5203 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
5204 pub result_ok: bool,
5207 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
5208 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
5209 CResult_RouteHintDecodeErrorZ {
5210 contents: CResult_RouteHintDecodeErrorZPtr {
5211 result: Box::into_raw(Box::new(o)),
5217 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
5218 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
5219 CResult_RouteHintDecodeErrorZ {
5220 contents: CResult_RouteHintDecodeErrorZPtr {
5221 err: Box::into_raw(Box::new(e)),
5226 /// Checks if the given object is currently in the success state
5228 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
5232 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
5233 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
5234 impl Drop for CResult_RouteHintDecodeErrorZ {
5235 fn drop(&mut self) {
5237 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5238 let _ = unsafe { Box::from_raw(self.contents.result) };
5241 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5242 let _ = unsafe { Box::from_raw(self.contents.err) };
5247 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
5248 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5249 let contents = if o.result_ok {
5250 let result = unsafe { o.contents.result };
5251 unsafe { o.contents.result = core::ptr::null_mut() };
5252 CResult_RouteHintDecodeErrorZPtr { result }
5254 let err = unsafe { o.contents.err };
5255 unsafe { o.contents.err = core::ptr::null_mut(); }
5256 CResult_RouteHintDecodeErrorZPtr { err }
5260 result_ok: o.result_ok,
5264 impl Clone for CResult_RouteHintDecodeErrorZ {
5265 fn clone(&self) -> Self {
5267 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
5268 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
5271 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
5272 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5278 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
5279 /// but with all dynamically-allocated buffers duplicated in new buffers.
5280 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
5282 /// The contents of CResult_RouteHintHopDecodeErrorZ
5283 pub union CResult_RouteHintHopDecodeErrorZPtr {
5284 /// A pointer to the contents in the success state.
5285 /// Reading from this pointer when `result_ok` is not set is undefined.
5286 pub result: *mut crate::lightning::routing::router::RouteHintHop,
5287 /// A pointer to the contents in the error state.
5288 /// Reading from this pointer when `result_ok` is set is undefined.
5289 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5292 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
5293 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
5294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5295 pub struct CResult_RouteHintHopDecodeErrorZ {
5296 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
5297 /// `err` or `result` depending on the state of `result_ok`.
5298 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
5299 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
5300 pub result_ok: bool,
5303 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
5304 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
5305 CResult_RouteHintHopDecodeErrorZ {
5306 contents: CResult_RouteHintHopDecodeErrorZPtr {
5307 result: Box::into_raw(Box::new(o)),
5313 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
5314 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
5315 CResult_RouteHintHopDecodeErrorZ {
5316 contents: CResult_RouteHintHopDecodeErrorZPtr {
5317 err: Box::into_raw(Box::new(e)),
5322 /// Checks if the given object is currently in the success state
5324 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
5328 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
5329 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
5330 impl Drop for CResult_RouteHintHopDecodeErrorZ {
5331 fn drop(&mut self) {
5333 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5334 let _ = unsafe { Box::from_raw(self.contents.result) };
5337 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5338 let _ = unsafe { Box::from_raw(self.contents.err) };
5343 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
5344 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
5345 let contents = if o.result_ok {
5346 let result = unsafe { o.contents.result };
5347 unsafe { o.contents.result = core::ptr::null_mut() };
5348 CResult_RouteHintHopDecodeErrorZPtr { result }
5350 let err = unsafe { o.contents.err };
5351 unsafe { o.contents.err = core::ptr::null_mut(); }
5352 CResult_RouteHintHopDecodeErrorZPtr { err }
5356 result_ok: o.result_ok,
5360 impl Clone for CResult_RouteHintHopDecodeErrorZ {
5361 fn clone(&self) -> Self {
5363 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
5364 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
5367 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
5368 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5374 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
5375 /// but with all dynamically-allocated buffers duplicated in new buffers.
5376 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
5378 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
5379 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
5380 /// A pointer to the contents in the success state.
5381 /// Reading from this pointer when `result_ok` is not set is undefined.
5382 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
5383 /// A pointer to the contents in the error state.
5384 /// Reading from this pointer when `result_ok` is set is undefined.
5385 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5388 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
5389 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5391 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
5392 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
5393 /// `err` or `result` depending on the state of `result_ok`.
5394 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
5395 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
5396 pub result_ok: bool,
5399 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
5400 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
5401 CResult_FixedPenaltyScorerDecodeErrorZ {
5402 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5403 result: Box::into_raw(Box::new(o)),
5409 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
5410 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
5411 CResult_FixedPenaltyScorerDecodeErrorZ {
5412 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5413 err: Box::into_raw(Box::new(e)),
5418 /// Checks if the given object is currently in the success state
5420 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
5424 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
5425 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
5426 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
5427 fn drop(&mut self) {
5429 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5430 let _ = unsafe { Box::from_raw(self.contents.result) };
5433 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5434 let _ = unsafe { Box::from_raw(self.contents.err) };
5439 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
5440 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5441 let contents = if o.result_ok {
5442 let result = unsafe { o.contents.result };
5443 unsafe { o.contents.result = core::ptr::null_mut() };
5444 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
5446 let err = unsafe { o.contents.err };
5447 unsafe { o.contents.err = core::ptr::null_mut(); }
5448 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
5452 result_ok: o.result_ok,
5456 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
5457 fn clone(&self) -> Self {
5459 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5460 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
5463 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5464 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5470 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
5471 /// but with all dynamically-allocated buffers duplicated in new buffers.
5472 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
5474 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
5475 /// This corresponds to std::vector in C++
5476 pub struct CVec_NodeIdZ {
5477 /// The elements in the array.
5478 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5479 pub data: *mut crate::lightning::routing::gossip::NodeId,
5480 /// The number of elements pointed to by `data`.
5484 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
5485 if self.datalen == 0 { return Vec::new(); }
5486 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5487 self.data = core::ptr::null_mut();
5491 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
5492 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5495 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
5496 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
5497 let datalen = v.len();
5498 let data = Box::into_raw(v.into_boxed_slice());
5499 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5503 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5504 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
5505 impl Drop for CVec_NodeIdZ {
5506 fn drop(&mut self) {
5507 if self.datalen == 0 { return; }
5508 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5511 impl Clone for CVec_NodeIdZ {
5512 fn clone(&self) -> Self {
5513 let mut res = Vec::new();
5514 if self.datalen == 0 { return Self::from(res); }
5515 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5520 /// A tuple of 2 elements. See the individual fields for the types contained.
5521 pub struct C2Tuple_u64u64Z {
5522 /// The element at position 0
5524 /// The element at position 1
5527 impl From<(u64, u64)> for C2Tuple_u64u64Z {
5528 fn from (tup: (u64, u64)) -> Self {
5535 impl C2Tuple_u64u64Z {
5536 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
5540 impl Clone for C2Tuple_u64u64Z {
5541 fn clone(&self) -> Self {
5543 a: Clone::clone(&self.a),
5544 b: Clone::clone(&self.b),
5549 /// Creates a new tuple which has the same data as `orig`
5550 /// but with all dynamically-allocated buffers duplicated in new buffers.
5551 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
5552 /// Creates a new C2Tuple_u64u64Z from the contained elements.
5554 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
5555 C2Tuple_u64u64Z { a, b, }
5559 /// Frees any resources used by the C2Tuple_u64u64Z.
5560 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
5563 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
5564 pub enum COption_C2Tuple_u64u64ZZ {
5565 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
5566 Some(crate::c_types::derived::C2Tuple_u64u64Z),
5567 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
5570 impl COption_C2Tuple_u64u64ZZ {
5571 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5572 if let Self::None = self { false } else { true }
5574 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5577 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
5578 if let Self::Some(v) = self { v } else { unreachable!() }
5582 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
5583 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
5584 COption_C2Tuple_u64u64ZZ::Some(o)
5587 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
5588 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
5589 COption_C2Tuple_u64u64ZZ::None
5592 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
5593 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
5595 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
5596 /// but with all dynamically-allocated buffers duplicated in new buffers.
5597 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
5599 /// A tuple of 2 elements. See the individual fields for the types contained.
5600 pub struct C2Tuple_Z {
5601 /// The element at position 0
5602 pub a: crate::c_types::ThirtyTwoU16s,
5603 /// The element at position 1
5604 pub b: crate::c_types::ThirtyTwoU16s,
5606 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z {
5607 fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5615 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5619 /// Creates a new C2Tuple_Z from the contained elements.
5621 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z {
5626 /// Frees any resources used by the C2Tuple_Z.
5627 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
5629 /// A tuple of 2 elements. See the individual fields for the types contained.
5630 pub struct C2Tuple__u1632_u1632Z {
5631 /// The element at position 0
5632 pub a: crate::c_types::ThirtyTwoU16s,
5633 /// The element at position 1
5634 pub b: crate::c_types::ThirtyTwoU16s,
5636 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z {
5637 fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5644 impl C2Tuple__u1632_u1632Z {
5645 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5649 /// Creates a new C2Tuple__u1632_u1632Z from the contained elements.
5651 pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z {
5652 C2Tuple__u1632_u1632Z { a, b, }
5656 /// Frees any resources used by the C2Tuple__u1632_u1632Z.
5657 pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { }
5659 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not
5660 pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5661 /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z
5662 Some(crate::c_types::derived::C2Tuple__u1632_u1632Z),
5663 /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing
5666 impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5667 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5668 if let Self::None = self { false } else { true }
5670 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5673 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z {
5674 if let Self::Some(v) = self { v } else { unreachable!() }
5678 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z
5679 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5680 COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o)
5683 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing
5684 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5685 COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None
5688 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state
5689 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { }
5692 /// An enum which can either contain a f64 or not
5693 pub enum COption_f64Z {
5694 /// When we're in this state, this COption_f64Z contains a f64
5696 /// When we're in this state, this COption_f64Z contains nothing
5700 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5701 if let Self::None = self { false } else { true }
5703 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5706 #[allow(unused)] pub(crate) fn take(mut self) -> f64 {
5707 if let Self::Some(v) = self { v } else { unreachable!() }
5711 /// Constructs a new COption_f64Z containing a f64
5712 pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z {
5713 COption_f64Z::Some(o)
5716 /// Constructs a new COption_f64Z containing nothing
5717 pub extern "C" fn COption_f64Z_none() -> COption_f64Z {
5721 /// Frees any resources associated with the f64, if we are in the Some state
5722 pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { }
5724 /// Creates a new COption_f64Z which has the same data as `orig`
5725 /// but with all dynamically-allocated buffers duplicated in new buffers.
5726 pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) }
5728 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
5729 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
5730 /// A pointer to the contents in the success state.
5731 /// Reading from this pointer when `result_ok` is not set is undefined.
5732 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
5733 /// A pointer to the contents in the error state.
5734 /// Reading from this pointer when `result_ok` is set is undefined.
5735 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5738 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5739 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5741 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
5742 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5743 /// `err` or `result` depending on the state of `result_ok`.
5744 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
5745 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5746 pub result_ok: bool,
5749 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
5750 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
5751 CResult_ProbabilisticScorerDecodeErrorZ {
5752 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5753 result: Box::into_raw(Box::new(o)),
5759 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
5760 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
5761 CResult_ProbabilisticScorerDecodeErrorZ {
5762 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5763 err: Box::into_raw(Box::new(e)),
5768 /// Checks if the given object is currently in the success state
5770 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
5774 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
5775 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
5776 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
5777 fn drop(&mut self) {
5779 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5780 let _ = unsafe { Box::from_raw(self.contents.result) };
5783 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5784 let _ = unsafe { Box::from_raw(self.contents.err) };
5789 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
5790 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5791 let contents = if o.result_ok {
5792 let result = unsafe { o.contents.result };
5793 unsafe { o.contents.result = core::ptr::null_mut() };
5794 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
5796 let err = unsafe { o.contents.err };
5797 unsafe { o.contents.err = core::ptr::null_mut(); }
5798 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
5802 result_ok: o.result_ok,
5807 /// The contents of CResult_BestBlockDecodeErrorZ
5808 pub union CResult_BestBlockDecodeErrorZPtr {
5809 /// A pointer to the contents in the success state.
5810 /// Reading from this pointer when `result_ok` is not set is undefined.
5811 pub result: *mut crate::lightning::chain::BestBlock,
5812 /// A pointer to the contents in the error state.
5813 /// Reading from this pointer when `result_ok` is set is undefined.
5814 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5817 /// A CResult_BestBlockDecodeErrorZ represents the result of a fallible operation,
5818 /// containing a crate::lightning::chain::BestBlock on success and a crate::lightning::ln::msgs::DecodeError on failure.
5819 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5820 pub struct CResult_BestBlockDecodeErrorZ {
5821 /// The contents of this CResult_BestBlockDecodeErrorZ, accessible via either
5822 /// `err` or `result` depending on the state of `result_ok`.
5823 pub contents: CResult_BestBlockDecodeErrorZPtr,
5824 /// Whether this CResult_BestBlockDecodeErrorZ represents a success state.
5825 pub result_ok: bool,
5828 /// Creates a new CResult_BestBlockDecodeErrorZ in the success state.
5829 pub extern "C" fn CResult_BestBlockDecodeErrorZ_ok(o: crate::lightning::chain::BestBlock) -> CResult_BestBlockDecodeErrorZ {
5830 CResult_BestBlockDecodeErrorZ {
5831 contents: CResult_BestBlockDecodeErrorZPtr {
5832 result: Box::into_raw(Box::new(o)),
5838 /// Creates a new CResult_BestBlockDecodeErrorZ in the error state.
5839 pub extern "C" fn CResult_BestBlockDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BestBlockDecodeErrorZ {
5840 CResult_BestBlockDecodeErrorZ {
5841 contents: CResult_BestBlockDecodeErrorZPtr {
5842 err: Box::into_raw(Box::new(e)),
5847 /// Checks if the given object is currently in the success state
5849 pub extern "C" fn CResult_BestBlockDecodeErrorZ_is_ok(o: &CResult_BestBlockDecodeErrorZ) -> bool {
5853 /// Frees any resources used by the CResult_BestBlockDecodeErrorZ.
5854 pub extern "C" fn CResult_BestBlockDecodeErrorZ_free(_res: CResult_BestBlockDecodeErrorZ) { }
5855 impl Drop for CResult_BestBlockDecodeErrorZ {
5856 fn drop(&mut self) {
5858 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5859 let _ = unsafe { Box::from_raw(self.contents.result) };
5862 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5863 let _ = unsafe { Box::from_raw(self.contents.err) };
5868 impl From<crate::c_types::CResultTempl<crate::lightning::chain::BestBlock, crate::lightning::ln::msgs::DecodeError>> for CResult_BestBlockDecodeErrorZ {
5869 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::BestBlock, crate::lightning::ln::msgs::DecodeError>) -> Self {
5870 let contents = if o.result_ok {
5871 let result = unsafe { o.contents.result };
5872 unsafe { o.contents.result = core::ptr::null_mut() };
5873 CResult_BestBlockDecodeErrorZPtr { result }
5875 let err = unsafe { o.contents.err };
5876 unsafe { o.contents.err = core::ptr::null_mut(); }
5877 CResult_BestBlockDecodeErrorZPtr { err }
5881 result_ok: o.result_ok,
5885 impl Clone for CResult_BestBlockDecodeErrorZ {
5886 fn clone(&self) -> Self {
5888 Self { result_ok: true, contents: CResult_BestBlockDecodeErrorZPtr {
5889 result: Box::into_raw(Box::new(<crate::lightning::chain::BestBlock>::clone(unsafe { &*self.contents.result })))
5892 Self { result_ok: false, contents: CResult_BestBlockDecodeErrorZPtr {
5893 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5899 /// Creates a new CResult_BestBlockDecodeErrorZ which has the same data as `orig`
5900 /// but with all dynamically-allocated buffers duplicated in new buffers.
5901 pub extern "C" fn CResult_BestBlockDecodeErrorZ_clone(orig: &CResult_BestBlockDecodeErrorZ) -> CResult_BestBlockDecodeErrorZ { Clone::clone(&orig) }
5903 /// A tuple of 2 elements. See the individual fields for the types contained.
5904 pub struct C2Tuple_usizeTransactionZ {
5905 /// The element at position 0
5907 /// The element at position 1
5908 pub b: crate::c_types::Transaction,
5910 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
5911 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
5918 impl C2Tuple_usizeTransactionZ {
5919 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
5923 impl Clone for C2Tuple_usizeTransactionZ {
5924 fn clone(&self) -> Self {
5926 a: Clone::clone(&self.a),
5927 b: Clone::clone(&self.b),
5932 /// Creates a new tuple which has the same data as `orig`
5933 /// but with all dynamically-allocated buffers duplicated in new buffers.
5934 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
5935 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
5937 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
5938 C2Tuple_usizeTransactionZ { a, b, }
5942 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
5943 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
5945 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5946 /// This corresponds to std::vector in C++
5947 pub struct CVec_C2Tuple_usizeTransactionZZ {
5948 /// The elements in the array.
5949 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5950 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
5951 /// The number of elements pointed to by `data`.
5954 impl CVec_C2Tuple_usizeTransactionZZ {
5955 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
5956 if self.datalen == 0 { return Vec::new(); }
5957 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5958 self.data = core::ptr::null_mut();
5962 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
5963 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5966 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
5967 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
5968 let datalen = v.len();
5969 let data = Box::into_raw(v.into_boxed_slice());
5970 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5974 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5975 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
5976 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
5977 fn drop(&mut self) {
5978 if self.datalen == 0 { return; }
5979 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5982 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
5983 fn clone(&self) -> Self {
5984 let mut res = Vec::new();
5985 if self.datalen == 0 { return Self::from(res); }
5986 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5991 /// A tuple of 3 elements. See the individual fields for the types contained.
5992 pub struct C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5993 /// The element at position 0
5994 pub a: crate::c_types::ThirtyTwoBytes,
5995 /// The element at position 1
5997 /// The element at position 2
5998 pub c: crate::c_types::derived::COption_ThirtyTwoBytesZ,
6000 impl From<(crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6001 fn from (tup: (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self {
6009 impl C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6010 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ) {
6011 (self.a, self.b, self.c)
6014 impl Clone for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6015 fn clone(&self) -> Self {
6017 a: Clone::clone(&self.a),
6018 b: Clone::clone(&self.b),
6019 c: Clone::clone(&self.c),
6024 /// Creates a new tuple which has the same data as `orig`
6025 /// but with all dynamically-allocated buffers duplicated in new buffers.
6026 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig: &C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { Clone::clone(&orig) }
6027 /// Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements.
6029 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a: crate::c_types::ThirtyTwoBytes, b: u32, c: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6030 C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { a, b, c, }
6034 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ.
6035 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res: C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) { }
6037 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZs of arbitrary size.
6038 /// This corresponds to std::vector in C++
6039 pub struct CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6040 /// The elements in the array.
6041 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6042 pub data: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ,
6043 /// The number of elements pointed to by `data`.
6046 impl CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6047 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ> {
6048 if self.datalen == 0 { return Vec::new(); }
6049 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6050 self.data = core::ptr::null_mut();
6054 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ] {
6055 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6058 impl From<Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>> for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6059 fn from(v: Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>) -> Self {
6060 let datalen = v.len();
6061 let data = Box::into_raw(v.into_boxed_slice());
6062 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6066 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6067 pub extern "C" fn CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res: CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ) { }
6068 impl Drop for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6069 fn drop(&mut self) {
6070 if self.datalen == 0 { return; }
6071 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6074 impl Clone for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6075 fn clone(&self) -> Self {
6076 let mut res = Vec::new();
6077 if self.datalen == 0 { return Self::from(res); }
6078 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6083 /// The contents of CResult_ChannelMonitorUpdateStatusNoneZ
6084 pub union CResult_ChannelMonitorUpdateStatusNoneZPtr {
6085 /// A pointer to the contents in the success state.
6086 /// Reading from this pointer when `result_ok` is not set is undefined.
6087 pub result: *mut crate::lightning::chain::ChannelMonitorUpdateStatus,
6088 /// Note that this value is always NULL, as there are no contents in the Err variant
6089 pub err: *mut core::ffi::c_void,
6092 /// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation,
6093 /// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure.
6094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6095 pub struct CResult_ChannelMonitorUpdateStatusNoneZ {
6096 /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either
6097 /// `err` or `result` depending on the state of `result_ok`.
6098 pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr,
6099 /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state.
6100 pub result_ok: bool,
6103 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state.
6104 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ {
6105 CResult_ChannelMonitorUpdateStatusNoneZ {
6106 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6107 result: Box::into_raw(Box::new(o)),
6113 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state.
6114 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ {
6115 CResult_ChannelMonitorUpdateStatusNoneZ {
6116 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6117 err: core::ptr::null_mut(),
6122 /// Checks if the given object is currently in the success state
6124 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool {
6128 /// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ.
6129 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { }
6130 impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ {
6131 fn drop(&mut self) {
6133 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6134 let _ = unsafe { Box::from_raw(self.contents.result) };
6140 impl From<crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>> for CResult_ChannelMonitorUpdateStatusNoneZ {
6141 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>) -> Self {
6142 let contents = if o.result_ok {
6143 let result = unsafe { o.contents.result };
6144 unsafe { o.contents.result = core::ptr::null_mut() };
6145 CResult_ChannelMonitorUpdateStatusNoneZPtr { result }
6147 let _ = unsafe { Box::from_raw(o.contents.err) };
6148 o.contents.err = core::ptr::null_mut();
6149 CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() }
6153 result_ok: o.result_ok,
6157 impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ {
6158 fn clone(&self) -> Self {
6160 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6161 result: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateStatus>::clone(unsafe { &*self.contents.result })))
6164 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6165 err: core::ptr::null_mut()
6171 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig`
6172 /// but with all dynamically-allocated buffers duplicated in new buffers.
6173 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) }
6175 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
6176 /// This corresponds to std::vector in C++
6177 pub struct CVec_MonitorEventZ {
6178 /// The elements in the array.
6179 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6180 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
6181 /// The number of elements pointed to by `data`.
6184 impl CVec_MonitorEventZ {
6185 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
6186 if self.datalen == 0 { return Vec::new(); }
6187 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6188 self.data = core::ptr::null_mut();
6192 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
6193 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6196 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
6197 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
6198 let datalen = v.len();
6199 let data = Box::into_raw(v.into_boxed_slice());
6200 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6204 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6205 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
6206 impl Drop for CVec_MonitorEventZ {
6207 fn drop(&mut self) {
6208 if self.datalen == 0 { return; }
6209 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6212 impl Clone for CVec_MonitorEventZ {
6213 fn clone(&self) -> Self {
6214 let mut res = Vec::new();
6215 if self.datalen == 0 { return Self::from(res); }
6216 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6221 /// A tuple of 4 elements. See the individual fields for the types contained.
6222 pub struct C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6223 /// The element at position 0
6224 pub a: crate::lightning::chain::transaction::OutPoint,
6225 /// The element at position 1
6226 pub b: crate::lightning::ln::types::ChannelId,
6227 /// The element at position 2
6228 pub c: crate::c_types::derived::CVec_MonitorEventZ,
6229 /// The element at position 3
6230 pub d: crate::c_types::PublicKey,
6232 impl From<(crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6233 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
6242 impl C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6243 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
6244 (self.a, self.b, self.c, self.d)
6247 impl Clone for C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6248 fn clone(&self) -> Self {
6250 a: Clone::clone(&self.a),
6251 b: Clone::clone(&self.b),
6252 c: Clone::clone(&self.c),
6253 d: Clone::clone(&self.d),
6258 /// Creates a new tuple which has the same data as `orig`
6259 /// but with all dynamically-allocated buffers duplicated in new buffers.
6260 pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig: &C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) -> C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
6261 /// Creates a new C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ from the contained elements.
6263 pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId, c: crate::c_types::derived::CVec_MonitorEventZ, d: crate::c_types::PublicKey) -> C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6264 C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { a, b, c, d, }
6268 /// Frees any resources used by the C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ.
6269 pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res: C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) { }
6271 /// A dynamically-allocated array of crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZs of arbitrary size.
6272 /// This corresponds to std::vector in C++
6273 pub struct CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6274 /// The elements in the array.
6275 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6276 pub data: *mut crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ,
6277 /// The number of elements pointed to by `data`.
6280 impl CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6281 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ> {
6282 if self.datalen == 0 { return Vec::new(); }
6283 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6284 self.data = core::ptr::null_mut();
6288 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ] {
6289 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6292 impl From<Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ>> for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6293 fn from(v: Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ>) -> Self {
6294 let datalen = v.len();
6295 let data = Box::into_raw(v.into_boxed_slice());
6296 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6300 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6301 pub extern "C" fn CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ) { }
6302 impl Drop for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6303 fn drop(&mut self) {
6304 if self.datalen == 0 { return; }
6305 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6308 impl Clone for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6309 fn clone(&self) -> Self {
6310 let mut res = Vec::new();
6311 if self.datalen == 0 { return Self::from(res); }
6312 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6317 /// The contents of CResult_InitFeaturesDecodeErrorZ
6318 pub union CResult_InitFeaturesDecodeErrorZPtr {
6319 /// A pointer to the contents in the success state.
6320 /// Reading from this pointer when `result_ok` is not set is undefined.
6321 pub result: *mut crate::lightning::ln::features::InitFeatures,
6322 /// A pointer to the contents in the error state.
6323 /// Reading from this pointer when `result_ok` is set is undefined.
6324 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6327 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
6328 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6330 pub struct CResult_InitFeaturesDecodeErrorZ {
6331 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
6332 /// `err` or `result` depending on the state of `result_ok`.
6333 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
6334 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
6335 pub result_ok: bool,
6338 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
6339 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
6340 CResult_InitFeaturesDecodeErrorZ {
6341 contents: CResult_InitFeaturesDecodeErrorZPtr {
6342 result: Box::into_raw(Box::new(o)),
6348 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
6349 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
6350 CResult_InitFeaturesDecodeErrorZ {
6351 contents: CResult_InitFeaturesDecodeErrorZPtr {
6352 err: Box::into_raw(Box::new(e)),
6357 /// Checks if the given object is currently in the success state
6359 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
6363 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
6364 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
6365 impl Drop for CResult_InitFeaturesDecodeErrorZ {
6366 fn drop(&mut self) {
6368 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6369 let _ = unsafe { Box::from_raw(self.contents.result) };
6372 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6373 let _ = unsafe { Box::from_raw(self.contents.err) };
6378 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
6379 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6380 let contents = if o.result_ok {
6381 let result = unsafe { o.contents.result };
6382 unsafe { o.contents.result = core::ptr::null_mut() };
6383 CResult_InitFeaturesDecodeErrorZPtr { result }
6385 let err = unsafe { o.contents.err };
6386 unsafe { o.contents.err = core::ptr::null_mut(); }
6387 CResult_InitFeaturesDecodeErrorZPtr { err }
6391 result_ok: o.result_ok,
6395 impl Clone for CResult_InitFeaturesDecodeErrorZ {
6396 fn clone(&self) -> Self {
6398 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
6399 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
6402 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
6403 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6409 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
6410 /// but with all dynamically-allocated buffers duplicated in new buffers.
6411 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
6413 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
6414 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
6415 /// A pointer to the contents in the success state.
6416 /// Reading from this pointer when `result_ok` is not set is undefined.
6417 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
6418 /// A pointer to the contents in the error state.
6419 /// Reading from this pointer when `result_ok` is set is undefined.
6420 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6423 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
6424 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6425 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6426 pub struct CResult_ChannelFeaturesDecodeErrorZ {
6427 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
6428 /// `err` or `result` depending on the state of `result_ok`.
6429 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
6430 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
6431 pub result_ok: bool,
6434 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
6435 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
6436 CResult_ChannelFeaturesDecodeErrorZ {
6437 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6438 result: Box::into_raw(Box::new(o)),
6444 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
6445 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
6446 CResult_ChannelFeaturesDecodeErrorZ {
6447 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6448 err: Box::into_raw(Box::new(e)),
6453 /// Checks if the given object is currently in the success state
6455 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
6459 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
6460 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
6461 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
6462 fn drop(&mut self) {
6464 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6465 let _ = unsafe { Box::from_raw(self.contents.result) };
6468 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6469 let _ = unsafe { Box::from_raw(self.contents.err) };
6474 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
6475 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6476 let contents = if o.result_ok {
6477 let result = unsafe { o.contents.result };
6478 unsafe { o.contents.result = core::ptr::null_mut() };
6479 CResult_ChannelFeaturesDecodeErrorZPtr { result }
6481 let err = unsafe { o.contents.err };
6482 unsafe { o.contents.err = core::ptr::null_mut(); }
6483 CResult_ChannelFeaturesDecodeErrorZPtr { err }
6487 result_ok: o.result_ok,
6491 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
6492 fn clone(&self) -> Self {
6494 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6495 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
6498 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6499 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6505 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
6506 /// but with all dynamically-allocated buffers duplicated in new buffers.
6507 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
6509 /// The contents of CResult_NodeFeaturesDecodeErrorZ
6510 pub union CResult_NodeFeaturesDecodeErrorZPtr {
6511 /// A pointer to the contents in the success state.
6512 /// Reading from this pointer when `result_ok` is not set is undefined.
6513 pub result: *mut crate::lightning::ln::features::NodeFeatures,
6514 /// A pointer to the contents in the error state.
6515 /// Reading from this pointer when `result_ok` is set is undefined.
6516 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6519 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
6520 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6521 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6522 pub struct CResult_NodeFeaturesDecodeErrorZ {
6523 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
6524 /// `err` or `result` depending on the state of `result_ok`.
6525 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
6526 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
6527 pub result_ok: bool,
6530 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
6531 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
6532 CResult_NodeFeaturesDecodeErrorZ {
6533 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6534 result: Box::into_raw(Box::new(o)),
6540 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
6541 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
6542 CResult_NodeFeaturesDecodeErrorZ {
6543 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6544 err: Box::into_raw(Box::new(e)),
6549 /// Checks if the given object is currently in the success state
6551 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
6555 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
6556 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
6557 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
6558 fn drop(&mut self) {
6560 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6561 let _ = unsafe { Box::from_raw(self.contents.result) };
6564 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6565 let _ = unsafe { Box::from_raw(self.contents.err) };
6570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
6571 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6572 let contents = if o.result_ok {
6573 let result = unsafe { o.contents.result };
6574 unsafe { o.contents.result = core::ptr::null_mut() };
6575 CResult_NodeFeaturesDecodeErrorZPtr { result }
6577 let err = unsafe { o.contents.err };
6578 unsafe { o.contents.err = core::ptr::null_mut(); }
6579 CResult_NodeFeaturesDecodeErrorZPtr { err }
6583 result_ok: o.result_ok,
6587 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
6588 fn clone(&self) -> Self {
6590 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6591 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
6594 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6595 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6601 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
6602 /// but with all dynamically-allocated buffers duplicated in new buffers.
6603 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6605 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
6606 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6607 /// A pointer to the contents in the success state.
6608 /// Reading from this pointer when `result_ok` is not set is undefined.
6609 pub result: *mut crate::lightning::ln::features::Bolt11InvoiceFeatures,
6610 /// A pointer to the contents in the error state.
6611 /// Reading from this pointer when `result_ok` is set is undefined.
6612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6615 /// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6616 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6618 pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6619 /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
6620 /// `err` or `result` depending on the state of `result_ok`.
6621 pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
6622 /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
6623 pub result_ok: bool,
6626 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
6627 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6628 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6629 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6630 result: Box::into_raw(Box::new(o)),
6636 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
6637 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6638 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6639 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6640 err: Box::into_raw(Box::new(e)),
6645 /// Checks if the given object is currently in the success state
6647 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
6651 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
6652 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
6653 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6654 fn drop(&mut self) {
6656 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6657 let _ = unsafe { Box::from_raw(self.contents.result) };
6660 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6661 let _ = unsafe { Box::from_raw(self.contents.err) };
6666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6667 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6668 let contents = if o.result_ok {
6669 let result = unsafe { o.contents.result };
6670 unsafe { o.contents.result = core::ptr::null_mut() };
6671 CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
6673 let err = unsafe { o.contents.err };
6674 unsafe { o.contents.err = core::ptr::null_mut(); }
6675 CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
6679 result_ok: o.result_ok,
6683 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6684 fn clone(&self) -> Self {
6686 Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6687 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6690 Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6691 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6697 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6698 /// but with all dynamically-allocated buffers duplicated in new buffers.
6699 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6701 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
6702 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6703 /// A pointer to the contents in the success state.
6704 /// Reading from this pointer when `result_ok` is not set is undefined.
6705 pub result: *mut crate::lightning::ln::features::Bolt12InvoiceFeatures,
6706 /// A pointer to the contents in the error state.
6707 /// Reading from this pointer when `result_ok` is set is undefined.
6708 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6711 /// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6712 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6714 pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6715 /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
6716 /// `err` or `result` depending on the state of `result_ok`.
6717 pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
6718 /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
6719 pub result_ok: bool,
6722 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
6723 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6724 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6725 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6726 result: Box::into_raw(Box::new(o)),
6732 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
6733 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6734 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6735 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6736 err: Box::into_raw(Box::new(e)),
6741 /// Checks if the given object is currently in the success state
6743 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
6747 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
6748 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
6749 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6750 fn drop(&mut self) {
6752 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6753 let _ = unsafe { Box::from_raw(self.contents.result) };
6756 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6757 let _ = unsafe { Box::from_raw(self.contents.err) };
6762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6763 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6764 let contents = if o.result_ok {
6765 let result = unsafe { o.contents.result };
6766 unsafe { o.contents.result = core::ptr::null_mut() };
6767 CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
6769 let err = unsafe { o.contents.err };
6770 unsafe { o.contents.err = core::ptr::null_mut(); }
6771 CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
6775 result_ok: o.result_ok,
6779 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6780 fn clone(&self) -> Self {
6782 Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6783 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6786 Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6787 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6793 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6794 /// but with all dynamically-allocated buffers duplicated in new buffers.
6795 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6797 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
6798 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
6799 /// A pointer to the contents in the success state.
6800 /// Reading from this pointer when `result_ok` is not set is undefined.
6801 pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
6802 /// A pointer to the contents in the error state.
6803 /// Reading from this pointer when `result_ok` is set is undefined.
6804 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6807 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
6808 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6809 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6810 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
6811 /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
6812 /// `err` or `result` depending on the state of `result_ok`.
6813 pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
6814 /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
6815 pub result_ok: bool,
6818 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
6819 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6820 CResult_BlindedHopFeaturesDecodeErrorZ {
6821 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6822 result: Box::into_raw(Box::new(o)),
6828 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
6829 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6830 CResult_BlindedHopFeaturesDecodeErrorZ {
6831 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6832 err: Box::into_raw(Box::new(e)),
6837 /// Checks if the given object is currently in the success state
6839 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
6843 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
6844 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
6845 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
6846 fn drop(&mut self) {
6848 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6849 let _ = unsafe { Box::from_raw(self.contents.result) };
6852 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6853 let _ = unsafe { Box::from_raw(self.contents.err) };
6858 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
6859 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6860 let contents = if o.result_ok {
6861 let result = unsafe { o.contents.result };
6862 unsafe { o.contents.result = core::ptr::null_mut() };
6863 CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
6865 let err = unsafe { o.contents.err };
6866 unsafe { o.contents.err = core::ptr::null_mut(); }
6867 CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
6871 result_ok: o.result_ok,
6875 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
6876 fn clone(&self) -> Self {
6878 Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6879 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
6882 Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6883 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6889 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
6890 /// but with all dynamically-allocated buffers duplicated in new buffers.
6891 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
6893 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
6894 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6895 /// A pointer to the contents in the success state.
6896 /// Reading from this pointer when `result_ok` is not set is undefined.
6897 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
6898 /// A pointer to the contents in the error state.
6899 /// Reading from this pointer when `result_ok` is set is undefined.
6900 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6903 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
6904 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6905 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6906 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
6907 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
6908 /// `err` or `result` depending on the state of `result_ok`.
6909 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
6910 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
6911 pub result_ok: bool,
6914 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
6915 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6916 CResult_ChannelTypeFeaturesDecodeErrorZ {
6917 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6918 result: Box::into_raw(Box::new(o)),
6924 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
6925 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6926 CResult_ChannelTypeFeaturesDecodeErrorZ {
6927 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6928 err: Box::into_raw(Box::new(e)),
6933 /// Checks if the given object is currently in the success state
6935 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
6939 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
6940 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
6941 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
6942 fn drop(&mut self) {
6944 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6945 let _ = unsafe { Box::from_raw(self.contents.result) };
6948 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6949 let _ = unsafe { Box::from_raw(self.contents.err) };
6954 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
6955 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6956 let contents = if o.result_ok {
6957 let result = unsafe { o.contents.result };
6958 unsafe { o.contents.result = core::ptr::null_mut() };
6959 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
6961 let err = unsafe { o.contents.err };
6962 unsafe { o.contents.err = core::ptr::null_mut(); }
6963 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
6967 result_ok: o.result_ok,
6971 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
6972 fn clone(&self) -> Self {
6974 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6975 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
6978 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6979 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6985 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
6986 /// but with all dynamically-allocated buffers duplicated in new buffers.
6987 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6989 /// The contents of CResult_OfferIdDecodeErrorZ
6990 pub union CResult_OfferIdDecodeErrorZPtr {
6991 /// A pointer to the contents in the success state.
6992 /// Reading from this pointer when `result_ok` is not set is undefined.
6993 pub result: *mut crate::lightning::offers::offer::OfferId,
6994 /// A pointer to the contents in the error state.
6995 /// Reading from this pointer when `result_ok` is set is undefined.
6996 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6999 /// A CResult_OfferIdDecodeErrorZ represents the result of a fallible operation,
7000 /// containing a crate::lightning::offers::offer::OfferId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7001 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7002 pub struct CResult_OfferIdDecodeErrorZ {
7003 /// The contents of this CResult_OfferIdDecodeErrorZ, accessible via either
7004 /// `err` or `result` depending on the state of `result_ok`.
7005 pub contents: CResult_OfferIdDecodeErrorZPtr,
7006 /// Whether this CResult_OfferIdDecodeErrorZ represents a success state.
7007 pub result_ok: bool,
7010 /// Creates a new CResult_OfferIdDecodeErrorZ in the success state.
7011 pub extern "C" fn CResult_OfferIdDecodeErrorZ_ok(o: crate::lightning::offers::offer::OfferId) -> CResult_OfferIdDecodeErrorZ {
7012 CResult_OfferIdDecodeErrorZ {
7013 contents: CResult_OfferIdDecodeErrorZPtr {
7014 result: Box::into_raw(Box::new(o)),
7020 /// Creates a new CResult_OfferIdDecodeErrorZ in the error state.
7021 pub extern "C" fn CResult_OfferIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferIdDecodeErrorZ {
7022 CResult_OfferIdDecodeErrorZ {
7023 contents: CResult_OfferIdDecodeErrorZPtr {
7024 err: Box::into_raw(Box::new(e)),
7029 /// Checks if the given object is currently in the success state
7031 pub extern "C" fn CResult_OfferIdDecodeErrorZ_is_ok(o: &CResult_OfferIdDecodeErrorZ) -> bool {
7035 /// Frees any resources used by the CResult_OfferIdDecodeErrorZ.
7036 pub extern "C" fn CResult_OfferIdDecodeErrorZ_free(_res: CResult_OfferIdDecodeErrorZ) { }
7037 impl Drop for CResult_OfferIdDecodeErrorZ {
7038 fn drop(&mut self) {
7040 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7041 let _ = unsafe { Box::from_raw(self.contents.result) };
7044 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7045 let _ = unsafe { Box::from_raw(self.contents.err) };
7050 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferId, crate::lightning::ln::msgs::DecodeError>> for CResult_OfferIdDecodeErrorZ {
7051 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferId, crate::lightning::ln::msgs::DecodeError>) -> Self {
7052 let contents = if o.result_ok {
7053 let result = unsafe { o.contents.result };
7054 unsafe { o.contents.result = core::ptr::null_mut() };
7055 CResult_OfferIdDecodeErrorZPtr { result }
7057 let err = unsafe { o.contents.err };
7058 unsafe { o.contents.err = core::ptr::null_mut(); }
7059 CResult_OfferIdDecodeErrorZPtr { err }
7063 result_ok: o.result_ok,
7067 impl Clone for CResult_OfferIdDecodeErrorZ {
7068 fn clone(&self) -> Self {
7070 Self { result_ok: true, contents: CResult_OfferIdDecodeErrorZPtr {
7071 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::OfferId>::clone(unsafe { &*self.contents.result })))
7074 Self { result_ok: false, contents: CResult_OfferIdDecodeErrorZPtr {
7075 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7081 /// Creates a new CResult_OfferIdDecodeErrorZ which has the same data as `orig`
7082 /// but with all dynamically-allocated buffers duplicated in new buffers.
7083 pub extern "C" fn CResult_OfferIdDecodeErrorZ_clone(orig: &CResult_OfferIdDecodeErrorZ) -> CResult_OfferIdDecodeErrorZ { Clone::clone(&orig) }
7085 /// The contents of CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ
7086 pub union CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7087 /// A pointer to the contents in the success state.
7088 /// Reading from this pointer when `result_ok` is not set is undefined.
7089 pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder,
7090 /// A pointer to the contents in the error state.
7091 /// Reading from this pointer when `result_ok` is set is undefined.
7092 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7095 /// A CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
7096 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7097 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7098 pub struct CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7099 /// The contents of this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ, accessible via either
7100 /// `err` or `result` depending on the state of `result_ok`.
7101 pub contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr,
7102 /// Whether this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents a success state.
7103 pub result_ok: bool,
7106 /// Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the success state.
7107 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder) -> CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7108 CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7109 contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7110 result: Box::into_raw(Box::new(o)),
7116 /// Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the error state.
7117 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7118 CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7119 contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7120 err: Box::into_raw(Box::new(e)),
7125 /// Checks if the given object is currently in the success state
7127 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ) -> bool {
7131 /// Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ.
7132 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ) { }
7133 impl Drop for CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7134 fn drop(&mut self) {
7136 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7137 let _ = unsafe { Box::from_raw(self.contents.result) };
7140 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7141 let _ = unsafe { Box::from_raw(self.contents.err) };
7146 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7147 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7148 let contents = if o.result_ok {
7149 let result = unsafe { o.contents.result };
7150 unsafe { o.contents.result = core::ptr::null_mut() };
7151 CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { result }
7153 let err = unsafe { o.contents.err };
7154 unsafe { o.contents.err = core::ptr::null_mut(); }
7155 CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { err }
7159 result_ok: o.result_ok,
7164 /// The contents of CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ
7165 pub union CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7166 /// A pointer to the contents in the success state.
7167 /// Reading from this pointer when `result_ok` is not set is undefined.
7168 pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder,
7169 /// A pointer to the contents in the error state.
7170 /// Reading from this pointer when `result_ok` is set is undefined.
7171 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7174 /// A CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
7175 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7176 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7177 pub struct CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7178 /// The contents of this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ, accessible via either
7179 /// `err` or `result` depending on the state of `result_ok`.
7180 pub contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr,
7181 /// Whether this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents a success state.
7182 pub result_ok: bool,
7185 /// Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the success state.
7186 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder) -> CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7187 CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7188 contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7189 result: Box::into_raw(Box::new(o)),
7195 /// Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the error state.
7196 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7197 CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7198 contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7199 err: Box::into_raw(Box::new(e)),
7204 /// Checks if the given object is currently in the success state
7206 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ) -> bool {
7210 /// Frees any resources used by the CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ.
7211 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ) { }
7212 impl Drop for CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7213 fn drop(&mut self) {
7215 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7216 let _ = unsafe { Box::from_raw(self.contents.result) };
7219 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7220 let _ = unsafe { Box::from_raw(self.contents.err) };
7225 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7226 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7227 let contents = if o.result_ok {
7228 let result = unsafe { o.contents.result };
7229 unsafe { o.contents.result = core::ptr::null_mut() };
7230 CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { result }
7232 let err = unsafe { o.contents.err };
7233 unsafe { o.contents.err = core::ptr::null_mut(); }
7234 CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { err }
7238 result_ok: o.result_ok,
7243 /// The contents of CResult_OfferBolt12ParseErrorZ
7244 pub union CResult_OfferBolt12ParseErrorZPtr {
7245 /// A pointer to the contents in the success state.
7246 /// Reading from this pointer when `result_ok` is not set is undefined.
7247 pub result: *mut crate::lightning::offers::offer::Offer,
7248 /// A pointer to the contents in the error state.
7249 /// Reading from this pointer when `result_ok` is set is undefined.
7250 pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
7253 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
7254 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
7255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7256 pub struct CResult_OfferBolt12ParseErrorZ {
7257 /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
7258 /// `err` or `result` depending on the state of `result_ok`.
7259 pub contents: CResult_OfferBolt12ParseErrorZPtr,
7260 /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
7261 pub result_ok: bool,
7264 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
7265 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
7266 CResult_OfferBolt12ParseErrorZ {
7267 contents: CResult_OfferBolt12ParseErrorZPtr {
7268 result: Box::into_raw(Box::new(o)),
7274 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
7275 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
7276 CResult_OfferBolt12ParseErrorZ {
7277 contents: CResult_OfferBolt12ParseErrorZPtr {
7278 err: Box::into_raw(Box::new(e)),
7283 /// Checks if the given object is currently in the success state
7285 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
7289 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
7290 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
7291 impl Drop for CResult_OfferBolt12ParseErrorZ {
7292 fn drop(&mut self) {
7294 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7295 let _ = unsafe { Box::from_raw(self.contents.result) };
7298 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7299 let _ = unsafe { Box::from_raw(self.contents.err) };
7304 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
7305 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
7306 let contents = if o.result_ok {
7307 let result = unsafe { o.contents.result };
7308 unsafe { o.contents.result = core::ptr::null_mut() };
7309 CResult_OfferBolt12ParseErrorZPtr { result }
7311 let err = unsafe { o.contents.err };
7312 unsafe { o.contents.err = core::ptr::null_mut(); }
7313 CResult_OfferBolt12ParseErrorZPtr { err }
7317 result_ok: o.result_ok,
7321 impl Clone for CResult_OfferBolt12ParseErrorZ {
7322 fn clone(&self) -> Self {
7324 Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
7325 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
7328 Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
7329 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
7335 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
7336 /// but with all dynamically-allocated buffers duplicated in new buffers.
7337 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
7339 /// The contents of CResult_NodeIdDecodeErrorZ
7340 pub union CResult_NodeIdDecodeErrorZPtr {
7341 /// A pointer to the contents in the success state.
7342 /// Reading from this pointer when `result_ok` is not set is undefined.
7343 pub result: *mut crate::lightning::routing::gossip::NodeId,
7344 /// A pointer to the contents in the error state.
7345 /// Reading from this pointer when `result_ok` is set is undefined.
7346 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7349 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
7350 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7352 pub struct CResult_NodeIdDecodeErrorZ {
7353 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
7354 /// `err` or `result` depending on the state of `result_ok`.
7355 pub contents: CResult_NodeIdDecodeErrorZPtr,
7356 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
7357 pub result_ok: bool,
7360 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
7361 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
7362 CResult_NodeIdDecodeErrorZ {
7363 contents: CResult_NodeIdDecodeErrorZPtr {
7364 result: Box::into_raw(Box::new(o)),
7370 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
7371 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
7372 CResult_NodeIdDecodeErrorZ {
7373 contents: CResult_NodeIdDecodeErrorZPtr {
7374 err: Box::into_raw(Box::new(e)),
7379 /// Checks if the given object is currently in the success state
7381 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
7385 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
7386 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
7387 impl Drop for CResult_NodeIdDecodeErrorZ {
7388 fn drop(&mut self) {
7390 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7391 let _ = unsafe { Box::from_raw(self.contents.result) };
7394 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7395 let _ = unsafe { Box::from_raw(self.contents.err) };
7400 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
7401 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
7402 let contents = if o.result_ok {
7403 let result = unsafe { o.contents.result };
7404 unsafe { o.contents.result = core::ptr::null_mut() };
7405 CResult_NodeIdDecodeErrorZPtr { result }
7407 let err = unsafe { o.contents.err };
7408 unsafe { o.contents.err = core::ptr::null_mut(); }
7409 CResult_NodeIdDecodeErrorZPtr { err }
7413 result_ok: o.result_ok,
7417 impl Clone for CResult_NodeIdDecodeErrorZ {
7418 fn clone(&self) -> Self {
7420 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
7421 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
7424 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
7425 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7431 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
7432 /// but with all dynamically-allocated buffers duplicated in new buffers.
7433 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
7435 /// The contents of CResult_PublicKeySecp256k1ErrorZ
7436 pub union CResult_PublicKeySecp256k1ErrorZPtr {
7437 /// A pointer to the contents in the success state.
7438 /// Reading from this pointer when `result_ok` is not set is undefined.
7439 pub result: *mut crate::c_types::PublicKey,
7440 /// A pointer to the contents in the error state.
7441 /// Reading from this pointer when `result_ok` is set is undefined.
7442 pub err: *mut crate::c_types::Secp256k1Error,
7445 /// A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation,
7446 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
7447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7448 pub struct CResult_PublicKeySecp256k1ErrorZ {
7449 /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either
7450 /// `err` or `result` depending on the state of `result_ok`.
7451 pub contents: CResult_PublicKeySecp256k1ErrorZPtr,
7452 /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state.
7453 pub result_ok: bool,
7456 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state.
7457 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ {
7458 CResult_PublicKeySecp256k1ErrorZ {
7459 contents: CResult_PublicKeySecp256k1ErrorZPtr {
7460 result: Box::into_raw(Box::new(o)),
7466 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state.
7467 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ {
7468 CResult_PublicKeySecp256k1ErrorZ {
7469 contents: CResult_PublicKeySecp256k1ErrorZPtr {
7470 err: Box::into_raw(Box::new(e)),
7475 /// Checks if the given object is currently in the success state
7477 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool {
7481 /// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ.
7482 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { }
7483 impl Drop for CResult_PublicKeySecp256k1ErrorZ {
7484 fn drop(&mut self) {
7486 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7487 let _ = unsafe { Box::from_raw(self.contents.result) };
7490 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7491 let _ = unsafe { Box::from_raw(self.contents.err) };
7496 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecp256k1ErrorZ {
7497 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
7498 let contents = if o.result_ok {
7499 let result = unsafe { o.contents.result };
7500 unsafe { o.contents.result = core::ptr::null_mut() };
7501 CResult_PublicKeySecp256k1ErrorZPtr { result }
7503 let err = unsafe { o.contents.err };
7504 unsafe { o.contents.err = core::ptr::null_mut(); }
7505 CResult_PublicKeySecp256k1ErrorZPtr { err }
7509 result_ok: o.result_ok,
7513 impl Clone for CResult_PublicKeySecp256k1ErrorZ {
7514 fn clone(&self) -> Self {
7516 Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr {
7517 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7520 Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr {
7521 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
7527 /// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig`
7528 /// but with all dynamically-allocated buffers duplicated in new buffers.
7529 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) }
7532 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
7533 pub enum COption_NetworkUpdateZ {
7534 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
7535 Some(crate::lightning::routing::gossip::NetworkUpdate),
7536 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
7539 impl COption_NetworkUpdateZ {
7540 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7541 if let Self::None = self { false } else { true }
7543 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7546 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
7547 if let Self::Some(v) = self { v } else { unreachable!() }
7551 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
7552 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
7553 COption_NetworkUpdateZ::Some(o)
7556 /// Constructs a new COption_NetworkUpdateZ containing nothing
7557 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
7558 COption_NetworkUpdateZ::None
7561 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
7562 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
7564 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
7565 /// but with all dynamically-allocated buffers duplicated in new buffers.
7566 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
7568 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
7569 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7570 /// A pointer to the contents in the success state.
7571 /// Reading from this pointer when `result_ok` is not set is undefined.
7572 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
7573 /// A pointer to the contents in the error state.
7574 /// Reading from this pointer when `result_ok` is set is undefined.
7575 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7578 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
7579 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7580 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7581 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
7582 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
7583 /// `err` or `result` depending on the state of `result_ok`.
7584 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
7585 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
7586 pub result_ok: bool,
7589 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
7590 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
7591 CResult_COption_NetworkUpdateZDecodeErrorZ {
7592 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7593 result: Box::into_raw(Box::new(o)),
7599 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
7600 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
7601 CResult_COption_NetworkUpdateZDecodeErrorZ {
7602 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7603 err: Box::into_raw(Box::new(e)),
7608 /// Checks if the given object is currently in the success state
7610 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
7614 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
7615 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
7616 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
7617 fn drop(&mut self) {
7619 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7620 let _ = unsafe { Box::from_raw(self.contents.result) };
7623 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7624 let _ = unsafe { Box::from_raw(self.contents.err) };
7629 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
7630 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7631 let contents = if o.result_ok {
7632 let result = unsafe { o.contents.result };
7633 unsafe { o.contents.result = core::ptr::null_mut() };
7634 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
7636 let err = unsafe { o.contents.err };
7637 unsafe { o.contents.err = core::ptr::null_mut(); }
7638 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
7642 result_ok: o.result_ok,
7646 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
7647 fn clone(&self) -> Self {
7649 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7650 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
7653 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7654 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7660 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
7661 /// but with all dynamically-allocated buffers duplicated in new buffers.
7662 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
7664 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
7665 pub enum COption_UtxoLookupZ {
7666 /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
7667 Some(crate::lightning::routing::utxo::UtxoLookup),
7668 /// When we're in this state, this COption_UtxoLookupZ contains nothing
7671 impl COption_UtxoLookupZ {
7672 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7673 if let Self::None = self { false } else { true }
7675 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7678 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
7679 if let Self::Some(v) = self { v } else { unreachable!() }
7683 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
7684 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
7685 COption_UtxoLookupZ::Some(o)
7688 /// Constructs a new COption_UtxoLookupZ containing nothing
7689 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
7690 COption_UtxoLookupZ::None
7693 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
7694 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
7696 /// The contents of CResult_NoneLightningErrorZ
7697 pub union CResult_NoneLightningErrorZPtr {
7698 /// Note that this value is always NULL, as there are no contents in the OK variant
7699 pub result: *mut core::ffi::c_void,
7700 /// A pointer to the contents in the error state.
7701 /// Reading from this pointer when `result_ok` is set is undefined.
7702 pub err: *mut crate::lightning::ln::msgs::LightningError,
7705 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7706 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7708 pub struct CResult_NoneLightningErrorZ {
7709 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7710 /// `err` or `result` depending on the state of `result_ok`.
7711 pub contents: CResult_NoneLightningErrorZPtr,
7712 /// Whether this CResult_NoneLightningErrorZ represents a success state.
7713 pub result_ok: bool,
7716 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7717 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7718 CResult_NoneLightningErrorZ {
7719 contents: CResult_NoneLightningErrorZPtr {
7720 result: core::ptr::null_mut(),
7726 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7727 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7728 CResult_NoneLightningErrorZ {
7729 contents: CResult_NoneLightningErrorZPtr {
7730 err: Box::into_raw(Box::new(e)),
7735 /// Checks if the given object is currently in the success state
7737 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
7741 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7742 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7743 impl Drop for CResult_NoneLightningErrorZ {
7744 fn drop(&mut self) {
7747 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7748 let _ = unsafe { Box::from_raw(self.contents.err) };
7753 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7754 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7755 let contents = if o.result_ok {
7756 let _ = unsafe { Box::from_raw(o.contents.result) };
7757 o.contents.result = core::ptr::null_mut();
7758 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
7760 let err = unsafe { o.contents.err };
7761 unsafe { o.contents.err = core::ptr::null_mut(); }
7762 CResult_NoneLightningErrorZPtr { err }
7766 result_ok: o.result_ok,
7770 impl Clone for CResult_NoneLightningErrorZ {
7771 fn clone(&self) -> Self {
7773 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7774 result: core::ptr::null_mut()
7777 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
7778 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7784 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
7785 /// but with all dynamically-allocated buffers duplicated in new buffers.
7786 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
7788 /// The contents of CResult_boolLightningErrorZ
7789 pub union CResult_boolLightningErrorZPtr {
7790 /// A pointer to the contents in the success state.
7791 /// Reading from this pointer when `result_ok` is not set is undefined.
7792 pub result: *mut bool,
7793 /// A pointer to the contents in the error state.
7794 /// Reading from this pointer when `result_ok` is set is undefined.
7795 pub err: *mut crate::lightning::ln::msgs::LightningError,
7798 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
7799 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7801 pub struct CResult_boolLightningErrorZ {
7802 /// The contents of this CResult_boolLightningErrorZ, accessible via either
7803 /// `err` or `result` depending on the state of `result_ok`.
7804 pub contents: CResult_boolLightningErrorZPtr,
7805 /// Whether this CResult_boolLightningErrorZ represents a success state.
7806 pub result_ok: bool,
7809 /// Creates a new CResult_boolLightningErrorZ in the success state.
7810 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
7811 CResult_boolLightningErrorZ {
7812 contents: CResult_boolLightningErrorZPtr {
7813 result: Box::into_raw(Box::new(o)),
7819 /// Creates a new CResult_boolLightningErrorZ in the error state.
7820 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
7821 CResult_boolLightningErrorZ {
7822 contents: CResult_boolLightningErrorZPtr {
7823 err: Box::into_raw(Box::new(e)),
7828 /// Checks if the given object is currently in the success state
7830 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
7834 /// Frees any resources used by the CResult_boolLightningErrorZ.
7835 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
7836 impl Drop for CResult_boolLightningErrorZ {
7837 fn drop(&mut self) {
7839 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7840 let _ = unsafe { Box::from_raw(self.contents.result) };
7843 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7844 let _ = unsafe { Box::from_raw(self.contents.err) };
7849 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
7850 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
7851 let contents = if o.result_ok {
7852 let result = unsafe { o.contents.result };
7853 unsafe { o.contents.result = core::ptr::null_mut() };
7854 CResult_boolLightningErrorZPtr { result }
7856 let err = unsafe { o.contents.err };
7857 unsafe { o.contents.err = core::ptr::null_mut(); }
7858 CResult_boolLightningErrorZPtr { err }
7862 result_ok: o.result_ok,
7866 impl Clone for CResult_boolLightningErrorZ {
7867 fn clone(&self) -> Self {
7869 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
7870 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
7873 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
7874 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
7880 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
7881 /// but with all dynamically-allocated buffers duplicated in new buffers.
7882 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
7884 /// A tuple of 3 elements. See the individual fields for the types contained.
7885 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7886 /// The element at position 0
7887 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
7888 /// The element at position 1
7889 pub b: crate::lightning::ln::msgs::ChannelUpdate,
7890 /// The element at position 2
7891 pub c: crate::lightning::ln::msgs::ChannelUpdate,
7893 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7894 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
7902 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7903 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
7904 (self.a, self.b, self.c)
7907 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7908 fn clone(&self) -> Self {
7910 a: Clone::clone(&self.a),
7911 b: Clone::clone(&self.b),
7912 c: Clone::clone(&self.c),
7917 /// Creates a new tuple which has the same data as `orig`
7918 /// but with all dynamically-allocated buffers duplicated in new buffers.
7919 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
7920 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
7922 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 {
7923 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
7927 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
7928 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
7931 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
7932 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7933 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
7934 Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
7935 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
7938 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7939 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7940 if let Self::None = self { false } else { true }
7942 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7945 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7946 if let Self::Some(v) = self { v } else { unreachable!() }
7950 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
7951 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7952 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
7955 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
7956 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7957 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
7960 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
7961 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
7963 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
7964 /// but with all dynamically-allocated buffers duplicated in new buffers.
7965 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
7967 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
7968 /// This corresponds to std::vector in C++
7969 pub struct CVec_MessageSendEventZ {
7970 /// The elements in the array.
7971 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7972 pub data: *mut crate::lightning::events::MessageSendEvent,
7973 /// The number of elements pointed to by `data`.
7976 impl CVec_MessageSendEventZ {
7977 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
7978 if self.datalen == 0 { return Vec::new(); }
7979 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7980 self.data = core::ptr::null_mut();
7984 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
7985 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7988 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
7989 fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
7990 let datalen = v.len();
7991 let data = Box::into_raw(v.into_boxed_slice());
7992 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7996 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7997 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
7998 impl Drop for CVec_MessageSendEventZ {
7999 fn drop(&mut self) {
8000 if self.datalen == 0 { return; }
8001 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8004 impl Clone for CVec_MessageSendEventZ {
8005 fn clone(&self) -> Self {
8006 let mut res = Vec::new();
8007 if self.datalen == 0 { return Self::from(res); }
8008 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8013 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
8014 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
8015 /// A pointer to the contents in the success state.
8016 /// Reading from this pointer when `result_ok` is not set is undefined.
8017 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
8018 /// A pointer to the contents in the error state.
8019 /// Reading from this pointer when `result_ok` is set is undefined.
8020 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8023 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
8024 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8025 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8026 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
8027 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
8028 /// `err` or `result` depending on the state of `result_ok`.
8029 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
8030 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
8031 pub result_ok: bool,
8034 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
8035 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
8036 CResult_ChannelUpdateInfoDecodeErrorZ {
8037 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8038 result: Box::into_raw(Box::new(o)),
8044 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
8045 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
8046 CResult_ChannelUpdateInfoDecodeErrorZ {
8047 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8048 err: Box::into_raw(Box::new(e)),
8053 /// Checks if the given object is currently in the success state
8055 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
8059 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
8060 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
8061 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
8062 fn drop(&mut self) {
8064 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8065 let _ = unsafe { Box::from_raw(self.contents.result) };
8068 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8069 let _ = unsafe { Box::from_raw(self.contents.err) };
8074 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
8075 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8076 let contents = if o.result_ok {
8077 let result = unsafe { o.contents.result };
8078 unsafe { o.contents.result = core::ptr::null_mut() };
8079 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
8081 let err = unsafe { o.contents.err };
8082 unsafe { o.contents.err = core::ptr::null_mut(); }
8083 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
8087 result_ok: o.result_ok,
8091 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
8092 fn clone(&self) -> Self {
8094 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8095 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
8098 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8099 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8105 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
8106 /// but with all dynamically-allocated buffers duplicated in new buffers.
8107 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
8109 /// The contents of CResult_ChannelInfoDecodeErrorZ
8110 pub union CResult_ChannelInfoDecodeErrorZPtr {
8111 /// A pointer to the contents in the success state.
8112 /// Reading from this pointer when `result_ok` is not set is undefined.
8113 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
8114 /// A pointer to the contents in the error state.
8115 /// Reading from this pointer when `result_ok` is set is undefined.
8116 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8119 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8120 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8121 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8122 pub struct CResult_ChannelInfoDecodeErrorZ {
8123 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8124 /// `err` or `result` depending on the state of `result_ok`.
8125 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
8126 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8127 pub result_ok: bool,
8130 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8131 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
8132 CResult_ChannelInfoDecodeErrorZ {
8133 contents: CResult_ChannelInfoDecodeErrorZPtr {
8134 result: Box::into_raw(Box::new(o)),
8140 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8141 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
8142 CResult_ChannelInfoDecodeErrorZ {
8143 contents: CResult_ChannelInfoDecodeErrorZPtr {
8144 err: Box::into_raw(Box::new(e)),
8149 /// Checks if the given object is currently in the success state
8151 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
8155 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8156 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
8157 impl Drop for CResult_ChannelInfoDecodeErrorZ {
8158 fn drop(&mut self) {
8160 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8161 let _ = unsafe { Box::from_raw(self.contents.result) };
8164 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8165 let _ = unsafe { Box::from_raw(self.contents.err) };
8170 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
8171 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8172 let contents = if o.result_ok {
8173 let result = unsafe { o.contents.result };
8174 unsafe { o.contents.result = core::ptr::null_mut() };
8175 CResult_ChannelInfoDecodeErrorZPtr { result }
8177 let err = unsafe { o.contents.err };
8178 unsafe { o.contents.err = core::ptr::null_mut(); }
8179 CResult_ChannelInfoDecodeErrorZPtr { err }
8183 result_ok: o.result_ok,
8187 impl Clone for CResult_ChannelInfoDecodeErrorZ {
8188 fn clone(&self) -> Self {
8190 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
8191 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
8194 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
8195 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8201 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8202 /// but with all dynamically-allocated buffers duplicated in new buffers.
8203 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8205 /// The contents of CResult_RoutingFeesDecodeErrorZ
8206 pub union CResult_RoutingFeesDecodeErrorZPtr {
8207 /// A pointer to the contents in the success state.
8208 /// Reading from this pointer when `result_ok` is not set is undefined.
8209 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
8210 /// A pointer to the contents in the error state.
8211 /// Reading from this pointer when `result_ok` is set is undefined.
8212 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8215 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8216 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8217 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8218 pub struct CResult_RoutingFeesDecodeErrorZ {
8219 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8220 /// `err` or `result` depending on the state of `result_ok`.
8221 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8222 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8223 pub result_ok: bool,
8226 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8227 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8228 CResult_RoutingFeesDecodeErrorZ {
8229 contents: CResult_RoutingFeesDecodeErrorZPtr {
8230 result: Box::into_raw(Box::new(o)),
8236 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8237 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
8238 CResult_RoutingFeesDecodeErrorZ {
8239 contents: CResult_RoutingFeesDecodeErrorZPtr {
8240 err: Box::into_raw(Box::new(e)),
8245 /// Checks if the given object is currently in the success state
8247 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
8251 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8252 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
8253 impl Drop for CResult_RoutingFeesDecodeErrorZ {
8254 fn drop(&mut self) {
8256 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8257 let _ = unsafe { Box::from_raw(self.contents.result) };
8260 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8261 let _ = unsafe { Box::from_raw(self.contents.err) };
8266 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
8267 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
8268 let contents = if o.result_ok {
8269 let result = unsafe { o.contents.result };
8270 unsafe { o.contents.result = core::ptr::null_mut() };
8271 CResult_RoutingFeesDecodeErrorZPtr { result }
8273 let err = unsafe { o.contents.err };
8274 unsafe { o.contents.err = core::ptr::null_mut(); }
8275 CResult_RoutingFeesDecodeErrorZPtr { err }
8279 result_ok: o.result_ok,
8283 impl Clone for CResult_RoutingFeesDecodeErrorZ {
8284 fn clone(&self) -> Self {
8286 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
8287 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
8290 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
8291 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8297 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8298 /// but with all dynamically-allocated buffers duplicated in new buffers.
8299 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
8301 /// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size.
8302 /// This corresponds to std::vector in C++
8303 pub struct CVec_SocketAddressZ {
8304 /// The elements in the array.
8305 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8306 pub data: *mut crate::lightning::ln::msgs::SocketAddress,
8307 /// The number of elements pointed to by `data`.
8310 impl CVec_SocketAddressZ {
8311 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::SocketAddress> {
8312 if self.datalen == 0 { return Vec::new(); }
8313 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8314 self.data = core::ptr::null_mut();
8318 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] {
8319 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8322 impl From<Vec<crate::lightning::ln::msgs::SocketAddress>> for CVec_SocketAddressZ {
8323 fn from(v: Vec<crate::lightning::ln::msgs::SocketAddress>) -> Self {
8324 let datalen = v.len();
8325 let data = Box::into_raw(v.into_boxed_slice());
8326 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8330 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8331 pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { }
8332 impl Drop for CVec_SocketAddressZ {
8333 fn drop(&mut self) {
8334 if self.datalen == 0 { return; }
8335 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8338 impl Clone for CVec_SocketAddressZ {
8339 fn clone(&self) -> Self {
8340 let mut res = Vec::new();
8341 if self.datalen == 0 { return Self::from(res); }
8342 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8347 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8348 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8349 /// A pointer to the contents in the success state.
8350 /// Reading from this pointer when `result_ok` is not set is undefined.
8351 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
8352 /// A pointer to the contents in the error state.
8353 /// Reading from this pointer when `result_ok` is set is undefined.
8354 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8357 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8358 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8360 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
8361 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8362 /// `err` or `result` depending on the state of `result_ok`.
8363 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
8364 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8365 pub result_ok: bool,
8368 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8369 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8370 CResult_NodeAnnouncementInfoDecodeErrorZ {
8371 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8372 result: Box::into_raw(Box::new(o)),
8378 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8379 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8380 CResult_NodeAnnouncementInfoDecodeErrorZ {
8381 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8382 err: Box::into_raw(Box::new(e)),
8387 /// Checks if the given object is currently in the success state
8389 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
8393 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8394 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
8395 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
8396 fn drop(&mut self) {
8398 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8399 let _ = unsafe { Box::from_raw(self.contents.result) };
8402 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8403 let _ = unsafe { Box::from_raw(self.contents.err) };
8408 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
8409 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8410 let contents = if o.result_ok {
8411 let result = unsafe { o.contents.result };
8412 unsafe { o.contents.result = core::ptr::null_mut() };
8413 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
8415 let err = unsafe { o.contents.err };
8416 unsafe { o.contents.err = core::ptr::null_mut(); }
8417 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
8421 result_ok: o.result_ok,
8425 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
8426 fn clone(&self) -> Self {
8428 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8429 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
8432 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8433 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8439 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8440 /// but with all dynamically-allocated buffers duplicated in new buffers.
8441 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
8443 /// The contents of CResult_NodeAliasDecodeErrorZ
8444 pub union CResult_NodeAliasDecodeErrorZPtr {
8445 /// A pointer to the contents in the success state.
8446 /// Reading from this pointer when `result_ok` is not set is undefined.
8447 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
8448 /// A pointer to the contents in the error state.
8449 /// Reading from this pointer when `result_ok` is set is undefined.
8450 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8453 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
8454 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
8455 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8456 pub struct CResult_NodeAliasDecodeErrorZ {
8457 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
8458 /// `err` or `result` depending on the state of `result_ok`.
8459 pub contents: CResult_NodeAliasDecodeErrorZPtr,
8460 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
8461 pub result_ok: bool,
8464 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
8465 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
8466 CResult_NodeAliasDecodeErrorZ {
8467 contents: CResult_NodeAliasDecodeErrorZPtr {
8468 result: Box::into_raw(Box::new(o)),
8474 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
8475 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
8476 CResult_NodeAliasDecodeErrorZ {
8477 contents: CResult_NodeAliasDecodeErrorZPtr {
8478 err: Box::into_raw(Box::new(e)),
8483 /// Checks if the given object is currently in the success state
8485 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
8489 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
8490 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
8491 impl Drop for CResult_NodeAliasDecodeErrorZ {
8492 fn drop(&mut self) {
8494 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8495 let _ = unsafe { Box::from_raw(self.contents.result) };
8498 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8499 let _ = unsafe { Box::from_raw(self.contents.err) };
8504 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
8505 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
8506 let contents = if o.result_ok {
8507 let result = unsafe { o.contents.result };
8508 unsafe { o.contents.result = core::ptr::null_mut() };
8509 CResult_NodeAliasDecodeErrorZPtr { result }
8511 let err = unsafe { o.contents.err };
8512 unsafe { o.contents.err = core::ptr::null_mut(); }
8513 CResult_NodeAliasDecodeErrorZPtr { err }
8517 result_ok: o.result_ok,
8521 impl Clone for CResult_NodeAliasDecodeErrorZ {
8522 fn clone(&self) -> Self {
8524 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
8525 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
8528 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
8529 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8535 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
8536 /// but with all dynamically-allocated buffers duplicated in new buffers.
8537 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
8539 /// The contents of CResult_NodeInfoDecodeErrorZ
8540 pub union CResult_NodeInfoDecodeErrorZPtr {
8541 /// A pointer to the contents in the success state.
8542 /// Reading from this pointer when `result_ok` is not set is undefined.
8543 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
8544 /// A pointer to the contents in the error state.
8545 /// Reading from this pointer when `result_ok` is set is undefined.
8546 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8549 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8550 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8552 pub struct CResult_NodeInfoDecodeErrorZ {
8553 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8554 /// `err` or `result` depending on the state of `result_ok`.
8555 pub contents: CResult_NodeInfoDecodeErrorZPtr,
8556 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8557 pub result_ok: bool,
8560 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8561 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
8562 CResult_NodeInfoDecodeErrorZ {
8563 contents: CResult_NodeInfoDecodeErrorZPtr {
8564 result: Box::into_raw(Box::new(o)),
8570 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8571 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
8572 CResult_NodeInfoDecodeErrorZ {
8573 contents: CResult_NodeInfoDecodeErrorZPtr {
8574 err: Box::into_raw(Box::new(e)),
8579 /// Checks if the given object is currently in the success state
8581 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
8585 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8586 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
8587 impl Drop for CResult_NodeInfoDecodeErrorZ {
8588 fn drop(&mut self) {
8590 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8591 let _ = unsafe { Box::from_raw(self.contents.result) };
8594 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8595 let _ = unsafe { Box::from_raw(self.contents.err) };
8600 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
8601 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8602 let contents = if o.result_ok {
8603 let result = unsafe { o.contents.result };
8604 unsafe { o.contents.result = core::ptr::null_mut() };
8605 CResult_NodeInfoDecodeErrorZPtr { result }
8607 let err = unsafe { o.contents.err };
8608 unsafe { o.contents.err = core::ptr::null_mut(); }
8609 CResult_NodeInfoDecodeErrorZPtr { err }
8613 result_ok: o.result_ok,
8617 impl Clone for CResult_NodeInfoDecodeErrorZ {
8618 fn clone(&self) -> Self {
8620 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
8621 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
8624 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
8625 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8631 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8632 /// but with all dynamically-allocated buffers duplicated in new buffers.
8633 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
8635 /// The contents of CResult_NetworkGraphDecodeErrorZ
8636 pub union CResult_NetworkGraphDecodeErrorZPtr {
8637 /// A pointer to the contents in the success state.
8638 /// Reading from this pointer when `result_ok` is not set is undefined.
8639 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
8640 /// A pointer to the contents in the error state.
8641 /// Reading from this pointer when `result_ok` is set is undefined.
8642 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8645 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8646 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
8647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8648 pub struct CResult_NetworkGraphDecodeErrorZ {
8649 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8650 /// `err` or `result` depending on the state of `result_ok`.
8651 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
8652 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8653 pub result_ok: bool,
8656 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8657 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
8658 CResult_NetworkGraphDecodeErrorZ {
8659 contents: CResult_NetworkGraphDecodeErrorZPtr {
8660 result: Box::into_raw(Box::new(o)),
8666 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8667 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
8668 CResult_NetworkGraphDecodeErrorZ {
8669 contents: CResult_NetworkGraphDecodeErrorZPtr {
8670 err: Box::into_raw(Box::new(e)),
8675 /// Checks if the given object is currently in the success state
8677 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
8681 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8682 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
8683 impl Drop for CResult_NetworkGraphDecodeErrorZ {
8684 fn drop(&mut self) {
8686 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8687 let _ = unsafe { Box::from_raw(self.contents.result) };
8690 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8691 let _ = unsafe { Box::from_raw(self.contents.err) };
8696 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
8697 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
8698 let contents = if o.result_ok {
8699 let result = unsafe { o.contents.result };
8700 unsafe { o.contents.result = core::ptr::null_mut() };
8701 CResult_NetworkGraphDecodeErrorZPtr { result }
8703 let err = unsafe { o.contents.err };
8704 unsafe { o.contents.err = core::ptr::null_mut(); }
8705 CResult_NetworkGraphDecodeErrorZPtr { err }
8709 result_ok: o.result_ok,
8715 /// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
8716 pub enum COption_CVec_SocketAddressZZ {
8717 /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ
8718 Some(crate::c_types::derived::CVec_SocketAddressZ),
8719 /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing
8722 impl COption_CVec_SocketAddressZZ {
8723 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8724 if let Self::None = self { false } else { true }
8726 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8729 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_SocketAddressZ {
8730 if let Self::Some(v) = self { v } else { unreachable!() }
8734 /// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
8735 pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ {
8736 COption_CVec_SocketAddressZZ::Some(o)
8739 /// Constructs a new COption_CVec_SocketAddressZZ containing nothing
8740 pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ {
8741 COption_CVec_SocketAddressZZ::None
8744 /// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state
8745 pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { }
8747 /// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig`
8748 /// but with all dynamically-allocated buffers duplicated in new buffers.
8749 pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) }
8751 /// The contents of CResult_u64ShortChannelIdErrorZ
8752 pub union CResult_u64ShortChannelIdErrorZPtr {
8753 /// A pointer to the contents in the success state.
8754 /// Reading from this pointer when `result_ok` is not set is undefined.
8755 pub result: *mut u64,
8756 /// A pointer to the contents in the error state.
8757 /// Reading from this pointer when `result_ok` is set is undefined.
8758 pub err: *mut crate::lightning::util::scid_utils::ShortChannelIdError,
8761 /// A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation,
8762 /// containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure.
8763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8764 pub struct CResult_u64ShortChannelIdErrorZ {
8765 /// The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either
8766 /// `err` or `result` depending on the state of `result_ok`.
8767 pub contents: CResult_u64ShortChannelIdErrorZPtr,
8768 /// Whether this CResult_u64ShortChannelIdErrorZ represents a success state.
8769 pub result_ok: bool,
8772 /// Creates a new CResult_u64ShortChannelIdErrorZ in the success state.
8773 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_ok(o: u64) -> CResult_u64ShortChannelIdErrorZ {
8774 CResult_u64ShortChannelIdErrorZ {
8775 contents: CResult_u64ShortChannelIdErrorZPtr {
8776 result: Box::into_raw(Box::new(o)),
8782 /// Creates a new CResult_u64ShortChannelIdErrorZ in the error state.
8783 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_err(e: crate::lightning::util::scid_utils::ShortChannelIdError) -> CResult_u64ShortChannelIdErrorZ {
8784 CResult_u64ShortChannelIdErrorZ {
8785 contents: CResult_u64ShortChannelIdErrorZPtr {
8786 err: Box::into_raw(Box::new(e)),
8791 /// Checks if the given object is currently in the success state
8793 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_is_ok(o: &CResult_u64ShortChannelIdErrorZ) -> bool {
8797 /// Frees any resources used by the CResult_u64ShortChannelIdErrorZ.
8798 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_free(_res: CResult_u64ShortChannelIdErrorZ) { }
8799 impl Drop for CResult_u64ShortChannelIdErrorZ {
8800 fn drop(&mut self) {
8802 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8803 let _ = unsafe { Box::from_raw(self.contents.result) };
8806 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8807 let _ = unsafe { Box::from_raw(self.contents.err) };
8812 impl From<crate::c_types::CResultTempl<u64, crate::lightning::util::scid_utils::ShortChannelIdError>> for CResult_u64ShortChannelIdErrorZ {
8813 fn from(mut o: crate::c_types::CResultTempl<u64, crate::lightning::util::scid_utils::ShortChannelIdError>) -> Self {
8814 let contents = if o.result_ok {
8815 let result = unsafe { o.contents.result };
8816 unsafe { o.contents.result = core::ptr::null_mut() };
8817 CResult_u64ShortChannelIdErrorZPtr { result }
8819 let err = unsafe { o.contents.err };
8820 unsafe { o.contents.err = core::ptr::null_mut(); }
8821 CResult_u64ShortChannelIdErrorZPtr { err }
8825 result_ok: o.result_ok,
8830 /// The contents of CResult_PendingHTLCInfoInboundHTLCErrZ
8831 pub union CResult_PendingHTLCInfoInboundHTLCErrZPtr {
8832 /// A pointer to the contents in the success state.
8833 /// Reading from this pointer when `result_ok` is not set is undefined.
8834 pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
8835 /// A pointer to the contents in the error state.
8836 /// Reading from this pointer when `result_ok` is set is undefined.
8837 pub err: *mut crate::lightning::ln::onion_payment::InboundHTLCErr,
8840 /// A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation,
8841 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure.
8842 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8843 pub struct CResult_PendingHTLCInfoInboundHTLCErrZ {
8844 /// The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either
8845 /// `err` or `result` depending on the state of `result_ok`.
8846 pub contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr,
8847 /// Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state.
8848 pub result_ok: bool,
8851 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state.
8852 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
8853 CResult_PendingHTLCInfoInboundHTLCErrZ {
8854 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
8855 result: Box::into_raw(Box::new(o)),
8861 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state.
8862 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_err(e: crate::lightning::ln::onion_payment::InboundHTLCErr) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
8863 CResult_PendingHTLCInfoInboundHTLCErrZ {
8864 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
8865 err: Box::into_raw(Box::new(e)),
8870 /// Checks if the given object is currently in the success state
8872 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> bool {
8876 /// Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ.
8877 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res: CResult_PendingHTLCInfoInboundHTLCErrZ) { }
8878 impl Drop for CResult_PendingHTLCInfoInboundHTLCErrZ {
8879 fn drop(&mut self) {
8881 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8882 let _ = unsafe { Box::from_raw(self.contents.result) };
8885 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8886 let _ = unsafe { Box::from_raw(self.contents.err) };
8891 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>> for CResult_PendingHTLCInfoInboundHTLCErrZ {
8892 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>) -> Self {
8893 let contents = if o.result_ok {
8894 let result = unsafe { o.contents.result };
8895 unsafe { o.contents.result = core::ptr::null_mut() };
8896 CResult_PendingHTLCInfoInboundHTLCErrZPtr { result }
8898 let err = unsafe { o.contents.err };
8899 unsafe { o.contents.err = core::ptr::null_mut(); }
8900 CResult_PendingHTLCInfoInboundHTLCErrZPtr { err }
8904 result_ok: o.result_ok,
8909 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
8910 /// This corresponds to std::vector in C++
8911 pub struct CVec_HTLCOutputInCommitmentZ {
8912 /// The elements in the array.
8913 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8914 pub data: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
8915 /// The number of elements pointed to by `data`.
8918 impl CVec_HTLCOutputInCommitmentZ {
8919 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment> {
8920 if self.datalen == 0 { return Vec::new(); }
8921 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8922 self.data = core::ptr::null_mut();
8926 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::HTLCOutputInCommitment] {
8927 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8930 impl From<Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>> for CVec_HTLCOutputInCommitmentZ {
8931 fn from(v: Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>) -> Self {
8932 let datalen = v.len();
8933 let data = Box::into_raw(v.into_boxed_slice());
8934 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8938 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8939 pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { }
8940 impl Drop for CVec_HTLCOutputInCommitmentZ {
8941 fn drop(&mut self) {
8942 if self.datalen == 0 { return; }
8943 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8946 impl Clone for CVec_HTLCOutputInCommitmentZ {
8947 fn clone(&self) -> Self {
8948 let mut res = Vec::new();
8949 if self.datalen == 0 { return Self::from(res); }
8950 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8955 /// A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size.
8956 /// This corresponds to std::vector in C++
8957 pub struct CVec_HTLCDescriptorZ {
8958 /// The elements in the array.
8959 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8960 pub data: *mut crate::lightning::sign::HTLCDescriptor,
8961 /// The number of elements pointed to by `data`.
8964 impl CVec_HTLCDescriptorZ {
8965 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::HTLCDescriptor> {
8966 if self.datalen == 0 { return Vec::new(); }
8967 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8968 self.data = core::ptr::null_mut();
8972 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::HTLCDescriptor] {
8973 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8976 impl From<Vec<crate::lightning::sign::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
8977 fn from(v: Vec<crate::lightning::sign::HTLCDescriptor>) -> Self {
8978 let datalen = v.len();
8979 let data = Box::into_raw(v.into_boxed_slice());
8980 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8984 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8985 pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { }
8986 impl Drop for CVec_HTLCDescriptorZ {
8987 fn drop(&mut self) {
8988 if self.datalen == 0 { return; }
8989 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8992 impl Clone for CVec_HTLCDescriptorZ {
8993 fn clone(&self) -> Self {
8994 let mut res = Vec::new();
8995 if self.datalen == 0 { return Self::from(res); }
8996 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9001 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
9002 /// This corresponds to std::vector in C++
9003 pub struct CVec_UtxoZ {
9004 /// The elements in the array.
9005 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9006 pub data: *mut crate::lightning::events::bump_transaction::Utxo,
9007 /// The number of elements pointed to by `data`.
9011 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Utxo> {
9012 if self.datalen == 0 { return Vec::new(); }
9013 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9014 self.data = core::ptr::null_mut();
9018 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Utxo] {
9019 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9022 impl From<Vec<crate::lightning::events::bump_transaction::Utxo>> for CVec_UtxoZ {
9023 fn from(v: Vec<crate::lightning::events::bump_transaction::Utxo>) -> Self {
9024 let datalen = v.len();
9025 let data = Box::into_raw(v.into_boxed_slice());
9026 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9030 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9031 pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { }
9032 impl Drop for CVec_UtxoZ {
9033 fn drop(&mut self) {
9034 if self.datalen == 0 { return; }
9035 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9038 impl Clone for CVec_UtxoZ {
9039 fn clone(&self) -> Self {
9040 let mut res = Vec::new();
9041 if self.datalen == 0 { return Self::from(res); }
9042 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9048 /// An enum which can either contain a crate::c_types::TxOut or not
9049 pub enum COption_TxOutZ {
9050 /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
9051 Some(crate::c_types::TxOut),
9052 /// When we're in this state, this COption_TxOutZ contains nothing
9055 impl COption_TxOutZ {
9056 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9057 if let Self::None = self { false } else { true }
9059 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9062 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut {
9063 if let Self::Some(v) = self { v } else { unreachable!() }
9067 /// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
9068 pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ {
9069 COption_TxOutZ::Some(o)
9072 /// Constructs a new COption_TxOutZ containing nothing
9073 pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ {
9074 COption_TxOutZ::None
9077 /// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
9078 pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { }
9080 /// Creates a new COption_TxOutZ which has the same data as `orig`
9081 /// but with all dynamically-allocated buffers duplicated in new buffers.
9082 pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) }
9084 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
9085 /// This corresponds to std::vector in C++
9086 pub struct CVec_InputZ {
9087 /// The elements in the array.
9088 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9089 pub data: *mut crate::lightning::events::bump_transaction::Input,
9090 /// The number of elements pointed to by `data`.
9094 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Input> {
9095 if self.datalen == 0 { return Vec::new(); }
9096 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9097 self.data = core::ptr::null_mut();
9101 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Input] {
9102 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9105 impl From<Vec<crate::lightning::events::bump_transaction::Input>> for CVec_InputZ {
9106 fn from(v: Vec<crate::lightning::events::bump_transaction::Input>) -> Self {
9107 let datalen = v.len();
9108 let data = Box::into_raw(v.into_boxed_slice());
9109 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9113 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9114 pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { }
9115 impl Drop for CVec_InputZ {
9116 fn drop(&mut self) {
9117 if self.datalen == 0 { return; }
9118 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9121 impl Clone for CVec_InputZ {
9122 fn clone(&self) -> Self {
9123 let mut res = Vec::new();
9124 if self.datalen == 0 { return Self::from(res); }
9125 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9130 /// The contents of CResult_CoinSelectionNoneZ
9131 pub union CResult_CoinSelectionNoneZPtr {
9132 /// A pointer to the contents in the success state.
9133 /// Reading from this pointer when `result_ok` is not set is undefined.
9134 pub result: *mut crate::lightning::events::bump_transaction::CoinSelection,
9135 /// Note that this value is always NULL, as there are no contents in the Err variant
9136 pub err: *mut core::ffi::c_void,
9139 /// A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
9140 /// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
9141 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9142 pub struct CResult_CoinSelectionNoneZ {
9143 /// The contents of this CResult_CoinSelectionNoneZ, accessible via either
9144 /// `err` or `result` depending on the state of `result_ok`.
9145 pub contents: CResult_CoinSelectionNoneZPtr,
9146 /// Whether this CResult_CoinSelectionNoneZ represents a success state.
9147 pub result_ok: bool,
9150 /// Creates a new CResult_CoinSelectionNoneZ in the success state.
9151 pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ {
9152 CResult_CoinSelectionNoneZ {
9153 contents: CResult_CoinSelectionNoneZPtr {
9154 result: Box::into_raw(Box::new(o)),
9160 /// Creates a new CResult_CoinSelectionNoneZ in the error state.
9161 pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ {
9162 CResult_CoinSelectionNoneZ {
9163 contents: CResult_CoinSelectionNoneZPtr {
9164 err: core::ptr::null_mut(),
9169 /// Checks if the given object is currently in the success state
9171 pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool {
9175 /// Frees any resources used by the CResult_CoinSelectionNoneZ.
9176 pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { }
9177 impl Drop for CResult_CoinSelectionNoneZ {
9178 fn drop(&mut self) {
9180 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9181 let _ = unsafe { Box::from_raw(self.contents.result) };
9187 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>> for CResult_CoinSelectionNoneZ {
9188 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>) -> Self {
9189 let contents = if o.result_ok {
9190 let result = unsafe { o.contents.result };
9191 unsafe { o.contents.result = core::ptr::null_mut() };
9192 CResult_CoinSelectionNoneZPtr { result }
9194 let _ = unsafe { Box::from_raw(o.contents.err) };
9195 o.contents.err = core::ptr::null_mut();
9196 CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() }
9200 result_ok: o.result_ok,
9204 impl Clone for CResult_CoinSelectionNoneZ {
9205 fn clone(&self) -> Self {
9207 Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr {
9208 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::CoinSelection>::clone(unsafe { &*self.contents.result })))
9211 Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr {
9212 err: core::ptr::null_mut()
9218 /// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
9219 /// but with all dynamically-allocated buffers duplicated in new buffers.
9220 pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) }
9222 /// The contents of CResult_CVec_UtxoZNoneZ
9223 pub union CResult_CVec_UtxoZNoneZPtr {
9224 /// A pointer to the contents in the success state.
9225 /// Reading from this pointer when `result_ok` is not set is undefined.
9226 pub result: *mut crate::c_types::derived::CVec_UtxoZ,
9227 /// Note that this value is always NULL, as there are no contents in the Err variant
9228 pub err: *mut core::ffi::c_void,
9231 /// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
9232 /// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
9233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9234 pub struct CResult_CVec_UtxoZNoneZ {
9235 /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
9236 /// `err` or `result` depending on the state of `result_ok`.
9237 pub contents: CResult_CVec_UtxoZNoneZPtr,
9238 /// Whether this CResult_CVec_UtxoZNoneZ represents a success state.
9239 pub result_ok: bool,
9242 /// Creates a new CResult_CVec_UtxoZNoneZ in the success state.
9243 pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ {
9244 CResult_CVec_UtxoZNoneZ {
9245 contents: CResult_CVec_UtxoZNoneZPtr {
9246 result: Box::into_raw(Box::new(o)),
9252 /// Creates a new CResult_CVec_UtxoZNoneZ in the error state.
9253 pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ {
9254 CResult_CVec_UtxoZNoneZ {
9255 contents: CResult_CVec_UtxoZNoneZPtr {
9256 err: core::ptr::null_mut(),
9261 /// Checks if the given object is currently in the success state
9263 pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool {
9267 /// Frees any resources used by the CResult_CVec_UtxoZNoneZ.
9268 pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { }
9269 impl Drop for CResult_CVec_UtxoZNoneZ {
9270 fn drop(&mut self) {
9272 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9273 let _ = unsafe { Box::from_raw(self.contents.result) };
9279 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>> for CResult_CVec_UtxoZNoneZ {
9280 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>) -> Self {
9281 let contents = if o.result_ok {
9282 let result = unsafe { o.contents.result };
9283 unsafe { o.contents.result = core::ptr::null_mut() };
9284 CResult_CVec_UtxoZNoneZPtr { result }
9286 let _ = unsafe { Box::from_raw(o.contents.err) };
9287 o.contents.err = core::ptr::null_mut();
9288 CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() }
9292 result_ok: o.result_ok,
9296 impl Clone for CResult_CVec_UtxoZNoneZ {
9297 fn clone(&self) -> Self {
9299 Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr {
9300 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_UtxoZ>::clone(unsafe { &*self.contents.result })))
9303 Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr {
9304 err: core::ptr::null_mut()
9310 /// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
9311 /// but with all dynamically-allocated buffers duplicated in new buffers.
9312 pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) }
9315 /// An enum which can either contain a crate::lightning::blinded_path::payment::PaymentContext or not
9316 pub enum COption_PaymentContextZ {
9317 /// When we're in this state, this COption_PaymentContextZ contains a crate::lightning::blinded_path::payment::PaymentContext
9318 Some(crate::lightning::blinded_path::payment::PaymentContext),
9319 /// When we're in this state, this COption_PaymentContextZ contains nothing
9322 impl COption_PaymentContextZ {
9323 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9324 if let Self::None = self { false } else { true }
9326 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9329 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::blinded_path::payment::PaymentContext {
9330 if let Self::Some(v) = self { v } else { unreachable!() }
9334 /// Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext
9335 pub extern "C" fn COption_PaymentContextZ_some(o: crate::lightning::blinded_path::payment::PaymentContext) -> COption_PaymentContextZ {
9336 COption_PaymentContextZ::Some(o)
9339 /// Constructs a new COption_PaymentContextZ containing nothing
9340 pub extern "C" fn COption_PaymentContextZ_none() -> COption_PaymentContextZ {
9341 COption_PaymentContextZ::None
9344 /// Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state
9345 pub extern "C" fn COption_PaymentContextZ_free(_res: COption_PaymentContextZ) { }
9347 /// Creates a new COption_PaymentContextZ which has the same data as `orig`
9348 /// but with all dynamically-allocated buffers duplicated in new buffers.
9349 pub extern "C" fn COption_PaymentContextZ_clone(orig: &COption_PaymentContextZ) -> COption_PaymentContextZ { Clone::clone(&orig) }
9351 /// A tuple of 2 elements. See the individual fields for the types contained.
9352 pub struct C2Tuple_u64u16Z {
9353 /// The element at position 0
9355 /// The element at position 1
9358 impl From<(u64, u16)> for C2Tuple_u64u16Z {
9359 fn from (tup: (u64, u16)) -> Self {
9366 impl C2Tuple_u64u16Z {
9367 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u16) {
9371 impl Clone for C2Tuple_u64u16Z {
9372 fn clone(&self) -> Self {
9374 a: Clone::clone(&self.a),
9375 b: Clone::clone(&self.b),
9380 /// Creates a new tuple which has the same data as `orig`
9381 /// but with all dynamically-allocated buffers duplicated in new buffers.
9382 pub extern "C" fn C2Tuple_u64u16Z_clone(orig: &C2Tuple_u64u16Z) -> C2Tuple_u64u16Z { Clone::clone(&orig) }
9383 /// Creates a new C2Tuple_u64u16Z from the contained elements.
9385 pub extern "C" fn C2Tuple_u64u16Z_new(a: u64, b: u16) -> C2Tuple_u64u16Z {
9386 C2Tuple_u64u16Z { a, b, }
9390 /// Frees any resources used by the C2Tuple_u64u16Z.
9391 pub extern "C" fn C2Tuple_u64u16Z_free(_res: C2Tuple_u64u16Z) { }
9394 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not
9395 pub enum COption_C2Tuple_u64u16ZZ {
9396 /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z
9397 Some(crate::c_types::derived::C2Tuple_u64u16Z),
9398 /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing
9401 impl COption_C2Tuple_u64u16ZZ {
9402 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9403 if let Self::None = self { false } else { true }
9405 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9408 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u16Z {
9409 if let Self::Some(v) = self { v } else { unreachable!() }
9413 /// Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z
9414 pub extern "C" fn COption_C2Tuple_u64u16ZZ_some(o: crate::c_types::derived::C2Tuple_u64u16Z) -> COption_C2Tuple_u64u16ZZ {
9415 COption_C2Tuple_u64u16ZZ::Some(o)
9418 /// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing
9419 pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ {
9420 COption_C2Tuple_u64u16ZZ::None
9423 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state
9424 pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) { }
9426 /// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig`
9427 /// but with all dynamically-allocated buffers duplicated in new buffers.
9428 pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) }
9431 /// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
9432 pub enum COption_ChannelShutdownStateZ {
9433 /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
9434 Some(crate::lightning::ln::channelmanager::ChannelShutdownState),
9435 /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
9438 impl COption_ChannelShutdownStateZ {
9439 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9440 if let Self::None = self { false } else { true }
9442 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9445 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channelmanager::ChannelShutdownState {
9446 if let Self::Some(v) = self { v } else { unreachable!() }
9450 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
9451 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
9452 COption_ChannelShutdownStateZ::Some(o)
9455 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
9456 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
9457 COption_ChannelShutdownStateZ::None
9460 /// Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
9461 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
9463 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
9464 /// but with all dynamically-allocated buffers duplicated in new buffers.
9465 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
9467 /// The contents of CResult_ChannelIdAPIErrorZ
9468 pub union CResult_ChannelIdAPIErrorZPtr {
9469 /// A pointer to the contents in the success state.
9470 /// Reading from this pointer when `result_ok` is not set is undefined.
9471 pub result: *mut crate::lightning::ln::types::ChannelId,
9472 /// A pointer to the contents in the error state.
9473 /// Reading from this pointer when `result_ok` is set is undefined.
9474 pub err: *mut crate::lightning::util::errors::APIError,
9477 /// A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation,
9478 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::util::errors::APIError on failure.
9479 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9480 pub struct CResult_ChannelIdAPIErrorZ {
9481 /// The contents of this CResult_ChannelIdAPIErrorZ, accessible via either
9482 /// `err` or `result` depending on the state of `result_ok`.
9483 pub contents: CResult_ChannelIdAPIErrorZPtr,
9484 /// Whether this CResult_ChannelIdAPIErrorZ represents a success state.
9485 pub result_ok: bool,
9488 /// Creates a new CResult_ChannelIdAPIErrorZ in the success state.
9489 pub extern "C" fn CResult_ChannelIdAPIErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdAPIErrorZ {
9490 CResult_ChannelIdAPIErrorZ {
9491 contents: CResult_ChannelIdAPIErrorZPtr {
9492 result: Box::into_raw(Box::new(o)),
9498 /// Creates a new CResult_ChannelIdAPIErrorZ in the error state.
9499 pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ChannelIdAPIErrorZ {
9500 CResult_ChannelIdAPIErrorZ {
9501 contents: CResult_ChannelIdAPIErrorZPtr {
9502 err: Box::into_raw(Box::new(e)),
9507 /// Checks if the given object is currently in the success state
9509 pub extern "C" fn CResult_ChannelIdAPIErrorZ_is_ok(o: &CResult_ChannelIdAPIErrorZ) -> bool {
9513 /// Frees any resources used by the CResult_ChannelIdAPIErrorZ.
9514 pub extern "C" fn CResult_ChannelIdAPIErrorZ_free(_res: CResult_ChannelIdAPIErrorZ) { }
9515 impl Drop for CResult_ChannelIdAPIErrorZ {
9516 fn drop(&mut self) {
9518 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9519 let _ = unsafe { Box::from_raw(self.contents.result) };
9522 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9523 let _ = unsafe { Box::from_raw(self.contents.err) };
9528 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>> for CResult_ChannelIdAPIErrorZ {
9529 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>) -> Self {
9530 let contents = if o.result_ok {
9531 let result = unsafe { o.contents.result };
9532 unsafe { o.contents.result = core::ptr::null_mut() };
9533 CResult_ChannelIdAPIErrorZPtr { result }
9535 let err = unsafe { o.contents.err };
9536 unsafe { o.contents.err = core::ptr::null_mut(); }
9537 CResult_ChannelIdAPIErrorZPtr { err }
9541 result_ok: o.result_ok,
9545 impl Clone for CResult_ChannelIdAPIErrorZ {
9546 fn clone(&self) -> Self {
9548 Self { result_ok: true, contents: CResult_ChannelIdAPIErrorZPtr {
9549 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
9552 Self { result_ok: false, contents: CResult_ChannelIdAPIErrorZPtr {
9553 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9559 /// Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig`
9560 /// but with all dynamically-allocated buffers duplicated in new buffers.
9561 pub extern "C" fn CResult_ChannelIdAPIErrorZ_clone(orig: &CResult_ChannelIdAPIErrorZ) -> CResult_ChannelIdAPIErrorZ { Clone::clone(&orig) }
9563 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
9564 /// This corresponds to std::vector in C++
9565 pub struct CVec_RecentPaymentDetailsZ {
9566 /// The elements in the array.
9567 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9568 pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
9569 /// The number of elements pointed to by `data`.
9572 impl CVec_RecentPaymentDetailsZ {
9573 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
9574 if self.datalen == 0 { return Vec::new(); }
9575 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9576 self.data = core::ptr::null_mut();
9580 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
9581 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9584 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
9585 fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
9586 let datalen = v.len();
9587 let data = Box::into_raw(v.into_boxed_slice());
9588 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9592 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9593 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
9594 impl Drop for CVec_RecentPaymentDetailsZ {
9595 fn drop(&mut self) {
9596 if self.datalen == 0 { return; }
9597 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9601 /// The contents of CResult_NonePaymentSendFailureZ
9602 pub union CResult_NonePaymentSendFailureZPtr {
9603 /// Note that this value is always NULL, as there are no contents in the OK variant
9604 pub result: *mut core::ffi::c_void,
9605 /// A pointer to the contents in the error state.
9606 /// Reading from this pointer when `result_ok` is set is undefined.
9607 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9610 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
9611 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9613 pub struct CResult_NonePaymentSendFailureZ {
9614 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
9615 /// `err` or `result` depending on the state of `result_ok`.
9616 pub contents: CResult_NonePaymentSendFailureZPtr,
9617 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
9618 pub result_ok: bool,
9621 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
9622 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
9623 CResult_NonePaymentSendFailureZ {
9624 contents: CResult_NonePaymentSendFailureZPtr {
9625 result: core::ptr::null_mut(),
9631 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
9632 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
9633 CResult_NonePaymentSendFailureZ {
9634 contents: CResult_NonePaymentSendFailureZPtr {
9635 err: Box::into_raw(Box::new(e)),
9640 /// Checks if the given object is currently in the success state
9642 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
9646 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
9647 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
9648 impl Drop for CResult_NonePaymentSendFailureZ {
9649 fn drop(&mut self) {
9652 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9653 let _ = unsafe { Box::from_raw(self.contents.err) };
9658 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
9659 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9660 let contents = if o.result_ok {
9661 let _ = unsafe { Box::from_raw(o.contents.result) };
9662 o.contents.result = core::ptr::null_mut();
9663 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
9665 let err = unsafe { o.contents.err };
9666 unsafe { o.contents.err = core::ptr::null_mut(); }
9667 CResult_NonePaymentSendFailureZPtr { err }
9671 result_ok: o.result_ok,
9675 impl Clone for CResult_NonePaymentSendFailureZ {
9676 fn clone(&self) -> Self {
9678 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
9679 result: core::ptr::null_mut()
9682 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
9683 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9689 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9690 /// but with all dynamically-allocated buffers duplicated in new buffers.
9691 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
9693 /// The contents of CResult_NoneRetryableSendFailureZ
9694 pub union CResult_NoneRetryableSendFailureZPtr {
9695 /// Note that this value is always NULL, as there are no contents in the OK variant
9696 pub result: *mut core::ffi::c_void,
9697 /// A pointer to the contents in the error state.
9698 /// Reading from this pointer when `result_ok` is set is undefined.
9699 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9702 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
9703 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9704 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9705 pub struct CResult_NoneRetryableSendFailureZ {
9706 /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
9707 /// `err` or `result` depending on the state of `result_ok`.
9708 pub contents: CResult_NoneRetryableSendFailureZPtr,
9709 /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
9710 pub result_ok: bool,
9713 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
9714 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
9715 CResult_NoneRetryableSendFailureZ {
9716 contents: CResult_NoneRetryableSendFailureZPtr {
9717 result: core::ptr::null_mut(),
9723 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
9724 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
9725 CResult_NoneRetryableSendFailureZ {
9726 contents: CResult_NoneRetryableSendFailureZPtr {
9727 err: Box::into_raw(Box::new(e)),
9732 /// Checks if the given object is currently in the success state
9734 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
9738 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
9739 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
9740 impl Drop for CResult_NoneRetryableSendFailureZ {
9741 fn drop(&mut self) {
9744 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9745 let _ = unsafe { Box::from_raw(self.contents.err) };
9750 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
9751 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9752 let contents = if o.result_ok {
9753 let _ = unsafe { Box::from_raw(o.contents.result) };
9754 o.contents.result = core::ptr::null_mut();
9755 CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
9757 let err = unsafe { o.contents.err };
9758 unsafe { o.contents.err = core::ptr::null_mut(); }
9759 CResult_NoneRetryableSendFailureZPtr { err }
9763 result_ok: o.result_ok,
9767 impl Clone for CResult_NoneRetryableSendFailureZ {
9768 fn clone(&self) -> Self {
9770 Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
9771 result: core::ptr::null_mut()
9774 Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
9775 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9781 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
9782 /// but with all dynamically-allocated buffers duplicated in new buffers.
9783 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
9785 /// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ
9786 pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9787 /// A pointer to the contents in the success state.
9788 /// Reading from this pointer when `result_ok` is not set is undefined.
9789 pub result: *mut crate::c_types::ThirtyTwoBytes,
9790 /// A pointer to the contents in the error state.
9791 /// Reading from this pointer when `result_ok` is set is undefined.
9792 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9795 /// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation,
9796 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9798 pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ {
9799 /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either
9800 /// `err` or `result` depending on the state of `result_ok`.
9801 pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr,
9802 /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state.
9803 pub result_ok: bool,
9806 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state.
9807 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
9808 CResult_ThirtyTwoBytesPaymentSendFailureZ {
9809 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9810 result: Box::into_raw(Box::new(o)),
9816 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state.
9817 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
9818 CResult_ThirtyTwoBytesPaymentSendFailureZ {
9819 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9820 err: Box::into_raw(Box::new(e)),
9825 /// Checks if the given object is currently in the success state
9827 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool {
9831 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ.
9832 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { }
9833 impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ {
9834 fn drop(&mut self) {
9836 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9837 let _ = unsafe { Box::from_raw(self.contents.result) };
9840 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9841 let _ = unsafe { Box::from_raw(self.contents.err) };
9846 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_ThirtyTwoBytesPaymentSendFailureZ {
9847 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9848 let contents = if o.result_ok {
9849 let result = unsafe { o.contents.result };
9850 unsafe { o.contents.result = core::ptr::null_mut() };
9851 CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result }
9853 let err = unsafe { o.contents.err };
9854 unsafe { o.contents.err = core::ptr::null_mut(); }
9855 CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err }
9859 result_ok: o.result_ok,
9863 impl Clone for CResult_ThirtyTwoBytesPaymentSendFailureZ {
9864 fn clone(&self) -> Self {
9866 Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9867 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9870 Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9871 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9877 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig`
9878 /// but with all dynamically-allocated buffers duplicated in new buffers.
9879 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) }
9881 /// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ
9882 pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9883 /// A pointer to the contents in the success state.
9884 /// Reading from this pointer when `result_ok` is not set is undefined.
9885 pub result: *mut crate::c_types::ThirtyTwoBytes,
9886 /// A pointer to the contents in the error state.
9887 /// Reading from this pointer when `result_ok` is set is undefined.
9888 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9891 /// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation,
9892 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9893 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9894 pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ {
9895 /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either
9896 /// `err` or `result` depending on the state of `result_ok`.
9897 pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr,
9898 /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state.
9899 pub result_ok: bool,
9902 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
9903 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
9904 CResult_ThirtyTwoBytesRetryableSendFailureZ {
9905 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9906 result: Box::into_raw(Box::new(o)),
9912 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
9913 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
9914 CResult_ThirtyTwoBytesRetryableSendFailureZ {
9915 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9916 err: Box::into_raw(Box::new(e)),
9921 /// Checks if the given object is currently in the success state
9923 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool {
9927 /// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ.
9928 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { }
9929 impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9930 fn drop(&mut self) {
9932 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9933 let _ = unsafe { Box::from_raw(self.contents.result) };
9936 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9937 let _ = unsafe { Box::from_raw(self.contents.err) };
9942 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9943 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9944 let contents = if o.result_ok {
9945 let result = unsafe { o.contents.result };
9946 unsafe { o.contents.result = core::ptr::null_mut() };
9947 CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result }
9949 let err = unsafe { o.contents.err };
9950 unsafe { o.contents.err = core::ptr::null_mut(); }
9951 CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err }
9955 result_ok: o.result_ok,
9959 impl Clone for CResult_ThirtyTwoBytesRetryableSendFailureZ {
9960 fn clone(&self) -> Self {
9962 Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9963 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9966 Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9967 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9973 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
9974 /// but with all dynamically-allocated buffers duplicated in new buffers.
9975 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) }
9977 /// A tuple of 2 elements. See the individual fields for the types contained.
9978 pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9979 /// The element at position 0
9980 pub a: crate::c_types::ThirtyTwoBytes,
9981 /// The element at position 1
9982 pub b: crate::c_types::ThirtyTwoBytes,
9984 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9985 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9992 impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9993 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9997 impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
9998 fn clone(&self) -> Self {
10000 a: Clone::clone(&self.a),
10001 b: Clone::clone(&self.b),
10006 /// Creates a new tuple which has the same data as `orig`
10007 /// but with all dynamically-allocated buffers duplicated in new buffers.
10008 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) }
10009 /// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements.
10011 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10012 C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, }
10016 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ.
10017 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { }
10019 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ
10020 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10021 /// A pointer to the contents in the success state.
10022 /// Reading from this pointer when `result_ok` is not set is undefined.
10023 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10024 /// A pointer to the contents in the error state.
10025 /// Reading from this pointer when `result_ok` is set is undefined.
10026 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
10029 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation,
10030 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
10031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10032 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10033 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either
10034 /// `err` or `result` depending on the state of `result_ok`.
10035 pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr,
10036 /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state.
10037 pub result_ok: bool,
10040 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state.
10041 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10042 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10043 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10044 result: Box::into_raw(Box::new(o)),
10050 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state.
10051 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10052 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10053 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10054 err: Box::into_raw(Box::new(e)),
10059 /// Checks if the given object is currently in the success state
10061 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool {
10065 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.
10066 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { }
10067 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10068 fn drop(&mut self) {
10069 if self.result_ok {
10070 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10071 let _ = unsafe { Box::from_raw(self.contents.result) };
10074 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10075 let _ = unsafe { Box::from_raw(self.contents.err) };
10080 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10081 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
10082 let contents = if o.result_ok {
10083 let result = unsafe { o.contents.result };
10084 unsafe { o.contents.result = core::ptr::null_mut() };
10085 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result }
10087 let err = unsafe { o.contents.err };
10088 unsafe { o.contents.err = core::ptr::null_mut(); }
10089 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err }
10093 result_ok: o.result_ok,
10097 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10098 fn clone(&self) -> Self {
10099 if self.result_ok {
10100 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10101 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10104 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10105 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10111 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig`
10112 /// but with all dynamically-allocated buffers duplicated in new buffers.
10113 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) }
10115 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size.
10116 /// This corresponds to std::vector in C++
10117 pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10118 /// The elements in the array.
10119 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10120 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10121 /// The number of elements pointed to by `data`.
10124 impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10125 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ> {
10126 if self.datalen == 0 { return Vec::new(); }
10127 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10128 self.data = core::ptr::null_mut();
10132 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] {
10133 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10136 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10137 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>) -> Self {
10138 let datalen = v.len();
10139 let data = Box::into_raw(v.into_boxed_slice());
10140 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10144 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10145 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { }
10146 impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10147 fn drop(&mut self) {
10148 if self.datalen == 0 { return; }
10149 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10152 impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10153 fn clone(&self) -> Self {
10154 let mut res = Vec::new();
10155 if self.datalen == 0 { return Self::from(res); }
10156 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10161 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ
10162 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10163 /// A pointer to the contents in the success state.
10164 /// Reading from this pointer when `result_ok` is not set is undefined.
10165 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
10166 /// A pointer to the contents in the error state.
10167 /// Reading from this pointer when `result_ok` is set is undefined.
10168 pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure,
10171 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation,
10172 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure.
10173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10174 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10175 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either
10176 /// `err` or `result` depending on the state of `result_ok`.
10177 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr,
10178 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state.
10179 pub result_ok: bool,
10182 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state.
10183 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10184 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10185 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10186 result: Box::into_raw(Box::new(o)),
10192 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state.
10193 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10194 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10195 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10196 err: Box::into_raw(Box::new(e)),
10201 /// Checks if the given object is currently in the success state
10203 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool {
10207 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.
10208 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { }
10209 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10210 fn drop(&mut self) {
10211 if self.result_ok {
10212 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10213 let _ = unsafe { Box::from_raw(self.contents.result) };
10216 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10217 let _ = unsafe { Box::from_raw(self.contents.err) };
10222 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10223 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>) -> Self {
10224 let contents = if o.result_ok {
10225 let result = unsafe { o.contents.result };
10226 unsafe { o.contents.result = core::ptr::null_mut() };
10227 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result }
10229 let err = unsafe { o.contents.err };
10230 unsafe { o.contents.err = core::ptr::null_mut(); }
10231 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err }
10235 result_ok: o.result_ok,
10239 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10240 fn clone(&self) -> Self {
10241 if self.result_ok {
10242 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10243 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
10246 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10247 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::ProbeSendFailure>::clone(unsafe { &*self.contents.err })))
10253 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig`
10254 /// but with all dynamically-allocated buffers duplicated in new buffers.
10255 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) }
10257 /// A tuple of 2 elements. See the individual fields for the types contained.
10258 pub struct C2Tuple_ChannelIdPublicKeyZ {
10259 /// The element at position 0
10260 pub a: crate::lightning::ln::types::ChannelId,
10261 /// The element at position 1
10262 pub b: crate::c_types::PublicKey,
10264 impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)> for C2Tuple_ChannelIdPublicKeyZ {
10265 fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)) -> Self {
10272 impl C2Tuple_ChannelIdPublicKeyZ {
10273 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey) {
10277 impl Clone for C2Tuple_ChannelIdPublicKeyZ {
10278 fn clone(&self) -> Self {
10280 a: Clone::clone(&self.a),
10281 b: Clone::clone(&self.b),
10286 /// Creates a new tuple which has the same data as `orig`
10287 /// but with all dynamically-allocated buffers duplicated in new buffers.
10288 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_clone(orig: &C2Tuple_ChannelIdPublicKeyZ) -> C2Tuple_ChannelIdPublicKeyZ { Clone::clone(&orig) }
10289 /// Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements.
10291 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::PublicKey) -> C2Tuple_ChannelIdPublicKeyZ {
10292 C2Tuple_ChannelIdPublicKeyZ { a, b, }
10296 /// Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ.
10297 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_free(_res: C2Tuple_ChannelIdPublicKeyZ) { }
10299 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size.
10300 /// This corresponds to std::vector in C++
10301 pub struct CVec_C2Tuple_ChannelIdPublicKeyZZ {
10302 /// The elements in the array.
10303 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10304 pub data: *mut crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ,
10305 /// The number of elements pointed to by `data`.
10308 impl CVec_C2Tuple_ChannelIdPublicKeyZZ {
10309 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ> {
10310 if self.datalen == 0 { return Vec::new(); }
10311 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10312 self.data = core::ptr::null_mut();
10316 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ] {
10317 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10320 impl From<Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>> for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10321 fn from(v: Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>) -> Self {
10322 let datalen = v.len();
10323 let data = Box::into_raw(v.into_boxed_slice());
10324 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10328 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10329 pub extern "C" fn CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res: CVec_C2Tuple_ChannelIdPublicKeyZZ) { }
10330 impl Drop for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10331 fn drop(&mut self) {
10332 if self.datalen == 0 { return; }
10333 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10336 impl Clone for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10337 fn clone(&self) -> Self {
10338 let mut res = Vec::new();
10339 if self.datalen == 0 { return Self::from(res); }
10340 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10345 /// A dynamically-allocated array of crate::lightning::ln::types::ChannelIds of arbitrary size.
10346 /// This corresponds to std::vector in C++
10347 pub struct CVec_ChannelIdZ {
10348 /// The elements in the array.
10349 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10350 pub data: *mut crate::lightning::ln::types::ChannelId,
10351 /// The number of elements pointed to by `data`.
10354 impl CVec_ChannelIdZ {
10355 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::types::ChannelId> {
10356 if self.datalen == 0 { return Vec::new(); }
10357 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10358 self.data = core::ptr::null_mut();
10362 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::types::ChannelId] {
10363 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10366 impl From<Vec<crate::lightning::ln::types::ChannelId>> for CVec_ChannelIdZ {
10367 fn from(v: Vec<crate::lightning::ln::types::ChannelId>) -> Self {
10368 let datalen = v.len();
10369 let data = Box::into_raw(v.into_boxed_slice());
10370 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10374 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10375 pub extern "C" fn CVec_ChannelIdZ_free(_res: CVec_ChannelIdZ) { }
10376 impl Drop for CVec_ChannelIdZ {
10377 fn drop(&mut self) {
10378 if self.datalen == 0 { return; }
10379 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10382 impl Clone for CVec_ChannelIdZ {
10383 fn clone(&self) -> Self {
10384 let mut res = Vec::new();
10385 if self.datalen == 0 { return Self::from(res); }
10386 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10392 /// An enum which can either contain a crate::c_types::Str or not
10393 pub enum COption_StrZ {
10394 /// When we're in this state, this COption_StrZ contains a crate::c_types::Str
10395 Some(crate::c_types::Str),
10396 /// When we're in this state, this COption_StrZ contains nothing
10399 impl COption_StrZ {
10400 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10401 if let Self::None = self { false } else { true }
10403 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10406 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Str {
10407 if let Self::Some(v) = self { v } else { unreachable!() }
10411 /// Constructs a new COption_StrZ containing a crate::c_types::Str
10412 pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ {
10413 COption_StrZ::Some(o)
10416 /// Constructs a new COption_StrZ containing nothing
10417 pub extern "C" fn COption_StrZ_none() -> COption_StrZ {
10421 /// Frees any resources associated with the crate::c_types::Str, if we are in the Some state
10422 pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { }
10424 /// Creates a new COption_StrZ which has the same data as `orig`
10425 /// but with all dynamically-allocated buffers duplicated in new buffers.
10426 pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) }
10428 /// The contents of CResult_NoneBolt12SemanticErrorZ
10429 pub union CResult_NoneBolt12SemanticErrorZPtr {
10430 /// Note that this value is always NULL, as there are no contents in the OK variant
10431 pub result: *mut core::ffi::c_void,
10432 /// A pointer to the contents in the error state.
10433 /// Reading from this pointer when `result_ok` is set is undefined.
10434 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
10437 /// A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation,
10438 /// containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
10439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10440 pub struct CResult_NoneBolt12SemanticErrorZ {
10441 /// The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either
10442 /// `err` or `result` depending on the state of `result_ok`.
10443 pub contents: CResult_NoneBolt12SemanticErrorZPtr,
10444 /// Whether this CResult_NoneBolt12SemanticErrorZ represents a success state.
10445 pub result_ok: bool,
10448 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the success state.
10449 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_ok() -> CResult_NoneBolt12SemanticErrorZ {
10450 CResult_NoneBolt12SemanticErrorZ {
10451 contents: CResult_NoneBolt12SemanticErrorZPtr {
10452 result: core::ptr::null_mut(),
10458 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the error state.
10459 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_NoneBolt12SemanticErrorZ {
10460 CResult_NoneBolt12SemanticErrorZ {
10461 contents: CResult_NoneBolt12SemanticErrorZPtr {
10462 err: Box::into_raw(Box::new(e)),
10467 /// Checks if the given object is currently in the success state
10469 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_is_ok(o: &CResult_NoneBolt12SemanticErrorZ) -> bool {
10473 /// Frees any resources used by the CResult_NoneBolt12SemanticErrorZ.
10474 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_free(_res: CResult_NoneBolt12SemanticErrorZ) { }
10475 impl Drop for CResult_NoneBolt12SemanticErrorZ {
10476 fn drop(&mut self) {
10477 if self.result_ok {
10479 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10480 let _ = unsafe { Box::from_raw(self.contents.err) };
10485 impl From<crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_NoneBolt12SemanticErrorZ {
10486 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
10487 let contents = if o.result_ok {
10488 let _ = unsafe { Box::from_raw(o.contents.result) };
10489 o.contents.result = core::ptr::null_mut();
10490 CResult_NoneBolt12SemanticErrorZPtr { result: core::ptr::null_mut() }
10492 let err = unsafe { o.contents.err };
10493 unsafe { o.contents.err = core::ptr::null_mut(); }
10494 CResult_NoneBolt12SemanticErrorZPtr { err }
10498 result_ok: o.result_ok,
10502 impl Clone for CResult_NoneBolt12SemanticErrorZ {
10503 fn clone(&self) -> Self {
10504 if self.result_ok {
10505 Self { result_ok: true, contents: CResult_NoneBolt12SemanticErrorZPtr {
10506 result: core::ptr::null_mut()
10509 Self { result_ok: false, contents: CResult_NoneBolt12SemanticErrorZPtr {
10510 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
10516 /// Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig`
10517 /// but with all dynamically-allocated buffers duplicated in new buffers.
10518 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_clone(orig: &CResult_NoneBolt12SemanticErrorZ) -> CResult_NoneBolt12SemanticErrorZ { Clone::clone(&orig) }
10520 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
10521 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10522 /// A pointer to the contents in the success state.
10523 /// Reading from this pointer when `result_ok` is not set is undefined.
10524 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10525 /// Note that this value is always NULL, as there are no contents in the Err variant
10526 pub err: *mut core::ffi::c_void,
10529 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
10530 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
10531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10532 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10533 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
10534 /// `err` or `result` depending on the state of `result_ok`.
10535 pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
10536 /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
10537 pub result_ok: bool,
10540 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
10541 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10542 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10543 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10544 result: Box::into_raw(Box::new(o)),
10550 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
10551 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10552 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10553 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10554 err: core::ptr::null_mut(),
10559 /// Checks if the given object is currently in the success state
10561 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
10565 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
10566 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
10567 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10568 fn drop(&mut self) {
10569 if self.result_ok {
10570 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10571 let _ = unsafe { Box::from_raw(self.contents.result) };
10577 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10578 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
10579 let contents = if o.result_ok {
10580 let result = unsafe { o.contents.result };
10581 unsafe { o.contents.result = core::ptr::null_mut() };
10582 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
10584 let _ = unsafe { Box::from_raw(o.contents.err) };
10585 o.contents.err = core::ptr::null_mut();
10586 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
10590 result_ok: o.result_ok,
10594 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10595 fn clone(&self) -> Self {
10596 if self.result_ok {
10597 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10598 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10601 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10602 err: core::ptr::null_mut()
10608 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
10609 /// but with all dynamically-allocated buffers duplicated in new buffers.
10610 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
10612 /// The contents of CResult_ThirtyTwoBytesAPIErrorZ
10613 pub union CResult_ThirtyTwoBytesAPIErrorZPtr {
10614 /// A pointer to the contents in the success state.
10615 /// Reading from this pointer when `result_ok` is not set is undefined.
10616 pub result: *mut crate::c_types::ThirtyTwoBytes,
10617 /// A pointer to the contents in the error state.
10618 /// Reading from this pointer when `result_ok` is set is undefined.
10619 pub err: *mut crate::lightning::util::errors::APIError,
10622 /// A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation,
10623 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
10624 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10625 pub struct CResult_ThirtyTwoBytesAPIErrorZ {
10626 /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either
10627 /// `err` or `result` depending on the state of `result_ok`.
10628 pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr,
10629 /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state.
10630 pub result_ok: bool,
10633 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state.
10634 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesAPIErrorZ {
10635 CResult_ThirtyTwoBytesAPIErrorZ {
10636 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10637 result: Box::into_raw(Box::new(o)),
10643 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state.
10644 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ThirtyTwoBytesAPIErrorZ {
10645 CResult_ThirtyTwoBytesAPIErrorZ {
10646 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10647 err: Box::into_raw(Box::new(e)),
10652 /// Checks if the given object is currently in the success state
10654 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool {
10658 /// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ.
10659 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { }
10660 impl Drop for CResult_ThirtyTwoBytesAPIErrorZ {
10661 fn drop(&mut self) {
10662 if self.result_ok {
10663 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10664 let _ = unsafe { Box::from_raw(self.contents.result) };
10667 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10668 let _ = unsafe { Box::from_raw(self.contents.err) };
10673 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_ThirtyTwoBytesAPIErrorZ {
10674 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
10675 let contents = if o.result_ok {
10676 let result = unsafe { o.contents.result };
10677 unsafe { o.contents.result = core::ptr::null_mut() };
10678 CResult_ThirtyTwoBytesAPIErrorZPtr { result }
10680 let err = unsafe { o.contents.err };
10681 unsafe { o.contents.err = core::ptr::null_mut(); }
10682 CResult_ThirtyTwoBytesAPIErrorZPtr { err }
10686 result_ok: o.result_ok,
10690 impl Clone for CResult_ThirtyTwoBytesAPIErrorZ {
10691 fn clone(&self) -> Self {
10692 if self.result_ok {
10693 Self { result_ok: true, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10694 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10697 Self { result_ok: false, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10698 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
10704 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig`
10705 /// but with all dynamically-allocated buffers duplicated in new buffers.
10706 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) }
10709 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
10710 pub enum COption_OffersMessageZ {
10711 /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
10712 Some(crate::lightning::onion_message::offers::OffersMessage),
10713 /// When we're in this state, this COption_OffersMessageZ contains nothing
10716 impl COption_OffersMessageZ {
10717 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10718 if let Self::None = self { false } else { true }
10720 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10723 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
10724 if let Self::Some(v) = self { v } else { unreachable!() }
10728 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
10729 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
10730 COption_OffersMessageZ::Some(o)
10733 /// Constructs a new COption_OffersMessageZ containing nothing
10734 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
10735 COption_OffersMessageZ::None
10738 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
10739 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
10741 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
10742 /// but with all dynamically-allocated buffers duplicated in new buffers.
10743 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
10745 /// A tuple of 3 elements. See the individual fields for the types contained.
10746 pub struct C3Tuple_OffersMessageDestinationBlindedPathZ {
10747 /// The element at position 0
10748 pub a: crate::lightning::onion_message::offers::OffersMessage,
10749 /// The element at position 1
10750 pub b: crate::lightning::onion_message::messenger::Destination,
10751 /// The element at position 2
10752 pub c: crate::lightning::blinded_path::BlindedPath,
10754 impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OffersMessageDestinationBlindedPathZ {
10755 fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
10763 impl C3Tuple_OffersMessageDestinationBlindedPathZ {
10764 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
10765 (self.a, self.b, self.c)
10768 impl Clone for C3Tuple_OffersMessageDestinationBlindedPathZ {
10769 fn clone(&self) -> Self {
10771 a: Clone::clone(&self.a),
10772 b: Clone::clone(&self.b),
10773 c: Clone::clone(&self.c),
10778 /// Creates a new tuple which has the same data as `orig`
10779 /// but with all dynamically-allocated buffers duplicated in new buffers.
10780 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig: &C3Tuple_OffersMessageDestinationBlindedPathZ) -> C3Tuple_OffersMessageDestinationBlindedPathZ { Clone::clone(&orig) }
10781 /// Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
10783 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_new(a: crate::lightning::onion_message::offers::OffersMessage, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OffersMessageDestinationBlindedPathZ {
10784 C3Tuple_OffersMessageDestinationBlindedPathZ { a, b, c, }
10788 /// Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
10789 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res: C3Tuple_OffersMessageDestinationBlindedPathZ) { }
10791 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
10792 /// This corresponds to std::vector in C++
10793 pub struct CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
10794 /// The elements in the array.
10795 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10796 pub data: *mut crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ,
10797 /// The number of elements pointed to by `data`.
10800 impl CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
10801 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ> {
10802 if self.datalen == 0 { return Vec::new(); }
10803 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10804 self.data = core::ptr::null_mut();
10808 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ] {
10809 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10812 impl From<Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>> for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
10813 fn from(v: Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>) -> Self {
10814 let datalen = v.len();
10815 let data = Box::into_raw(v.into_boxed_slice());
10816 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10820 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10821 pub extern "C" fn CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ) { }
10822 impl Drop for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
10823 fn drop(&mut self) {
10824 if self.datalen == 0 { return; }
10825 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10828 impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
10829 fn clone(&self) -> Self {
10830 let mut res = Vec::new();
10831 if self.datalen == 0 { return Self::from(res); }
10832 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10837 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
10838 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10839 /// A pointer to the contents in the success state.
10840 /// Reading from this pointer when `result_ok` is not set is undefined.
10841 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
10842 /// A pointer to the contents in the error state.
10843 /// Reading from this pointer when `result_ok` is set is undefined.
10844 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10847 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
10848 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10850 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
10851 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
10852 /// `err` or `result` depending on the state of `result_ok`.
10853 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
10854 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
10855 pub result_ok: bool,
10858 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
10859 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
10860 CResult_CounterpartyForwardingInfoDecodeErrorZ {
10861 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10862 result: Box::into_raw(Box::new(o)),
10868 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
10869 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
10870 CResult_CounterpartyForwardingInfoDecodeErrorZ {
10871 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10872 err: Box::into_raw(Box::new(e)),
10877 /// Checks if the given object is currently in the success state
10879 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
10883 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
10884 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
10885 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10886 fn drop(&mut self) {
10887 if self.result_ok {
10888 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10889 let _ = unsafe { Box::from_raw(self.contents.result) };
10892 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10893 let _ = unsafe { Box::from_raw(self.contents.err) };
10898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10899 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10900 let contents = if o.result_ok {
10901 let result = unsafe { o.contents.result };
10902 unsafe { o.contents.result = core::ptr::null_mut() };
10903 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
10905 let err = unsafe { o.contents.err };
10906 unsafe { o.contents.err = core::ptr::null_mut(); }
10907 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
10911 result_ok: o.result_ok,
10915 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10916 fn clone(&self) -> Self {
10917 if self.result_ok {
10918 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10919 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
10922 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10923 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10929 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
10930 /// but with all dynamically-allocated buffers duplicated in new buffers.
10931 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
10933 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
10934 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
10935 /// A pointer to the contents in the success state.
10936 /// Reading from this pointer when `result_ok` is not set is undefined.
10937 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
10938 /// A pointer to the contents in the error state.
10939 /// Reading from this pointer when `result_ok` is set is undefined.
10940 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10943 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
10944 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
10945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10946 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
10947 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
10948 /// `err` or `result` depending on the state of `result_ok`.
10949 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
10950 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
10951 pub result_ok: bool,
10954 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
10955 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
10956 CResult_ChannelCounterpartyDecodeErrorZ {
10957 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10958 result: Box::into_raw(Box::new(o)),
10964 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
10965 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
10966 CResult_ChannelCounterpartyDecodeErrorZ {
10967 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10968 err: Box::into_raw(Box::new(e)),
10973 /// Checks if the given object is currently in the success state
10975 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
10979 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
10980 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
10981 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
10982 fn drop(&mut self) {
10983 if self.result_ok {
10984 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10985 let _ = unsafe { Box::from_raw(self.contents.result) };
10988 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10989 let _ = unsafe { Box::from_raw(self.contents.err) };
10994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
10995 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
10996 let contents = if o.result_ok {
10997 let result = unsafe { o.contents.result };
10998 unsafe { o.contents.result = core::ptr::null_mut() };
10999 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
11001 let err = unsafe { o.contents.err };
11002 unsafe { o.contents.err = core::ptr::null_mut(); }
11003 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
11007 result_ok: o.result_ok,
11011 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
11012 fn clone(&self) -> Self {
11013 if self.result_ok {
11014 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11015 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
11018 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11019 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11025 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
11026 /// but with all dynamically-allocated buffers duplicated in new buffers.
11027 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
11029 /// The contents of CResult_ChannelDetailsDecodeErrorZ
11030 pub union CResult_ChannelDetailsDecodeErrorZPtr {
11031 /// A pointer to the contents in the success state.
11032 /// Reading from this pointer when `result_ok` is not set is undefined.
11033 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
11034 /// A pointer to the contents in the error state.
11035 /// Reading from this pointer when `result_ok` is set is undefined.
11036 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11039 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
11040 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
11041 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11042 pub struct CResult_ChannelDetailsDecodeErrorZ {
11043 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
11044 /// `err` or `result` depending on the state of `result_ok`.
11045 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
11046 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
11047 pub result_ok: bool,
11050 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
11051 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
11052 CResult_ChannelDetailsDecodeErrorZ {
11053 contents: CResult_ChannelDetailsDecodeErrorZPtr {
11054 result: Box::into_raw(Box::new(o)),
11060 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
11061 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
11062 CResult_ChannelDetailsDecodeErrorZ {
11063 contents: CResult_ChannelDetailsDecodeErrorZPtr {
11064 err: Box::into_raw(Box::new(e)),
11069 /// Checks if the given object is currently in the success state
11071 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
11075 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
11076 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
11077 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
11078 fn drop(&mut self) {
11079 if self.result_ok {
11080 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11081 let _ = unsafe { Box::from_raw(self.contents.result) };
11084 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11085 let _ = unsafe { Box::from_raw(self.contents.err) };
11090 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
11091 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
11092 let contents = if o.result_ok {
11093 let result = unsafe { o.contents.result };
11094 unsafe { o.contents.result = core::ptr::null_mut() };
11095 CResult_ChannelDetailsDecodeErrorZPtr { result }
11097 let err = unsafe { o.contents.err };
11098 unsafe { o.contents.err = core::ptr::null_mut(); }
11099 CResult_ChannelDetailsDecodeErrorZPtr { err }
11103 result_ok: o.result_ok,
11107 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
11108 fn clone(&self) -> Self {
11109 if self.result_ok {
11110 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
11111 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
11114 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
11115 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11121 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
11122 /// but with all dynamically-allocated buffers duplicated in new buffers.
11123 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
11125 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
11126 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
11127 /// A pointer to the contents in the success state.
11128 /// Reading from this pointer when `result_ok` is not set is undefined.
11129 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
11130 /// A pointer to the contents in the error state.
11131 /// Reading from this pointer when `result_ok` is set is undefined.
11132 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11135 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
11136 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
11137 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11138 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
11139 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
11140 /// `err` or `result` depending on the state of `result_ok`.
11141 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
11142 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
11143 pub result_ok: bool,
11146 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
11147 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
11148 CResult_PhantomRouteHintsDecodeErrorZ {
11149 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11150 result: Box::into_raw(Box::new(o)),
11156 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
11157 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
11158 CResult_PhantomRouteHintsDecodeErrorZ {
11159 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11160 err: Box::into_raw(Box::new(e)),
11165 /// Checks if the given object is currently in the success state
11167 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
11171 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
11172 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
11173 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
11174 fn drop(&mut self) {
11175 if self.result_ok {
11176 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11177 let _ = unsafe { Box::from_raw(self.contents.result) };
11180 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11181 let _ = unsafe { Box::from_raw(self.contents.err) };
11186 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
11187 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
11188 let contents = if o.result_ok {
11189 let result = unsafe { o.contents.result };
11190 unsafe { o.contents.result = core::ptr::null_mut() };
11191 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
11193 let err = unsafe { o.contents.err };
11194 unsafe { o.contents.err = core::ptr::null_mut(); }
11195 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
11199 result_ok: o.result_ok,
11203 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
11204 fn clone(&self) -> Self {
11205 if self.result_ok {
11206 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11207 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
11210 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11211 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11217 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
11218 /// but with all dynamically-allocated buffers duplicated in new buffers.
11219 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
11221 /// The contents of CResult_BlindedForwardDecodeErrorZ
11222 pub union CResult_BlindedForwardDecodeErrorZPtr {
11223 /// A pointer to the contents in the success state.
11224 /// Reading from this pointer when `result_ok` is not set is undefined.
11225 pub result: *mut crate::lightning::ln::channelmanager::BlindedForward,
11226 /// A pointer to the contents in the error state.
11227 /// Reading from this pointer when `result_ok` is set is undefined.
11228 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11231 /// A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation,
11232 /// containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure.
11233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11234 pub struct CResult_BlindedForwardDecodeErrorZ {
11235 /// The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either
11236 /// `err` or `result` depending on the state of `result_ok`.
11237 pub contents: CResult_BlindedForwardDecodeErrorZPtr,
11238 /// Whether this CResult_BlindedForwardDecodeErrorZ represents a success state.
11239 pub result_ok: bool,
11242 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the success state.
11243 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ {
11244 CResult_BlindedForwardDecodeErrorZ {
11245 contents: CResult_BlindedForwardDecodeErrorZPtr {
11246 result: Box::into_raw(Box::new(o)),
11252 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the error state.
11253 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ {
11254 CResult_BlindedForwardDecodeErrorZ {
11255 contents: CResult_BlindedForwardDecodeErrorZPtr {
11256 err: Box::into_raw(Box::new(e)),
11261 /// Checks if the given object is currently in the success state
11263 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> bool {
11267 /// Frees any resources used by the CResult_BlindedForwardDecodeErrorZ.
11268 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { }
11269 impl Drop for CResult_BlindedForwardDecodeErrorZ {
11270 fn drop(&mut self) {
11271 if self.result_ok {
11272 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11273 let _ = unsafe { Box::from_raw(self.contents.result) };
11276 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11277 let _ = unsafe { Box::from_raw(self.contents.err) };
11282 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedForwardDecodeErrorZ {
11283 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>) -> Self {
11284 let contents = if o.result_ok {
11285 let result = unsafe { o.contents.result };
11286 unsafe { o.contents.result = core::ptr::null_mut() };
11287 CResult_BlindedForwardDecodeErrorZPtr { result }
11289 let err = unsafe { o.contents.err };
11290 unsafe { o.contents.err = core::ptr::null_mut(); }
11291 CResult_BlindedForwardDecodeErrorZPtr { err }
11295 result_ok: o.result_ok,
11299 impl Clone for CResult_BlindedForwardDecodeErrorZ {
11300 fn clone(&self) -> Self {
11301 if self.result_ok {
11302 Self { result_ok: true, contents: CResult_BlindedForwardDecodeErrorZPtr {
11303 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedForward>::clone(unsafe { &*self.contents.result })))
11306 Self { result_ok: false, contents: CResult_BlindedForwardDecodeErrorZPtr {
11307 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11313 /// Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig`
11314 /// but with all dynamically-allocated buffers duplicated in new buffers.
11315 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) }
11317 /// The contents of CResult_PendingHTLCRoutingDecodeErrorZ
11318 pub union CResult_PendingHTLCRoutingDecodeErrorZPtr {
11319 /// A pointer to the contents in the success state.
11320 /// Reading from this pointer when `result_ok` is not set is undefined.
11321 pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCRouting,
11322 /// A pointer to the contents in the error state.
11323 /// Reading from this pointer when `result_ok` is set is undefined.
11324 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11327 /// A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation,
11328 /// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure.
11329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11330 pub struct CResult_PendingHTLCRoutingDecodeErrorZ {
11331 /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either
11332 /// `err` or `result` depending on the state of `result_ok`.
11333 pub contents: CResult_PendingHTLCRoutingDecodeErrorZPtr,
11334 /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state.
11335 pub result_ok: bool,
11338 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state.
11339 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11340 CResult_PendingHTLCRoutingDecodeErrorZ {
11341 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11342 result: Box::into_raw(Box::new(o)),
11348 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state.
11349 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11350 CResult_PendingHTLCRoutingDecodeErrorZ {
11351 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11352 err: Box::into_raw(Box::new(e)),
11357 /// Checks if the given object is currently in the success state
11359 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> bool {
11363 /// Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ.
11364 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { }
11365 impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ {
11366 fn drop(&mut self) {
11367 if self.result_ok {
11368 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11369 let _ = unsafe { Box::from_raw(self.contents.result) };
11372 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11373 let _ = unsafe { Box::from_raw(self.contents.err) };
11378 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCRoutingDecodeErrorZ {
11379 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>) -> Self {
11380 let contents = if o.result_ok {
11381 let result = unsafe { o.contents.result };
11382 unsafe { o.contents.result = core::ptr::null_mut() };
11383 CResult_PendingHTLCRoutingDecodeErrorZPtr { result }
11385 let err = unsafe { o.contents.err };
11386 unsafe { o.contents.err = core::ptr::null_mut(); }
11387 CResult_PendingHTLCRoutingDecodeErrorZPtr { err }
11391 result_ok: o.result_ok,
11395 impl Clone for CResult_PendingHTLCRoutingDecodeErrorZ {
11396 fn clone(&self) -> Self {
11397 if self.result_ok {
11398 Self { result_ok: true, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11399 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCRouting>::clone(unsafe { &*self.contents.result })))
11402 Self { result_ok: false, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11403 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11409 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig`
11410 /// but with all dynamically-allocated buffers duplicated in new buffers.
11411 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) }
11413 /// The contents of CResult_PendingHTLCInfoDecodeErrorZ
11414 pub union CResult_PendingHTLCInfoDecodeErrorZPtr {
11415 /// A pointer to the contents in the success state.
11416 /// Reading from this pointer when `result_ok` is not set is undefined.
11417 pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
11418 /// A pointer to the contents in the error state.
11419 /// Reading from this pointer when `result_ok` is set is undefined.
11420 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11423 /// A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation,
11424 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11425 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11426 pub struct CResult_PendingHTLCInfoDecodeErrorZ {
11427 /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either
11428 /// `err` or `result` depending on the state of `result_ok`.
11429 pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr,
11430 /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state.
11431 pub result_ok: bool,
11434 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state.
11435 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ {
11436 CResult_PendingHTLCInfoDecodeErrorZ {
11437 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11438 result: Box::into_raw(Box::new(o)),
11444 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state.
11445 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ {
11446 CResult_PendingHTLCInfoDecodeErrorZ {
11447 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11448 err: Box::into_raw(Box::new(e)),
11453 /// Checks if the given object is currently in the success state
11455 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool {
11459 /// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ.
11460 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { }
11461 impl Drop for CResult_PendingHTLCInfoDecodeErrorZ {
11462 fn drop(&mut self) {
11463 if self.result_ok {
11464 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11465 let _ = unsafe { Box::from_raw(self.contents.result) };
11468 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11469 let _ = unsafe { Box::from_raw(self.contents.err) };
11474 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCInfoDecodeErrorZ {
11475 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11476 let contents = if o.result_ok {
11477 let result = unsafe { o.contents.result };
11478 unsafe { o.contents.result = core::ptr::null_mut() };
11479 CResult_PendingHTLCInfoDecodeErrorZPtr { result }
11481 let err = unsafe { o.contents.err };
11482 unsafe { o.contents.err = core::ptr::null_mut(); }
11483 CResult_PendingHTLCInfoDecodeErrorZPtr { err }
11487 result_ok: o.result_ok,
11491 impl Clone for CResult_PendingHTLCInfoDecodeErrorZ {
11492 fn clone(&self) -> Self {
11493 if self.result_ok {
11494 Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11495 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCInfo>::clone(unsafe { &*self.contents.result })))
11498 Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11499 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11505 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig`
11506 /// but with all dynamically-allocated buffers duplicated in new buffers.
11507 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) }
11509 /// The contents of CResult_BlindedFailureDecodeErrorZ
11510 pub union CResult_BlindedFailureDecodeErrorZPtr {
11511 /// A pointer to the contents in the success state.
11512 /// Reading from this pointer when `result_ok` is not set is undefined.
11513 pub result: *mut crate::lightning::ln::channelmanager::BlindedFailure,
11514 /// A pointer to the contents in the error state.
11515 /// Reading from this pointer when `result_ok` is set is undefined.
11516 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11519 /// A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation,
11520 /// containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure.
11521 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11522 pub struct CResult_BlindedFailureDecodeErrorZ {
11523 /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either
11524 /// `err` or `result` depending on the state of `result_ok`.
11525 pub contents: CResult_BlindedFailureDecodeErrorZPtr,
11526 /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state.
11527 pub result_ok: bool,
11530 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state.
11531 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ {
11532 CResult_BlindedFailureDecodeErrorZ {
11533 contents: CResult_BlindedFailureDecodeErrorZPtr {
11534 result: Box::into_raw(Box::new(o)),
11540 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state.
11541 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ {
11542 CResult_BlindedFailureDecodeErrorZ {
11543 contents: CResult_BlindedFailureDecodeErrorZPtr {
11544 err: Box::into_raw(Box::new(e)),
11549 /// Checks if the given object is currently in the success state
11551 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool {
11555 /// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ.
11556 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { }
11557 impl Drop for CResult_BlindedFailureDecodeErrorZ {
11558 fn drop(&mut self) {
11559 if self.result_ok {
11560 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11561 let _ = unsafe { Box::from_raw(self.contents.result) };
11564 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11565 let _ = unsafe { Box::from_raw(self.contents.err) };
11570 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedFailureDecodeErrorZ {
11571 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>) -> Self {
11572 let contents = if o.result_ok {
11573 let result = unsafe { o.contents.result };
11574 unsafe { o.contents.result = core::ptr::null_mut() };
11575 CResult_BlindedFailureDecodeErrorZPtr { result }
11577 let err = unsafe { o.contents.err };
11578 unsafe { o.contents.err = core::ptr::null_mut(); }
11579 CResult_BlindedFailureDecodeErrorZPtr { err }
11583 result_ok: o.result_ok,
11587 impl Clone for CResult_BlindedFailureDecodeErrorZ {
11588 fn clone(&self) -> Self {
11589 if self.result_ok {
11590 Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr {
11591 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedFailure>::clone(unsafe { &*self.contents.result })))
11594 Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr {
11595 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11601 /// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig`
11602 /// but with all dynamically-allocated buffers duplicated in new buffers.
11603 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) }
11605 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
11606 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
11607 /// A pointer to the contents in the success state.
11608 /// Reading from this pointer when `result_ok` is not set is undefined.
11609 pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
11610 /// A pointer to the contents in the error state.
11611 /// Reading from this pointer when `result_ok` is set is undefined.
11612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11615 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
11616 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
11617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11618 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
11619 /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
11620 /// `err` or `result` depending on the state of `result_ok`.
11621 pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
11622 /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
11623 pub result_ok: bool,
11626 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
11627 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
11628 CResult_ChannelShutdownStateDecodeErrorZ {
11629 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11630 result: Box::into_raw(Box::new(o)),
11636 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
11637 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
11638 CResult_ChannelShutdownStateDecodeErrorZ {
11639 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11640 err: Box::into_raw(Box::new(e)),
11645 /// Checks if the given object is currently in the success state
11647 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
11651 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
11652 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
11653 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
11654 fn drop(&mut self) {
11655 if self.result_ok {
11656 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11657 let _ = unsafe { Box::from_raw(self.contents.result) };
11660 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11661 let _ = unsafe { Box::from_raw(self.contents.err) };
11666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
11667 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
11668 let contents = if o.result_ok {
11669 let result = unsafe { o.contents.result };
11670 unsafe { o.contents.result = core::ptr::null_mut() };
11671 CResult_ChannelShutdownStateDecodeErrorZPtr { result }
11673 let err = unsafe { o.contents.err };
11674 unsafe { o.contents.err = core::ptr::null_mut(); }
11675 CResult_ChannelShutdownStateDecodeErrorZPtr { err }
11679 result_ok: o.result_ok,
11683 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
11684 fn clone(&self) -> Self {
11685 if self.result_ok {
11686 Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11687 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
11690 Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11691 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11697 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
11698 /// but with all dynamically-allocated buffers duplicated in new buffers.
11699 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
11701 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
11702 /// This corresponds to std::vector in C++
11703 pub struct CVec_ChannelMonitorZ {
11704 /// The elements in the array.
11705 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11706 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
11707 /// The number of elements pointed to by `data`.
11710 impl CVec_ChannelMonitorZ {
11711 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
11712 if self.datalen == 0 { return Vec::new(); }
11713 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11714 self.data = core::ptr::null_mut();
11718 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
11719 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11722 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
11723 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
11724 let datalen = v.len();
11725 let data = Box::into_raw(v.into_boxed_slice());
11726 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11730 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11731 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
11732 impl Drop for CVec_ChannelMonitorZ {
11733 fn drop(&mut self) {
11734 if self.datalen == 0 { return; }
11735 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11738 impl Clone for CVec_ChannelMonitorZ {
11739 fn clone(&self) -> Self {
11740 let mut res = Vec::new();
11741 if self.datalen == 0 { return Self::from(res); }
11742 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11747 /// A tuple of 2 elements. See the individual fields for the types contained.
11748 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
11749 /// The element at position 0
11750 pub a: crate::c_types::ThirtyTwoBytes,
11751 /// The element at position 1
11752 pub b: crate::lightning::ln::channelmanager::ChannelManager,
11754 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
11755 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
11762 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
11763 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
11767 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
11769 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
11770 C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
11774 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
11775 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
11777 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
11778 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11779 /// A pointer to the contents in the success state.
11780 /// Reading from this pointer when `result_ok` is not set is undefined.
11781 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
11782 /// A pointer to the contents in the error state.
11783 /// Reading from this pointer when `result_ok` is set is undefined.
11784 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11787 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
11788 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11789 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11790 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11791 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
11792 /// `err` or `result` depending on the state of `result_ok`.
11793 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
11794 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
11795 pub result_ok: bool,
11798 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
11799 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11800 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11801 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11802 result: Box::into_raw(Box::new(o)),
11808 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
11809 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11810 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11811 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11812 err: Box::into_raw(Box::new(e)),
11817 /// Checks if the given object is currently in the success state
11819 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
11823 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
11824 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
11825 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11826 fn drop(&mut self) {
11827 if self.result_ok {
11828 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11829 let _ = unsafe { Box::from_raw(self.contents.result) };
11832 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11833 let _ = unsafe { Box::from_raw(self.contents.err) };
11838 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11839 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11840 let contents = if o.result_ok {
11841 let result = unsafe { o.contents.result };
11842 unsafe { o.contents.result = core::ptr::null_mut() };
11843 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
11845 let err = unsafe { o.contents.err };
11846 unsafe { o.contents.err = core::ptr::null_mut(); }
11847 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
11851 result_ok: o.result_ok,
11856 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
11857 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11858 /// A pointer to the contents in the success state.
11859 /// Reading from this pointer when `result_ok` is not set is undefined.
11860 pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
11861 /// A pointer to the contents in the error state.
11862 /// Reading from this pointer when `result_ok` is set is undefined.
11863 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11866 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
11867 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
11868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11869 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
11870 /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
11871 /// `err` or `result` depending on the state of `result_ok`.
11872 pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
11873 /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
11874 pub result_ok: bool,
11877 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
11878 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
11879 CResult_MaxDustHTLCExposureDecodeErrorZ {
11880 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11881 result: Box::into_raw(Box::new(o)),
11887 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
11888 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
11889 CResult_MaxDustHTLCExposureDecodeErrorZ {
11890 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11891 err: Box::into_raw(Box::new(e)),
11896 /// Checks if the given object is currently in the success state
11898 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
11902 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
11903 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
11904 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
11905 fn drop(&mut self) {
11906 if self.result_ok {
11907 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11908 let _ = unsafe { Box::from_raw(self.contents.result) };
11911 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11912 let _ = unsafe { Box::from_raw(self.contents.err) };
11917 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
11918 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
11919 let contents = if o.result_ok {
11920 let result = unsafe { o.contents.result };
11921 unsafe { o.contents.result = core::ptr::null_mut() };
11922 CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
11924 let err = unsafe { o.contents.err };
11925 unsafe { o.contents.err = core::ptr::null_mut(); }
11926 CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
11930 result_ok: o.result_ok,
11934 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
11935 fn clone(&self) -> Self {
11936 if self.result_ok {
11937 Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11938 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
11941 Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11942 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11948 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
11949 /// but with all dynamically-allocated buffers duplicated in new buffers.
11950 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
11952 /// The contents of CResult_ChannelConfigDecodeErrorZ
11953 pub union CResult_ChannelConfigDecodeErrorZPtr {
11954 /// A pointer to the contents in the success state.
11955 /// Reading from this pointer when `result_ok` is not set is undefined.
11956 pub result: *mut crate::lightning::util::config::ChannelConfig,
11957 /// A pointer to the contents in the error state.
11958 /// Reading from this pointer when `result_ok` is set is undefined.
11959 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11962 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
11963 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
11964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11965 pub struct CResult_ChannelConfigDecodeErrorZ {
11966 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
11967 /// `err` or `result` depending on the state of `result_ok`.
11968 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
11969 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
11970 pub result_ok: bool,
11973 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
11974 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
11975 CResult_ChannelConfigDecodeErrorZ {
11976 contents: CResult_ChannelConfigDecodeErrorZPtr {
11977 result: Box::into_raw(Box::new(o)),
11983 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
11984 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
11985 CResult_ChannelConfigDecodeErrorZ {
11986 contents: CResult_ChannelConfigDecodeErrorZPtr {
11987 err: Box::into_raw(Box::new(e)),
11992 /// Checks if the given object is currently in the success state
11994 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
11998 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
11999 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
12000 impl Drop for CResult_ChannelConfigDecodeErrorZ {
12001 fn drop(&mut self) {
12002 if self.result_ok {
12003 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12004 let _ = unsafe { Box::from_raw(self.contents.result) };
12007 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12008 let _ = unsafe { Box::from_raw(self.contents.err) };
12013 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
12014 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
12015 let contents = if o.result_ok {
12016 let result = unsafe { o.contents.result };
12017 unsafe { o.contents.result = core::ptr::null_mut() };
12018 CResult_ChannelConfigDecodeErrorZPtr { result }
12020 let err = unsafe { o.contents.err };
12021 unsafe { o.contents.err = core::ptr::null_mut(); }
12022 CResult_ChannelConfigDecodeErrorZPtr { err }
12026 result_ok: o.result_ok,
12030 impl Clone for CResult_ChannelConfigDecodeErrorZ {
12031 fn clone(&self) -> Self {
12032 if self.result_ok {
12033 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
12034 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
12037 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
12038 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12044 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
12045 /// but with all dynamically-allocated buffers duplicated in new buffers.
12046 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
12049 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
12050 pub enum COption_MaxDustHTLCExposureZ {
12051 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
12052 Some(crate::lightning::util::config::MaxDustHTLCExposure),
12053 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
12056 impl COption_MaxDustHTLCExposureZ {
12057 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12058 if let Self::None = self { false } else { true }
12060 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12063 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
12064 if let Self::Some(v) = self { v } else { unreachable!() }
12068 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
12069 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
12070 COption_MaxDustHTLCExposureZ::Some(o)
12073 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
12074 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
12075 COption_MaxDustHTLCExposureZ::None
12078 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
12079 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
12081 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
12082 /// but with all dynamically-allocated buffers duplicated in new buffers.
12083 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
12086 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
12087 pub enum COption_APIErrorZ {
12088 /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
12089 Some(crate::lightning::util::errors::APIError),
12090 /// When we're in this state, this COption_APIErrorZ contains nothing
12093 impl COption_APIErrorZ {
12094 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12095 if let Self::None = self { false } else { true }
12097 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12100 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
12101 if let Self::Some(v) = self { v } else { unreachable!() }
12105 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
12106 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
12107 COption_APIErrorZ::Some(o)
12110 /// Constructs a new COption_APIErrorZ containing nothing
12111 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
12112 COption_APIErrorZ::None
12115 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
12116 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
12118 /// Creates a new COption_APIErrorZ which has the same data as `orig`
12119 /// but with all dynamically-allocated buffers duplicated in new buffers.
12120 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
12122 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
12123 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
12124 /// A pointer to the contents in the success state.
12125 /// Reading from this pointer when `result_ok` is not set is undefined.
12126 pub result: *mut crate::c_types::derived::COption_APIErrorZ,
12127 /// A pointer to the contents in the error state.
12128 /// Reading from this pointer when `result_ok` is set is undefined.
12129 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12132 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
12133 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12134 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12135 pub struct CResult_COption_APIErrorZDecodeErrorZ {
12136 /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
12137 /// `err` or `result` depending on the state of `result_ok`.
12138 pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
12139 /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
12140 pub result_ok: bool,
12143 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
12144 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
12145 CResult_COption_APIErrorZDecodeErrorZ {
12146 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12147 result: Box::into_raw(Box::new(o)),
12153 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
12154 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
12155 CResult_COption_APIErrorZDecodeErrorZ {
12156 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12157 err: Box::into_raw(Box::new(e)),
12162 /// Checks if the given object is currently in the success state
12164 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
12168 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
12169 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
12170 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
12171 fn drop(&mut self) {
12172 if self.result_ok {
12173 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12174 let _ = unsafe { Box::from_raw(self.contents.result) };
12177 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12178 let _ = unsafe { Box::from_raw(self.contents.err) };
12183 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
12184 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12185 let contents = if o.result_ok {
12186 let result = unsafe { o.contents.result };
12187 unsafe { o.contents.result = core::ptr::null_mut() };
12188 CResult_COption_APIErrorZDecodeErrorZPtr { result }
12190 let err = unsafe { o.contents.err };
12191 unsafe { o.contents.err = core::ptr::null_mut(); }
12192 CResult_COption_APIErrorZDecodeErrorZPtr { err }
12196 result_ok: o.result_ok,
12200 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
12201 fn clone(&self) -> Self {
12202 if self.result_ok {
12203 Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12204 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
12207 Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12208 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12214 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
12215 /// but with all dynamically-allocated buffers duplicated in new buffers.
12216 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
12218 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
12219 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12220 /// A pointer to the contents in the success state.
12221 /// Reading from this pointer when `result_ok` is not set is undefined.
12222 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
12223 /// A pointer to the contents in the error state.
12224 /// Reading from this pointer when `result_ok` is set is undefined.
12225 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12228 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
12229 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12231 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
12232 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
12233 /// `err` or `result` depending on the state of `result_ok`.
12234 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
12235 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
12236 pub result_ok: bool,
12239 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
12240 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12241 CResult_ChannelMonitorUpdateDecodeErrorZ {
12242 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12243 result: Box::into_raw(Box::new(o)),
12249 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
12250 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12251 CResult_ChannelMonitorUpdateDecodeErrorZ {
12252 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12253 err: Box::into_raw(Box::new(e)),
12258 /// Checks if the given object is currently in the success state
12260 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
12264 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
12265 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
12266 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
12267 fn drop(&mut self) {
12268 if self.result_ok {
12269 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12270 let _ = unsafe { Box::from_raw(self.contents.result) };
12273 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12274 let _ = unsafe { Box::from_raw(self.contents.err) };
12279 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
12280 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12281 let contents = if o.result_ok {
12282 let result = unsafe { o.contents.result };
12283 unsafe { o.contents.result = core::ptr::null_mut() };
12284 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
12286 let err = unsafe { o.contents.err };
12287 unsafe { o.contents.err = core::ptr::null_mut(); }
12288 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
12292 result_ok: o.result_ok,
12296 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
12297 fn clone(&self) -> Self {
12298 if self.result_ok {
12299 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12300 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
12303 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12304 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12310 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
12311 /// but with all dynamically-allocated buffers duplicated in new buffers.
12312 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
12315 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
12316 pub enum COption_MonitorEventZ {
12317 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
12318 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
12319 /// When we're in this state, this COption_MonitorEventZ contains nothing
12322 impl COption_MonitorEventZ {
12323 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12324 if let Self::None = self { false } else { true }
12326 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12329 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
12330 if let Self::Some(v) = self { v } else { unreachable!() }
12334 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
12335 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
12336 COption_MonitorEventZ::Some(o)
12339 /// Constructs a new COption_MonitorEventZ containing nothing
12340 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
12341 COption_MonitorEventZ::None
12344 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
12345 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
12347 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
12348 /// but with all dynamically-allocated buffers duplicated in new buffers.
12349 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
12351 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
12352 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
12353 /// A pointer to the contents in the success state.
12354 /// Reading from this pointer when `result_ok` is not set is undefined.
12355 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
12356 /// A pointer to the contents in the error state.
12357 /// Reading from this pointer when `result_ok` is set is undefined.
12358 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12361 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
12362 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12364 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
12365 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
12366 /// `err` or `result` depending on the state of `result_ok`.
12367 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
12368 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
12369 pub result_ok: bool,
12372 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
12373 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
12374 CResult_COption_MonitorEventZDecodeErrorZ {
12375 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12376 result: Box::into_raw(Box::new(o)),
12382 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
12383 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
12384 CResult_COption_MonitorEventZDecodeErrorZ {
12385 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12386 err: Box::into_raw(Box::new(e)),
12391 /// Checks if the given object is currently in the success state
12393 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
12397 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
12398 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
12399 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
12400 fn drop(&mut self) {
12401 if self.result_ok {
12402 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12403 let _ = unsafe { Box::from_raw(self.contents.result) };
12406 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12407 let _ = unsafe { Box::from_raw(self.contents.err) };
12412 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
12413 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12414 let contents = if o.result_ok {
12415 let result = unsafe { o.contents.result };
12416 unsafe { o.contents.result = core::ptr::null_mut() };
12417 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
12419 let err = unsafe { o.contents.err };
12420 unsafe { o.contents.err = core::ptr::null_mut(); }
12421 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
12425 result_ok: o.result_ok,
12429 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
12430 fn clone(&self) -> Self {
12431 if self.result_ok {
12432 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12433 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
12436 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12437 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12443 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
12444 /// but with all dynamically-allocated buffers duplicated in new buffers.
12445 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
12447 /// The contents of CResult_HTLCUpdateDecodeErrorZ
12448 pub union CResult_HTLCUpdateDecodeErrorZPtr {
12449 /// A pointer to the contents in the success state.
12450 /// Reading from this pointer when `result_ok` is not set is undefined.
12451 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
12452 /// A pointer to the contents in the error state.
12453 /// Reading from this pointer when `result_ok` is set is undefined.
12454 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12457 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
12458 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12460 pub struct CResult_HTLCUpdateDecodeErrorZ {
12461 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
12462 /// `err` or `result` depending on the state of `result_ok`.
12463 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
12464 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
12465 pub result_ok: bool,
12468 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
12469 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
12470 CResult_HTLCUpdateDecodeErrorZ {
12471 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12472 result: Box::into_raw(Box::new(o)),
12478 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
12479 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
12480 CResult_HTLCUpdateDecodeErrorZ {
12481 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12482 err: Box::into_raw(Box::new(e)),
12487 /// Checks if the given object is currently in the success state
12489 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
12493 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
12494 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
12495 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
12496 fn drop(&mut self) {
12497 if self.result_ok {
12498 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12499 let _ = unsafe { Box::from_raw(self.contents.result) };
12502 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12503 let _ = unsafe { Box::from_raw(self.contents.err) };
12508 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
12509 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12510 let contents = if o.result_ok {
12511 let result = unsafe { o.contents.result };
12512 unsafe { o.contents.result = core::ptr::null_mut() };
12513 CResult_HTLCUpdateDecodeErrorZPtr { result }
12515 let err = unsafe { o.contents.err };
12516 unsafe { o.contents.err = core::ptr::null_mut(); }
12517 CResult_HTLCUpdateDecodeErrorZPtr { err }
12521 result_ok: o.result_ok,
12525 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
12526 fn clone(&self) -> Self {
12527 if self.result_ok {
12528 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12529 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
12532 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12533 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12539 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
12540 /// but with all dynamically-allocated buffers duplicated in new buffers.
12541 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
12543 /// A tuple of 2 elements. See the individual fields for the types contained.
12544 pub struct C2Tuple_OutPointCVec_u8ZZ {
12545 /// The element at position 0
12546 pub a: crate::lightning::chain::transaction::OutPoint,
12547 /// The element at position 1
12548 pub b: crate::c_types::derived::CVec_u8Z,
12550 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
12551 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
12558 impl C2Tuple_OutPointCVec_u8ZZ {
12559 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
12563 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
12564 fn clone(&self) -> Self {
12566 a: Clone::clone(&self.a),
12567 b: Clone::clone(&self.b),
12572 /// Creates a new tuple which has the same data as `orig`
12573 /// but with all dynamically-allocated buffers duplicated in new buffers.
12574 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
12575 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
12577 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
12578 C2Tuple_OutPointCVec_u8ZZ { a, b, }
12582 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
12583 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
12585 /// A tuple of 2 elements. See the individual fields for the types contained.
12586 pub struct C2Tuple_u32CVec_u8ZZ {
12587 /// The element at position 0
12589 /// The element at position 1
12590 pub b: crate::c_types::derived::CVec_u8Z,
12592 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
12593 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
12600 impl C2Tuple_u32CVec_u8ZZ {
12601 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
12605 impl Clone for C2Tuple_u32CVec_u8ZZ {
12606 fn clone(&self) -> Self {
12608 a: Clone::clone(&self.a),
12609 b: Clone::clone(&self.b),
12614 /// Creates a new tuple which has the same data as `orig`
12615 /// but with all dynamically-allocated buffers duplicated in new buffers.
12616 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
12617 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
12619 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
12620 C2Tuple_u32CVec_u8ZZ { a, b, }
12624 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
12625 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
12627 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
12628 /// This corresponds to std::vector in C++
12629 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
12630 /// The elements in the array.
12631 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12632 pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
12633 /// The number of elements pointed to by `data`.
12636 impl CVec_C2Tuple_u32CVec_u8ZZZ {
12637 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
12638 if self.datalen == 0 { return Vec::new(); }
12639 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12640 self.data = core::ptr::null_mut();
12644 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
12645 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12648 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
12649 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
12650 let datalen = v.len();
12651 let data = Box::into_raw(v.into_boxed_slice());
12652 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12656 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12657 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
12658 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
12659 fn drop(&mut self) {
12660 if self.datalen == 0 { return; }
12661 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12664 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
12665 fn clone(&self) -> Self {
12666 let mut res = Vec::new();
12667 if self.datalen == 0 { return Self::from(res); }
12668 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12673 /// A tuple of 2 elements. See the individual fields for the types contained.
12674 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12675 /// The element at position 0
12676 pub a: crate::c_types::ThirtyTwoBytes,
12677 /// The element at position 1
12678 pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
12680 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12681 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
12688 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12689 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
12693 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12694 fn clone(&self) -> Self {
12696 a: Clone::clone(&self.a),
12697 b: Clone::clone(&self.b),
12702 /// Creates a new tuple which has the same data as `orig`
12703 /// but with all dynamically-allocated buffers duplicated in new buffers.
12704 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
12705 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
12707 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12708 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
12712 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
12713 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
12715 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
12716 /// This corresponds to std::vector in C++
12717 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12718 /// The elements in the array.
12719 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12720 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
12721 /// The number of elements pointed to by `data`.
12724 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12725 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
12726 if self.datalen == 0 { return Vec::new(); }
12727 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12728 self.data = core::ptr::null_mut();
12732 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
12733 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12736 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12737 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
12738 let datalen = v.len();
12739 let data = Box::into_raw(v.into_boxed_slice());
12740 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12744 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12745 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
12746 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12747 fn drop(&mut self) {
12748 if self.datalen == 0 { return; }
12749 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12752 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12753 fn clone(&self) -> Self {
12754 let mut res = Vec::new();
12755 if self.datalen == 0 { return Self::from(res); }
12756 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12761 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
12762 /// This corresponds to std::vector in C++
12763 pub struct CVec_CommitmentTransactionZ {
12764 /// The elements in the array.
12765 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12766 pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
12767 /// The number of elements pointed to by `data`.
12770 impl CVec_CommitmentTransactionZ {
12771 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
12772 if self.datalen == 0 { return Vec::new(); }
12773 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12774 self.data = core::ptr::null_mut();
12778 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
12779 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12782 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
12783 fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
12784 let datalen = v.len();
12785 let data = Box::into_raw(v.into_boxed_slice());
12786 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12790 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12791 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
12792 impl Drop for CVec_CommitmentTransactionZ {
12793 fn drop(&mut self) {
12794 if self.datalen == 0 { return; }
12795 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12798 impl Clone for CVec_CommitmentTransactionZ {
12799 fn clone(&self) -> Self {
12800 let mut res = Vec::new();
12801 if self.datalen == 0 { return Self::from(res); }
12802 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12807 /// A tuple of 2 elements. See the individual fields for the types contained.
12808 pub struct C2Tuple_u32TxOutZ {
12809 /// The element at position 0
12811 /// The element at position 1
12812 pub b: crate::c_types::TxOut,
12814 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
12815 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
12822 impl C2Tuple_u32TxOutZ {
12823 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
12827 impl Clone for C2Tuple_u32TxOutZ {
12828 fn clone(&self) -> Self {
12830 a: Clone::clone(&self.a),
12831 b: Clone::clone(&self.b),
12836 /// Creates a new tuple which has the same data as `orig`
12837 /// but with all dynamically-allocated buffers duplicated in new buffers.
12838 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
12839 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
12841 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
12842 C2Tuple_u32TxOutZ { a, b, }
12846 /// Frees any resources used by the C2Tuple_u32TxOutZ.
12847 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
12849 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
12850 /// This corresponds to std::vector in C++
12851 pub struct CVec_C2Tuple_u32TxOutZZ {
12852 /// The elements in the array.
12853 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12854 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
12855 /// The number of elements pointed to by `data`.
12858 impl CVec_C2Tuple_u32TxOutZZ {
12859 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
12860 if self.datalen == 0 { return Vec::new(); }
12861 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12862 self.data = core::ptr::null_mut();
12866 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
12867 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12870 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
12871 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
12872 let datalen = v.len();
12873 let data = Box::into_raw(v.into_boxed_slice());
12874 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12878 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12879 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
12880 impl Drop for CVec_C2Tuple_u32TxOutZZ {
12881 fn drop(&mut self) {
12882 if self.datalen == 0 { return; }
12883 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12886 impl Clone for CVec_C2Tuple_u32TxOutZZ {
12887 fn clone(&self) -> Self {
12888 let mut res = Vec::new();
12889 if self.datalen == 0 { return Self::from(res); }
12890 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12895 /// A tuple of 2 elements. See the individual fields for the types contained.
12896 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12897 /// The element at position 0
12898 pub a: crate::c_types::ThirtyTwoBytes,
12899 /// The element at position 1
12900 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
12902 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12903 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
12910 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12911 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
12915 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12916 fn clone(&self) -> Self {
12918 a: Clone::clone(&self.a),
12919 b: Clone::clone(&self.b),
12924 /// Creates a new tuple which has the same data as `orig`
12925 /// but with all dynamically-allocated buffers duplicated in new buffers.
12926 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
12927 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12929 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12930 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
12934 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
12935 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
12937 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
12938 /// This corresponds to std::vector in C++
12939 pub struct CVec_TransactionOutputsZ {
12940 /// The elements in the array.
12941 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12942 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
12943 /// The number of elements pointed to by `data`.
12946 impl CVec_TransactionOutputsZ {
12947 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
12948 if self.datalen == 0 { return Vec::new(); }
12949 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12950 self.data = core::ptr::null_mut();
12954 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
12955 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12958 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
12959 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
12960 let datalen = v.len();
12961 let data = Box::into_raw(v.into_boxed_slice());
12962 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12966 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12967 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
12968 impl Drop for CVec_TransactionOutputsZ {
12969 fn drop(&mut self) {
12970 if self.datalen == 0 { return; }
12971 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12974 impl Clone for CVec_TransactionOutputsZ {
12975 fn clone(&self) -> Self {
12976 let mut res = Vec::new();
12977 if self.datalen == 0 { return Self::from(res); }
12978 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12983 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
12984 /// This corresponds to std::vector in C++
12985 pub struct CVec_BalanceZ {
12986 /// The elements in the array.
12987 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12988 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
12989 /// The number of elements pointed to by `data`.
12992 impl CVec_BalanceZ {
12993 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12994 if self.datalen == 0 { return Vec::new(); }
12995 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12996 self.data = core::ptr::null_mut();
13000 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
13001 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13004 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
13005 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
13006 let datalen = v.len();
13007 let data = Box::into_raw(v.into_boxed_slice());
13008 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13012 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13013 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
13014 impl Drop for CVec_BalanceZ {
13015 fn drop(&mut self) {
13016 if self.datalen == 0 { return; }
13017 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13020 impl Clone for CVec_BalanceZ {
13021 fn clone(&self) -> Self {
13022 let mut res = Vec::new();
13023 if self.datalen == 0 { return Self::from(res); }
13024 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13029 /// A tuple of 2 elements. See the individual fields for the types contained.
13030 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13031 /// The element at position 0
13032 pub a: crate::c_types::ThirtyTwoBytes,
13033 /// The element at position 1
13034 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
13036 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13037 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
13044 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13045 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
13049 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13050 fn clone(&self) -> Self {
13052 a: Clone::clone(&self.a),
13053 b: Clone::clone(&self.b),
13058 /// Creates a new tuple which has the same data as `orig`
13059 /// but with all dynamically-allocated buffers duplicated in new buffers.
13060 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
13061 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
13063 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13064 C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
13068 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
13069 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
13071 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
13072 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13073 /// A pointer to the contents in the success state.
13074 /// Reading from this pointer when `result_ok` is not set is undefined.
13075 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
13076 /// A pointer to the contents in the error state.
13077 /// Reading from this pointer when `result_ok` is set is undefined.
13078 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13081 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
13082 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13083 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13084 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13085 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
13086 /// `err` or `result` depending on the state of `result_ok`.
13087 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
13088 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
13089 pub result_ok: bool,
13092 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
13093 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13094 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13095 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13096 result: Box::into_raw(Box::new(o)),
13102 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
13103 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13104 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13105 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13106 err: Box::into_raw(Box::new(e)),
13111 /// Checks if the given object is currently in the success state
13113 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
13117 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
13118 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
13119 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13120 fn drop(&mut self) {
13121 if self.result_ok {
13122 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13123 let _ = unsafe { Box::from_raw(self.contents.result) };
13126 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13127 let _ = unsafe { Box::from_raw(self.contents.err) };
13132 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13133 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13134 let contents = if o.result_ok {
13135 let result = unsafe { o.contents.result };
13136 unsafe { o.contents.result = core::ptr::null_mut() };
13137 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
13139 let err = unsafe { o.contents.err };
13140 unsafe { o.contents.err = core::ptr::null_mut(); }
13141 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
13145 result_ok: o.result_ok,
13149 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13150 fn clone(&self) -> Self {
13151 if self.result_ok {
13152 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13153 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
13156 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13157 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13163 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
13164 /// but with all dynamically-allocated buffers duplicated in new buffers.
13165 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
13167 /// A tuple of 2 elements. See the individual fields for the types contained.
13168 pub struct C2Tuple_PublicKeyTypeZ {
13169 /// The element at position 0
13170 pub a: crate::c_types::PublicKey,
13171 /// The element at position 1
13172 pub b: crate::lightning::ln::wire::Type,
13174 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
13175 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
13182 impl C2Tuple_PublicKeyTypeZ {
13183 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
13187 impl Clone for C2Tuple_PublicKeyTypeZ {
13188 fn clone(&self) -> Self {
13190 a: Clone::clone(&self.a),
13191 b: Clone::clone(&self.b),
13196 /// Creates a new tuple which has the same data as `orig`
13197 /// but with all dynamically-allocated buffers duplicated in new buffers.
13198 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
13199 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
13201 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
13202 C2Tuple_PublicKeyTypeZ { a, b, }
13206 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
13207 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
13209 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
13210 /// This corresponds to std::vector in C++
13211 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
13212 /// The elements in the array.
13213 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13214 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
13215 /// The number of elements pointed to by `data`.
13218 impl CVec_C2Tuple_PublicKeyTypeZZ {
13219 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
13220 if self.datalen == 0 { return Vec::new(); }
13221 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13222 self.data = core::ptr::null_mut();
13226 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
13227 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13230 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
13231 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
13232 let datalen = v.len();
13233 let data = Box::into_raw(v.into_boxed_slice());
13234 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13238 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13239 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
13240 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
13241 fn drop(&mut self) {
13242 if self.datalen == 0 { return; }
13243 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13246 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
13247 fn clone(&self) -> Self {
13248 let mut res = Vec::new();
13249 if self.datalen == 0 { return Self::from(res); }
13250 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13255 /// A tuple of 2 elements. See the individual fields for the types contained.
13256 pub struct C2Tuple_PublicKeyCVec_SocketAddressZZ {
13257 /// The element at position 0
13258 pub a: crate::c_types::PublicKey,
13259 /// The element at position 1
13260 pub b: crate::c_types::derived::CVec_SocketAddressZ,
13262 impl From<(crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)> for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13263 fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)) -> Self {
13270 impl C2Tuple_PublicKeyCVec_SocketAddressZZ {
13271 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ) {
13275 impl Clone for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13276 fn clone(&self) -> Self {
13278 a: Clone::clone(&self.a),
13279 b: Clone::clone(&self.b),
13284 /// Creates a new tuple which has the same data as `orig`
13285 /// but with all dynamically-allocated buffers duplicated in new buffers.
13286 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCVec_SocketAddressZZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { Clone::clone(&orig) }
13287 /// Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements.
13289 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::CVec_SocketAddressZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ {
13290 C2Tuple_PublicKeyCVec_SocketAddressZZ { a, b, }
13294 /// Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ.
13295 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCVec_SocketAddressZZ) { }
13297 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZs of arbitrary size.
13298 /// This corresponds to std::vector in C++
13299 pub struct CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13300 /// The elements in the array.
13301 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13302 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ,
13303 /// The number of elements pointed to by `data`.
13306 impl CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13307 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ> {
13308 if self.datalen == 0 { return Vec::new(); }
13309 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13310 self.data = core::ptr::null_mut();
13314 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ] {
13315 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13318 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13319 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>) -> Self {
13320 let datalen = v.len();
13321 let data = Box::into_raw(v.into_boxed_slice());
13322 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13326 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13327 pub extern "C" fn CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ) { }
13328 impl Drop for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13329 fn drop(&mut self) {
13330 if self.datalen == 0 { return; }
13331 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13334 impl Clone for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13335 fn clone(&self) -> Self {
13336 let mut res = Vec::new();
13337 if self.datalen == 0 { return Self::from(res); }
13338 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13344 /// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
13345 pub enum COption_OnionMessageContentsZ {
13346 /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
13347 Some(crate::lightning::onion_message::packet::OnionMessageContents),
13348 /// When we're in this state, this COption_OnionMessageContentsZ contains nothing
13351 impl COption_OnionMessageContentsZ {
13352 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13353 if let Self::None = self { false } else { true }
13355 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13358 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents {
13359 if let Self::Some(v) = self { v } else { unreachable!() }
13363 /// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
13364 pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ {
13365 COption_OnionMessageContentsZ::Some(o)
13368 /// Constructs a new COption_OnionMessageContentsZ containing nothing
13369 pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ {
13370 COption_OnionMessageContentsZ::None
13373 /// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
13374 pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { }
13376 /// Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
13377 /// but with all dynamically-allocated buffers duplicated in new buffers.
13378 pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) }
13380 /// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
13381 pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13382 /// A pointer to the contents in the success state.
13383 /// Reading from this pointer when `result_ok` is not set is undefined.
13384 pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ,
13385 /// A pointer to the contents in the error state.
13386 /// Reading from this pointer when `result_ok` is set is undefined.
13387 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13390 /// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
13391 /// containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13393 pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ {
13394 /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
13395 /// `err` or `result` depending on the state of `result_ok`.
13396 pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr,
13397 /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
13398 pub result_ok: bool,
13401 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
13402 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13403 CResult_COption_OnionMessageContentsZDecodeErrorZ {
13404 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13405 result: Box::into_raw(Box::new(o)),
13411 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
13412 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13413 CResult_COption_OnionMessageContentsZDecodeErrorZ {
13414 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13415 err: Box::into_raw(Box::new(e)),
13420 /// Checks if the given object is currently in the success state
13422 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool {
13426 /// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
13427 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { }
13428 impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13429 fn drop(&mut self) {
13430 if self.result_ok {
13431 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13432 let _ = unsafe { Box::from_raw(self.contents.result) };
13435 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13436 let _ = unsafe { Box::from_raw(self.contents.err) };
13441 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13442 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13443 let contents = if o.result_ok {
13444 let result = unsafe { o.contents.result };
13445 unsafe { o.contents.result = core::ptr::null_mut() };
13446 CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result }
13448 let err = unsafe { o.contents.err };
13449 unsafe { o.contents.err = core::ptr::null_mut(); }
13450 CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err }
13454 result_ok: o.result_ok,
13458 impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13459 fn clone(&self) -> Self {
13460 if self.result_ok {
13461 Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13462 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
13465 Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13466 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13472 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
13473 /// but with all dynamically-allocated buffers duplicated in new buffers.
13474 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
13476 /// A tuple of 3 elements. See the individual fields for the types contained.
13477 pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13478 /// The element at position 0
13479 pub a: crate::lightning::onion_message::packet::OnionMessageContents,
13480 /// The element at position 1
13481 pub b: crate::lightning::onion_message::messenger::Destination,
13482 /// The element at position 2
13483 pub c: crate::lightning::blinded_path::BlindedPath,
13485 impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13486 fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
13494 impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13495 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
13496 (self.a, self.b, self.c)
13499 impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13500 fn clone(&self) -> Self {
13502 a: Clone::clone(&self.a),
13503 b: Clone::clone(&self.b),
13504 c: Clone::clone(&self.c),
13509 /// Creates a new tuple which has the same data as `orig`
13510 /// but with all dynamically-allocated buffers duplicated in new buffers.
13511 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) }
13512 /// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
13514 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13515 C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, }
13519 /// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
13520 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { }
13522 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
13523 /// This corresponds to std::vector in C++
13524 pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13525 /// The elements in the array.
13526 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13527 pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ,
13528 /// The number of elements pointed to by `data`.
13531 impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13532 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ> {
13533 if self.datalen == 0 { return Vec::new(); }
13534 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13535 self.data = core::ptr::null_mut();
13539 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] {
13540 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13543 impl From<Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13544 fn from(v: Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>) -> Self {
13545 let datalen = v.len();
13546 let data = Box::into_raw(v.into_boxed_slice());
13547 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13551 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13552 pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { }
13553 impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13554 fn drop(&mut self) {
13555 if self.datalen == 0 { return; }
13556 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13559 impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13560 fn clone(&self) -> Self {
13561 let mut res = Vec::new();
13562 if self.datalen == 0 { return Self::from(res); }
13563 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13569 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
13570 pub enum COption_TypeZ {
13571 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
13572 Some(crate::lightning::ln::wire::Type),
13573 /// When we're in this state, this COption_TypeZ contains nothing
13576 impl COption_TypeZ {
13577 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13578 if let Self::None = self { false } else { true }
13580 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13583 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
13584 if let Self::Some(v) = self { v } else { unreachable!() }
13588 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
13589 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
13590 COption_TypeZ::Some(o)
13593 /// Constructs a new COption_TypeZ containing nothing
13594 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
13595 COption_TypeZ::None
13598 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
13599 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
13601 /// Creates a new COption_TypeZ which has the same data as `orig`
13602 /// but with all dynamically-allocated buffers duplicated in new buffers.
13603 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
13605 /// The contents of CResult_COption_TypeZDecodeErrorZ
13606 pub union CResult_COption_TypeZDecodeErrorZPtr {
13607 /// A pointer to the contents in the success state.
13608 /// Reading from this pointer when `result_ok` is not set is undefined.
13609 pub result: *mut crate::c_types::derived::COption_TypeZ,
13610 /// A pointer to the contents in the error state.
13611 /// Reading from this pointer when `result_ok` is set is undefined.
13612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13615 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
13616 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13618 pub struct CResult_COption_TypeZDecodeErrorZ {
13619 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
13620 /// `err` or `result` depending on the state of `result_ok`.
13621 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
13622 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
13623 pub result_ok: bool,
13626 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
13627 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
13628 CResult_COption_TypeZDecodeErrorZ {
13629 contents: CResult_COption_TypeZDecodeErrorZPtr {
13630 result: Box::into_raw(Box::new(o)),
13636 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
13637 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
13638 CResult_COption_TypeZDecodeErrorZ {
13639 contents: CResult_COption_TypeZDecodeErrorZPtr {
13640 err: Box::into_raw(Box::new(e)),
13645 /// Checks if the given object is currently in the success state
13647 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
13651 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
13652 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
13653 impl Drop for CResult_COption_TypeZDecodeErrorZ {
13654 fn drop(&mut self) {
13655 if self.result_ok {
13656 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13657 let _ = unsafe { Box::from_raw(self.contents.result) };
13660 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13661 let _ = unsafe { Box::from_raw(self.contents.err) };
13666 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
13667 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13668 let contents = if o.result_ok {
13669 let result = unsafe { o.contents.result };
13670 unsafe { o.contents.result = core::ptr::null_mut() };
13671 CResult_COption_TypeZDecodeErrorZPtr { result }
13673 let err = unsafe { o.contents.err };
13674 unsafe { o.contents.err = core::ptr::null_mut(); }
13675 CResult_COption_TypeZDecodeErrorZPtr { err }
13679 result_ok: o.result_ok,
13683 impl Clone for CResult_COption_TypeZDecodeErrorZ {
13684 fn clone(&self) -> Self {
13685 if self.result_ok {
13686 Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
13687 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
13690 Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
13691 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13697 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
13698 /// but with all dynamically-allocated buffers duplicated in new buffers.
13699 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
13702 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
13703 pub enum COption_SocketAddressZ {
13704 /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
13705 Some(crate::lightning::ln::msgs::SocketAddress),
13706 /// When we're in this state, this COption_SocketAddressZ contains nothing
13709 impl COption_SocketAddressZ {
13710 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13711 if let Self::None = self { false } else { true }
13713 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13716 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
13717 if let Self::Some(v) = self { v } else { unreachable!() }
13721 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
13722 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
13723 COption_SocketAddressZ::Some(o)
13726 /// Constructs a new COption_SocketAddressZ containing nothing
13727 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
13728 COption_SocketAddressZ::None
13731 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
13732 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
13734 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
13735 /// but with all dynamically-allocated buffers duplicated in new buffers.
13736 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
13738 /// A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size.
13739 /// This corresponds to std::vector in C++
13740 pub struct CVec_PeerDetailsZ {
13741 /// The elements in the array.
13742 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13743 pub data: *mut crate::lightning::ln::peer_handler::PeerDetails,
13744 /// The number of elements pointed to by `data`.
13747 impl CVec_PeerDetailsZ {
13748 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::peer_handler::PeerDetails> {
13749 if self.datalen == 0 { return Vec::new(); }
13750 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13751 self.data = core::ptr::null_mut();
13755 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::peer_handler::PeerDetails] {
13756 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13759 impl From<Vec<crate::lightning::ln::peer_handler::PeerDetails>> for CVec_PeerDetailsZ {
13760 fn from(v: Vec<crate::lightning::ln::peer_handler::PeerDetails>) -> Self {
13761 let datalen = v.len();
13762 let data = Box::into_raw(v.into_boxed_slice());
13763 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13767 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13768 pub extern "C" fn CVec_PeerDetailsZ_free(_res: CVec_PeerDetailsZ) { }
13769 impl Drop for CVec_PeerDetailsZ {
13770 fn drop(&mut self) {
13771 if self.datalen == 0 { return; }
13772 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13776 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
13777 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
13778 /// A pointer to the contents in the success state.
13779 /// Reading from this pointer when `result_ok` is not set is undefined.
13780 pub result: *mut crate::c_types::derived::CVec_u8Z,
13781 /// A pointer to the contents in the error state.
13782 /// Reading from this pointer when `result_ok` is set is undefined.
13783 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13786 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
13787 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13788 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13789 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
13790 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
13791 /// `err` or `result` depending on the state of `result_ok`.
13792 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
13793 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
13794 pub result_ok: bool,
13797 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
13798 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
13799 CResult_CVec_u8ZPeerHandleErrorZ {
13800 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13801 result: Box::into_raw(Box::new(o)),
13807 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
13808 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
13809 CResult_CVec_u8ZPeerHandleErrorZ {
13810 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13811 err: Box::into_raw(Box::new(e)),
13816 /// Checks if the given object is currently in the success state
13818 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
13822 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
13823 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
13824 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
13825 fn drop(&mut self) {
13826 if self.result_ok {
13827 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13828 let _ = unsafe { Box::from_raw(self.contents.result) };
13831 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13832 let _ = unsafe { Box::from_raw(self.contents.err) };
13837 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
13838 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13839 let contents = if o.result_ok {
13840 let result = unsafe { o.contents.result };
13841 unsafe { o.contents.result = core::ptr::null_mut() };
13842 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
13844 let err = unsafe { o.contents.err };
13845 unsafe { o.contents.err = core::ptr::null_mut(); }
13846 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
13850 result_ok: o.result_ok,
13854 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
13855 fn clone(&self) -> Self {
13856 if self.result_ok {
13857 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13858 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
13861 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13862 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13868 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
13869 /// but with all dynamically-allocated buffers duplicated in new buffers.
13870 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
13872 /// The contents of CResult_NonePeerHandleErrorZ
13873 pub union CResult_NonePeerHandleErrorZPtr {
13874 /// Note that this value is always NULL, as there are no contents in the OK variant
13875 pub result: *mut core::ffi::c_void,
13876 /// A pointer to the contents in the error state.
13877 /// Reading from this pointer when `result_ok` is set is undefined.
13878 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13881 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
13882 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13883 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13884 pub struct CResult_NonePeerHandleErrorZ {
13885 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
13886 /// `err` or `result` depending on the state of `result_ok`.
13887 pub contents: CResult_NonePeerHandleErrorZPtr,
13888 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
13889 pub result_ok: bool,
13892 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
13893 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
13894 CResult_NonePeerHandleErrorZ {
13895 contents: CResult_NonePeerHandleErrorZPtr {
13896 result: core::ptr::null_mut(),
13902 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
13903 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
13904 CResult_NonePeerHandleErrorZ {
13905 contents: CResult_NonePeerHandleErrorZPtr {
13906 err: Box::into_raw(Box::new(e)),
13911 /// Checks if the given object is currently in the success state
13913 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
13917 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
13918 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
13919 impl Drop for CResult_NonePeerHandleErrorZ {
13920 fn drop(&mut self) {
13921 if self.result_ok {
13923 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13924 let _ = unsafe { Box::from_raw(self.contents.err) };
13929 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
13930 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13931 let contents = if o.result_ok {
13932 let _ = unsafe { Box::from_raw(o.contents.result) };
13933 o.contents.result = core::ptr::null_mut();
13934 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
13936 let err = unsafe { o.contents.err };
13937 unsafe { o.contents.err = core::ptr::null_mut(); }
13938 CResult_NonePeerHandleErrorZPtr { err }
13942 result_ok: o.result_ok,
13946 impl Clone for CResult_NonePeerHandleErrorZ {
13947 fn clone(&self) -> Self {
13948 if self.result_ok {
13949 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
13950 result: core::ptr::null_mut()
13953 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
13954 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13960 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
13961 /// but with all dynamically-allocated buffers duplicated in new buffers.
13962 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
13964 /// The contents of CResult_boolPeerHandleErrorZ
13965 pub union CResult_boolPeerHandleErrorZPtr {
13966 /// A pointer to the contents in the success state.
13967 /// Reading from this pointer when `result_ok` is not set is undefined.
13968 pub result: *mut bool,
13969 /// A pointer to the contents in the error state.
13970 /// Reading from this pointer when `result_ok` is set is undefined.
13971 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13974 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
13975 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13976 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13977 pub struct CResult_boolPeerHandleErrorZ {
13978 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
13979 /// `err` or `result` depending on the state of `result_ok`.
13980 pub contents: CResult_boolPeerHandleErrorZPtr,
13981 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
13982 pub result_ok: bool,
13985 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
13986 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
13987 CResult_boolPeerHandleErrorZ {
13988 contents: CResult_boolPeerHandleErrorZPtr {
13989 result: Box::into_raw(Box::new(o)),
13995 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
13996 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
13997 CResult_boolPeerHandleErrorZ {
13998 contents: CResult_boolPeerHandleErrorZPtr {
13999 err: Box::into_raw(Box::new(e)),
14004 /// Checks if the given object is currently in the success state
14006 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
14010 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
14011 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
14012 impl Drop for CResult_boolPeerHandleErrorZ {
14013 fn drop(&mut self) {
14014 if self.result_ok {
14015 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14016 let _ = unsafe { Box::from_raw(self.contents.result) };
14019 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14020 let _ = unsafe { Box::from_raw(self.contents.err) };
14025 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
14026 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
14027 let contents = if o.result_ok {
14028 let result = unsafe { o.contents.result };
14029 unsafe { o.contents.result = core::ptr::null_mut() };
14030 CResult_boolPeerHandleErrorZPtr { result }
14032 let err = unsafe { o.contents.err };
14033 unsafe { o.contents.err = core::ptr::null_mut(); }
14034 CResult_boolPeerHandleErrorZPtr { err }
14038 result_ok: o.result_ok,
14042 impl Clone for CResult_boolPeerHandleErrorZ {
14043 fn clone(&self) -> Self {
14044 if self.result_ok {
14045 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
14046 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
14049 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
14050 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
14056 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
14057 /// but with all dynamically-allocated buffers duplicated in new buffers.
14058 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
14060 /// The contents of CResult_u32GraphSyncErrorZ
14061 pub union CResult_u32GraphSyncErrorZPtr {
14062 /// A pointer to the contents in the success state.
14063 /// Reading from this pointer when `result_ok` is not set is undefined.
14064 pub result: *mut u32,
14065 /// A pointer to the contents in the error state.
14066 /// Reading from this pointer when `result_ok` is set is undefined.
14067 pub err: *mut crate::lightning_rapid_gossip_sync::GraphSyncError,
14070 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
14071 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure.
14072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14073 pub struct CResult_u32GraphSyncErrorZ {
14074 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
14075 /// `err` or `result` depending on the state of `result_ok`.
14076 pub contents: CResult_u32GraphSyncErrorZPtr,
14077 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
14078 pub result_ok: bool,
14081 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
14082 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
14083 CResult_u32GraphSyncErrorZ {
14084 contents: CResult_u32GraphSyncErrorZPtr {
14085 result: Box::into_raw(Box::new(o)),
14091 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
14092 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
14093 CResult_u32GraphSyncErrorZ {
14094 contents: CResult_u32GraphSyncErrorZPtr {
14095 err: Box::into_raw(Box::new(e)),
14100 /// Checks if the given object is currently in the success state
14102 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
14106 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
14107 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
14108 impl Drop for CResult_u32GraphSyncErrorZ {
14109 fn drop(&mut self) {
14110 if self.result_ok {
14111 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14112 let _ = unsafe { Box::from_raw(self.contents.result) };
14115 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14116 let _ = unsafe { Box::from_raw(self.contents.err) };
14121 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
14122 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>) -> Self {
14123 let contents = if o.result_ok {
14124 let result = unsafe { o.contents.result };
14125 unsafe { o.contents.result = core::ptr::null_mut() };
14126 CResult_u32GraphSyncErrorZPtr { result }
14128 let err = unsafe { o.contents.err };
14129 unsafe { o.contents.err = core::ptr::null_mut(); }
14130 CResult_u32GraphSyncErrorZPtr { err }
14134 result_ok: o.result_ok,
14139 /// The contents of CResult_CVec_u8ZIOErrorZ
14140 pub union CResult_CVec_u8ZIOErrorZPtr {
14141 /// A pointer to the contents in the success state.
14142 /// Reading from this pointer when `result_ok` is not set is undefined.
14143 pub result: *mut crate::c_types::derived::CVec_u8Z,
14144 /// A pointer to the contents in the error state.
14145 /// Reading from this pointer when `result_ok` is set is undefined.
14146 pub err: *mut crate::c_types::IOError,
14149 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
14150 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
14151 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14152 pub struct CResult_CVec_u8ZIOErrorZ {
14153 /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
14154 /// `err` or `result` depending on the state of `result_ok`.
14155 pub contents: CResult_CVec_u8ZIOErrorZPtr,
14156 /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
14157 pub result_ok: bool,
14160 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
14161 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
14162 CResult_CVec_u8ZIOErrorZ {
14163 contents: CResult_CVec_u8ZIOErrorZPtr {
14164 result: Box::into_raw(Box::new(o)),
14170 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
14171 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
14172 CResult_CVec_u8ZIOErrorZ {
14173 contents: CResult_CVec_u8ZIOErrorZPtr {
14174 err: Box::into_raw(Box::new(e)),
14179 /// Checks if the given object is currently in the success state
14181 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
14185 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
14186 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
14187 impl Drop for CResult_CVec_u8ZIOErrorZ {
14188 fn drop(&mut self) {
14189 if self.result_ok {
14190 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14191 let _ = unsafe { Box::from_raw(self.contents.result) };
14194 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14195 let _ = unsafe { Box::from_raw(self.contents.err) };
14200 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
14201 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
14202 let contents = if o.result_ok {
14203 let result = unsafe { o.contents.result };
14204 unsafe { o.contents.result = core::ptr::null_mut() };
14205 CResult_CVec_u8ZIOErrorZPtr { result }
14207 let err = unsafe { o.contents.err };
14208 unsafe { o.contents.err = core::ptr::null_mut(); }
14209 CResult_CVec_u8ZIOErrorZPtr { err }
14213 result_ok: o.result_ok,
14217 impl Clone for CResult_CVec_u8ZIOErrorZ {
14218 fn clone(&self) -> Self {
14219 if self.result_ok {
14220 Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
14221 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
14224 Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
14225 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14231 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
14232 /// but with all dynamically-allocated buffers duplicated in new buffers.
14233 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
14235 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
14236 /// This corresponds to std::vector in C++
14237 pub struct CVec_StrZ {
14238 /// The elements in the array.
14239 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14240 pub data: *mut crate::c_types::Str,
14241 /// The number of elements pointed to by `data`.
14245 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
14246 if self.datalen == 0 { return Vec::new(); }
14247 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14248 self.data = core::ptr::null_mut();
14252 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
14253 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14256 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
14257 fn from(v: Vec<crate::c_types::Str>) -> Self {
14258 let datalen = v.len();
14259 let data = Box::into_raw(v.into_boxed_slice());
14260 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14264 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14265 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
14266 impl Drop for CVec_StrZ {
14267 fn drop(&mut self) {
14268 if self.datalen == 0 { return; }
14269 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14272 impl Clone for CVec_StrZ {
14273 fn clone(&self) -> Self {
14274 let mut res = Vec::new();
14275 if self.datalen == 0 { return Self::from(res); }
14276 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14281 /// The contents of CResult_CVec_StrZIOErrorZ
14282 pub union CResult_CVec_StrZIOErrorZPtr {
14283 /// A pointer to the contents in the success state.
14284 /// Reading from this pointer when `result_ok` is not set is undefined.
14285 pub result: *mut crate::c_types::derived::CVec_StrZ,
14286 /// A pointer to the contents in the error state.
14287 /// Reading from this pointer when `result_ok` is set is undefined.
14288 pub err: *mut crate::c_types::IOError,
14291 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
14292 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
14293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14294 pub struct CResult_CVec_StrZIOErrorZ {
14295 /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
14296 /// `err` or `result` depending on the state of `result_ok`.
14297 pub contents: CResult_CVec_StrZIOErrorZPtr,
14298 /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
14299 pub result_ok: bool,
14302 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
14303 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
14304 CResult_CVec_StrZIOErrorZ {
14305 contents: CResult_CVec_StrZIOErrorZPtr {
14306 result: Box::into_raw(Box::new(o)),
14312 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
14313 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
14314 CResult_CVec_StrZIOErrorZ {
14315 contents: CResult_CVec_StrZIOErrorZPtr {
14316 err: Box::into_raw(Box::new(e)),
14321 /// Checks if the given object is currently in the success state
14323 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
14327 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
14328 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
14329 impl Drop for CResult_CVec_StrZIOErrorZ {
14330 fn drop(&mut self) {
14331 if self.result_ok {
14332 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14333 let _ = unsafe { Box::from_raw(self.contents.result) };
14336 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14337 let _ = unsafe { Box::from_raw(self.contents.err) };
14342 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
14343 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
14344 let contents = if o.result_ok {
14345 let result = unsafe { o.contents.result };
14346 unsafe { o.contents.result = core::ptr::null_mut() };
14347 CResult_CVec_StrZIOErrorZPtr { result }
14349 let err = unsafe { o.contents.err };
14350 unsafe { o.contents.err = core::ptr::null_mut(); }
14351 CResult_CVec_StrZIOErrorZPtr { err }
14355 result_ok: o.result_ok,
14359 impl Clone for CResult_CVec_StrZIOErrorZ {
14360 fn clone(&self) -> Self {
14361 if self.result_ok {
14362 Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
14363 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
14366 Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
14367 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14373 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
14374 /// but with all dynamically-allocated buffers duplicated in new buffers.
14375 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
14377 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
14378 /// This corresponds to std::vector in C++
14379 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14380 /// The elements in the array.
14381 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14382 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14383 /// The number of elements pointed to by `data`.
14386 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14387 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
14388 if self.datalen == 0 { return Vec::new(); }
14389 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14390 self.data = core::ptr::null_mut();
14394 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
14395 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14398 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14399 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
14400 let datalen = v.len();
14401 let data = Box::into_raw(v.into_boxed_slice());
14402 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14406 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14407 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
14408 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14409 fn drop(&mut self) {
14410 if self.datalen == 0 { return; }
14411 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14414 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14415 fn clone(&self) -> Self {
14416 let mut res = Vec::new();
14417 if self.datalen == 0 { return Self::from(res); }
14418 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14423 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
14424 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14425 /// A pointer to the contents in the success state.
14426 /// Reading from this pointer when `result_ok` is not set is undefined.
14427 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
14428 /// A pointer to the contents in the error state.
14429 /// Reading from this pointer when `result_ok` is set is undefined.
14430 pub err: *mut crate::c_types::IOError,
14433 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
14434 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
14435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14436 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14437 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
14438 /// `err` or `result` depending on the state of `result_ok`.
14439 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
14440 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
14441 pub result_ok: bool,
14444 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
14445 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14446 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14447 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14448 result: Box::into_raw(Box::new(o)),
14454 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
14455 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14456 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14457 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14458 err: Box::into_raw(Box::new(e)),
14463 /// Checks if the given object is currently in the success state
14465 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
14469 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
14470 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
14471 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14472 fn drop(&mut self) {
14473 if self.result_ok {
14474 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14475 let _ = unsafe { Box::from_raw(self.contents.result) };
14478 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14479 let _ = unsafe { Box::from_raw(self.contents.err) };
14484 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14485 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> Self {
14486 let contents = if o.result_ok {
14487 let result = unsafe { o.contents.result };
14488 unsafe { o.contents.result = core::ptr::null_mut() };
14489 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
14491 let err = unsafe { o.contents.err };
14492 unsafe { o.contents.err = core::ptr::null_mut(); }
14493 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
14497 result_ok: o.result_ok,
14501 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14502 fn clone(&self) -> Self {
14503 if self.result_ok {
14504 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14505 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
14508 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14509 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14515 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
14516 /// but with all dynamically-allocated buffers duplicated in new buffers.
14517 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
14519 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
14520 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14521 /// A pointer to the contents in the success state.
14522 /// Reading from this pointer when `result_ok` is not set is undefined.
14523 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14524 /// A pointer to the contents in the error state.
14525 /// Reading from this pointer when `result_ok` is set is undefined.
14526 pub err: *mut crate::c_types::IOError,
14529 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
14530 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
14531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14532 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14533 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
14534 /// `err` or `result` depending on the state of `result_ok`.
14535 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
14536 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
14537 pub result_ok: bool,
14540 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
14541 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14542 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14543 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14544 result: Box::into_raw(Box::new(o)),
14550 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
14551 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14552 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14553 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14554 err: Box::into_raw(Box::new(e)),
14559 /// Checks if the given object is currently in the success state
14561 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
14565 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
14566 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
14567 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14568 fn drop(&mut self) {
14569 if self.result_ok {
14570 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14571 let _ = unsafe { Box::from_raw(self.contents.result) };
14574 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14575 let _ = unsafe { Box::from_raw(self.contents.err) };
14580 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14581 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
14582 let contents = if o.result_ok {
14583 let result = unsafe { o.contents.result };
14584 unsafe { o.contents.result = core::ptr::null_mut() };
14585 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
14587 let err = unsafe { o.contents.err };
14588 unsafe { o.contents.err = core::ptr::null_mut(); }
14589 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
14593 result_ok: o.result_ok,
14597 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14598 fn clone(&self) -> Self {
14599 if self.result_ok {
14600 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14601 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
14604 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14605 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14611 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
14612 /// but with all dynamically-allocated buffers duplicated in new buffers.
14613 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
14615 /// The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ
14616 pub union CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14617 /// A pointer to the contents in the success state.
14618 /// Reading from this pointer when `result_ok` is not set is undefined.
14619 pub result: *mut crate::lightning::offers::invoice_request::UnsignedInvoiceRequest,
14620 /// A pointer to the contents in the error state.
14621 /// Reading from this pointer when `result_ok` is set is undefined.
14622 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14625 /// A CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14626 /// containing a crate::lightning::offers::invoice_request::UnsignedInvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14628 pub struct CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14629 /// The contents of this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ, accessible via either
14630 /// `err` or `result` depending on the state of `result_ok`.
14631 pub contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr,
14632 /// Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state.
14633 pub result_ok: bool,
14636 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the success state.
14637 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14638 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14639 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14640 result: Box::into_raw(Box::new(o)),
14646 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the error state.
14647 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14648 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14649 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14650 err: Box::into_raw(Box::new(e)),
14655 /// Checks if the given object is currently in the success state
14657 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> bool {
14661 /// Frees any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ.
14662 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) { }
14663 impl Drop for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14664 fn drop(&mut self) {
14665 if self.result_ok {
14666 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14667 let _ = unsafe { Box::from_raw(self.contents.result) };
14670 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14671 let _ = unsafe { Box::from_raw(self.contents.err) };
14676 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14677 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14678 let contents = if o.result_ok {
14679 let result = unsafe { o.contents.result };
14680 unsafe { o.contents.result = core::ptr::null_mut() };
14681 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { result }
14683 let err = unsafe { o.contents.err };
14684 unsafe { o.contents.err = core::ptr::null_mut(); }
14685 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { err }
14689 result_ok: o.result_ok,
14694 /// The contents of CResult_InvoiceRequestBolt12SemanticErrorZ
14695 pub union CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14696 /// A pointer to the contents in the success state.
14697 /// Reading from this pointer when `result_ok` is not set is undefined.
14698 pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequest,
14699 /// A pointer to the contents in the error state.
14700 /// Reading from this pointer when `result_ok` is set is undefined.
14701 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14704 /// A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14705 /// containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14707 pub struct CResult_InvoiceRequestBolt12SemanticErrorZ {
14708 /// The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either
14709 /// `err` or `result` depending on the state of `result_ok`.
14710 pub contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr,
14711 /// Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state.
14712 pub result_ok: bool,
14715 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state.
14716 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14717 CResult_InvoiceRequestBolt12SemanticErrorZ {
14718 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14719 result: Box::into_raw(Box::new(o)),
14725 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state.
14726 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14727 CResult_InvoiceRequestBolt12SemanticErrorZ {
14728 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14729 err: Box::into_raw(Box::new(e)),
14734 /// Checks if the given object is currently in the success state
14736 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> bool {
14740 /// Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ.
14741 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestBolt12SemanticErrorZ) { }
14742 impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ {
14743 fn drop(&mut self) {
14744 if self.result_ok {
14745 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14746 let _ = unsafe { Box::from_raw(self.contents.result) };
14749 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14750 let _ = unsafe { Box::from_raw(self.contents.err) };
14755 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestBolt12SemanticErrorZ {
14756 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14757 let contents = if o.result_ok {
14758 let result = unsafe { o.contents.result };
14759 unsafe { o.contents.result = core::ptr::null_mut() };
14760 CResult_InvoiceRequestBolt12SemanticErrorZPtr { result }
14762 let err = unsafe { o.contents.err };
14763 unsafe { o.contents.err = core::ptr::null_mut(); }
14764 CResult_InvoiceRequestBolt12SemanticErrorZPtr { err }
14768 result_ok: o.result_ok,
14772 impl Clone for CResult_InvoiceRequestBolt12SemanticErrorZ {
14773 fn clone(&self) -> Self {
14774 if self.result_ok {
14775 Self { result_ok: true, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14776 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequest>::clone(unsafe { &*self.contents.result })))
14779 Self { result_ok: false, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14780 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
14786 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
14787 /// but with all dynamically-allocated buffers duplicated in new buffers.
14788 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> CResult_InvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) }
14791 /// An enum which can either contain a crate::c_types::SecretKey or not
14792 pub enum COption_SecretKeyZ {
14793 /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
14794 Some(crate::c_types::SecretKey),
14795 /// When we're in this state, this COption_SecretKeyZ contains nothing
14798 impl COption_SecretKeyZ {
14799 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
14800 if let Self::None = self { false } else { true }
14802 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
14805 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
14806 if let Self::Some(v) = self { v } else { unreachable!() }
14810 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
14811 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
14812 COption_SecretKeyZ::Some(o)
14815 /// Constructs a new COption_SecretKeyZ containing nothing
14816 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
14817 COption_SecretKeyZ::None
14820 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
14821 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
14823 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
14824 /// but with all dynamically-allocated buffers duplicated in new buffers.
14825 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
14827 /// The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ
14828 pub union CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14829 /// A pointer to the contents in the success state.
14830 /// Reading from this pointer when `result_ok` is not set is undefined.
14831 pub result: *mut crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder,
14832 /// A pointer to the contents in the error state.
14833 /// Reading from this pointer when `result_ok` is set is undefined.
14834 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14837 /// A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
14838 /// containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14839 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14840 pub struct CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14841 /// The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
14842 /// `err` or `result` depending on the state of `result_ok`.
14843 pub contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr,
14844 /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
14845 pub result_ok: bool,
14848 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
14849 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14850 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14851 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14852 result: Box::into_raw(Box::new(o)),
14858 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
14859 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14860 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14861 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14862 err: Box::into_raw(Box::new(e)),
14867 /// Checks if the given object is currently in the success state
14869 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
14873 /// Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.
14874 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) { }
14875 impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14876 fn drop(&mut self) {
14877 if self.result_ok {
14878 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14879 let _ = unsafe { Box::from_raw(self.contents.result) };
14882 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14883 let _ = unsafe { Box::from_raw(self.contents.err) };
14888 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14889 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14890 let contents = if o.result_ok {
14891 let result = unsafe { o.contents.result };
14892 unsafe { o.contents.result = core::ptr::null_mut() };
14893 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
14895 let err = unsafe { o.contents.err };
14896 unsafe { o.contents.err = core::ptr::null_mut(); }
14897 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
14901 result_ok: o.result_ok,
14906 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
14907 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
14908 /// A pointer to the contents in the success state.
14909 /// Reading from this pointer when `result_ok` is not set is undefined.
14910 pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
14911 /// Note that this value is always NULL, as there are no contents in the Err variant
14912 pub err: *mut core::ffi::c_void,
14915 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
14916 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
14917 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14918 pub struct CResult_VerifiedInvoiceRequestNoneZ {
14919 /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
14920 /// `err` or `result` depending on the state of `result_ok`.
14921 pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
14922 /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
14923 pub result_ok: bool,
14926 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
14927 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
14928 CResult_VerifiedInvoiceRequestNoneZ {
14929 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14930 result: Box::into_raw(Box::new(o)),
14936 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
14937 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
14938 CResult_VerifiedInvoiceRequestNoneZ {
14939 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14940 err: core::ptr::null_mut(),
14945 /// Checks if the given object is currently in the success state
14947 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
14951 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
14952 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
14953 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
14954 fn drop(&mut self) {
14955 if self.result_ok {
14956 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14957 let _ = unsafe { Box::from_raw(self.contents.result) };
14963 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
14964 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
14965 let contents = if o.result_ok {
14966 let result = unsafe { o.contents.result };
14967 unsafe { o.contents.result = core::ptr::null_mut() };
14968 CResult_VerifiedInvoiceRequestNoneZPtr { result }
14970 let _ = unsafe { Box::from_raw(o.contents.err) };
14971 o.contents.err = core::ptr::null_mut();
14972 CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
14976 result_ok: o.result_ok,
14980 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
14981 fn clone(&self) -> Self {
14982 if self.result_ok {
14983 Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14984 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
14987 Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14988 err: core::ptr::null_mut()
14994 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
14995 /// but with all dynamically-allocated buffers duplicated in new buffers.
14996 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
14998 /// The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ
14999 pub union CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15000 /// A pointer to the contents in the success state.
15001 /// Reading from this pointer when `result_ok` is not set is undefined.
15002 pub result: *mut crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder,
15003 /// A pointer to the contents in the error state.
15004 /// Reading from this pointer when `result_ok` is set is undefined.
15005 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
15008 /// A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
15009 /// containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
15010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15011 pub struct CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15012 /// The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
15013 /// `err` or `result` depending on the state of `result_ok`.
15014 pub contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr,
15015 /// Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
15016 pub result_ok: bool,
15019 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
15020 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15021 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15022 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15023 result: Box::into_raw(Box::new(o)),
15029 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
15030 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15031 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15032 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15033 err: Box::into_raw(Box::new(e)),
15038 /// Checks if the given object is currently in the success state
15040 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
15044 /// Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ.
15045 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) { }
15046 impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15047 fn drop(&mut self) {
15048 if self.result_ok {
15049 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15050 let _ = unsafe { Box::from_raw(self.contents.result) };
15053 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15054 let _ = unsafe { Box::from_raw(self.contents.err) };
15059 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15060 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
15061 let contents = if o.result_ok {
15062 let result = unsafe { o.contents.result };
15063 unsafe { o.contents.result = core::ptr::null_mut() };
15064 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
15066 let err = unsafe { o.contents.err };
15067 unsafe { o.contents.err = core::ptr::null_mut(); }
15068 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
15072 result_ok: o.result_ok,
15077 /// The contents of CResult_InvoiceRequestFieldsDecodeErrorZ
15078 pub union CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15079 /// A pointer to the contents in the success state.
15080 /// Reading from this pointer when `result_ok` is not set is undefined.
15081 pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestFields,
15082 /// A pointer to the contents in the error state.
15083 /// Reading from this pointer when `result_ok` is set is undefined.
15084 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15087 /// A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation,
15088 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
15089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15090 pub struct CResult_InvoiceRequestFieldsDecodeErrorZ {
15091 /// The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either
15092 /// `err` or `result` depending on the state of `result_ok`.
15093 pub contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr,
15094 /// Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state.
15095 pub result_ok: bool,
15098 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state.
15099 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestFields) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
15100 CResult_InvoiceRequestFieldsDecodeErrorZ {
15101 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15102 result: Box::into_raw(Box::new(o)),
15108 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state.
15109 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
15110 CResult_InvoiceRequestFieldsDecodeErrorZ {
15111 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15112 err: Box::into_raw(Box::new(e)),
15117 /// Checks if the given object is currently in the success state
15119 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> bool {
15123 /// Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ.
15124 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res: CResult_InvoiceRequestFieldsDecodeErrorZ) { }
15125 impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ {
15126 fn drop(&mut self) {
15127 if self.result_ok {
15128 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15129 let _ = unsafe { Box::from_raw(self.contents.result) };
15132 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15133 let _ = unsafe { Box::from_raw(self.contents.err) };
15138 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceRequestFieldsDecodeErrorZ {
15139 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
15140 let contents = if o.result_ok {
15141 let result = unsafe { o.contents.result };
15142 unsafe { o.contents.result = core::ptr::null_mut() };
15143 CResult_InvoiceRequestFieldsDecodeErrorZPtr { result }
15145 let err = unsafe { o.contents.err };
15146 unsafe { o.contents.err = core::ptr::null_mut(); }
15147 CResult_InvoiceRequestFieldsDecodeErrorZPtr { err }
15151 result_ok: o.result_ok,
15155 impl Clone for CResult_InvoiceRequestFieldsDecodeErrorZ {
15156 fn clone(&self) -> Self {
15157 if self.result_ok {
15158 Self { result_ok: true, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15159 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequestFields>::clone(unsafe { &*self.contents.result })))
15162 Self { result_ok: false, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15163 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15169 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig`
15170 /// but with all dynamically-allocated buffers duplicated in new buffers.
15171 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> CResult_InvoiceRequestFieldsDecodeErrorZ { Clone::clone(&orig) }
15173 /// An enum which can either contain a or not
15174 pub enum COption_NoneZ {
15175 /// When we're in this state, this COption_NoneZ contains a
15177 /// When we're in this state, this COption_NoneZ contains nothing
15180 impl COption_NoneZ {
15181 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15182 if let Self::None = self { false } else { true }
15184 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15189 /// Constructs a new COption_NoneZ containing a
15190 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
15191 COption_NoneZ::Some
15194 /// Constructs a new COption_NoneZ containing nothing
15195 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
15196 COption_NoneZ::None
15199 /// Frees any resources associated with the , if we are in the Some state
15200 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
15202 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
15203 /// This corresponds to std::vector in C++
15204 pub struct CVec_WitnessZ {
15205 /// The elements in the array.
15206 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15207 pub data: *mut crate::c_types::Witness,
15208 /// The number of elements pointed to by `data`.
15211 impl CVec_WitnessZ {
15212 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
15213 if self.datalen == 0 { return Vec::new(); }
15214 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15215 self.data = core::ptr::null_mut();
15219 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
15220 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15223 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
15224 fn from(v: Vec<crate::c_types::Witness>) -> Self {
15225 let datalen = v.len();
15226 let data = Box::into_raw(v.into_boxed_slice());
15227 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15231 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15232 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
15233 impl Drop for CVec_WitnessZ {
15234 fn drop(&mut self) {
15235 if self.datalen == 0 { return; }
15236 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15239 impl Clone for CVec_WitnessZ {
15240 fn clone(&self) -> Self {
15241 let mut res = Vec::new();
15242 if self.datalen == 0 { return Self::from(res); }
15243 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15249 /// An enum which can either contain a crate::c_types::ECDSASignature or not
15250 pub enum COption_ECDSASignatureZ {
15251 /// When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature
15252 Some(crate::c_types::ECDSASignature),
15253 /// When we're in this state, this COption_ECDSASignatureZ contains nothing
15256 impl COption_ECDSASignatureZ {
15257 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15258 if let Self::None = self { false } else { true }
15260 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15263 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ECDSASignature {
15264 if let Self::Some(v) = self { v } else { unreachable!() }
15268 /// Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature
15269 pub extern "C" fn COption_ECDSASignatureZ_some(o: crate::c_types::ECDSASignature) -> COption_ECDSASignatureZ {
15270 COption_ECDSASignatureZ::Some(o)
15273 /// Constructs a new COption_ECDSASignatureZ containing nothing
15274 pub extern "C" fn COption_ECDSASignatureZ_none() -> COption_ECDSASignatureZ {
15275 COption_ECDSASignatureZ::None
15278 /// Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state
15279 pub extern "C" fn COption_ECDSASignatureZ_free(_res: COption_ECDSASignatureZ) { }
15281 /// Creates a new COption_ECDSASignatureZ which has the same data as `orig`
15282 /// but with all dynamically-allocated buffers duplicated in new buffers.
15283 pub extern "C" fn COption_ECDSASignatureZ_clone(orig: &COption_ECDSASignatureZ) -> COption_ECDSASignatureZ { Clone::clone(&orig) }
15286 /// An enum which can either contain a i64 or not
15287 pub enum COption_i64Z {
15288 /// When we're in this state, this COption_i64Z contains a i64
15290 /// When we're in this state, this COption_i64Z contains nothing
15293 impl COption_i64Z {
15294 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15295 if let Self::None = self { false } else { true }
15297 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15300 #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
15301 if let Self::Some(v) = self { v } else { unreachable!() }
15305 /// Constructs a new COption_i64Z containing a i64
15306 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
15307 COption_i64Z::Some(o)
15310 /// Constructs a new COption_i64Z containing nothing
15311 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
15315 /// Frees any resources associated with the i64, if we are in the Some state
15316 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
15318 /// Creates a new COption_i64Z which has the same data as `orig`
15319 /// but with all dynamically-allocated buffers duplicated in new buffers.
15320 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
15322 /// The contents of CResult_SocketAddressDecodeErrorZ
15323 pub union CResult_SocketAddressDecodeErrorZPtr {
15324 /// A pointer to the contents in the success state.
15325 /// Reading from this pointer when `result_ok` is not set is undefined.
15326 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15327 /// A pointer to the contents in the error state.
15328 /// Reading from this pointer when `result_ok` is set is undefined.
15329 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15332 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
15333 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
15334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15335 pub struct CResult_SocketAddressDecodeErrorZ {
15336 /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
15337 /// `err` or `result` depending on the state of `result_ok`.
15338 pub contents: CResult_SocketAddressDecodeErrorZPtr,
15339 /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
15340 pub result_ok: bool,
15343 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
15344 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
15345 CResult_SocketAddressDecodeErrorZ {
15346 contents: CResult_SocketAddressDecodeErrorZPtr {
15347 result: Box::into_raw(Box::new(o)),
15353 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
15354 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
15355 CResult_SocketAddressDecodeErrorZ {
15356 contents: CResult_SocketAddressDecodeErrorZPtr {
15357 err: Box::into_raw(Box::new(e)),
15362 /// Checks if the given object is currently in the success state
15364 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
15368 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
15369 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
15370 impl Drop for CResult_SocketAddressDecodeErrorZ {
15371 fn drop(&mut self) {
15372 if self.result_ok {
15373 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15374 let _ = unsafe { Box::from_raw(self.contents.result) };
15377 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15378 let _ = unsafe { Box::from_raw(self.contents.err) };
15383 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
15384 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
15385 let contents = if o.result_ok {
15386 let result = unsafe { o.contents.result };
15387 unsafe { o.contents.result = core::ptr::null_mut() };
15388 CResult_SocketAddressDecodeErrorZPtr { result }
15390 let err = unsafe { o.contents.err };
15391 unsafe { o.contents.err = core::ptr::null_mut(); }
15392 CResult_SocketAddressDecodeErrorZPtr { err }
15396 result_ok: o.result_ok,
15400 impl Clone for CResult_SocketAddressDecodeErrorZ {
15401 fn clone(&self) -> Self {
15402 if self.result_ok {
15403 Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
15404 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15407 Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
15408 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15414 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
15415 /// but with all dynamically-allocated buffers duplicated in new buffers.
15416 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
15418 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
15419 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
15420 /// A pointer to the contents in the success state.
15421 /// Reading from this pointer when `result_ok` is not set is undefined.
15422 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15423 /// A pointer to the contents in the error state.
15424 /// Reading from this pointer when `result_ok` is set is undefined.
15425 pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
15428 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
15429 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
15430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15431 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
15432 /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
15433 /// `err` or `result` depending on the state of `result_ok`.
15434 pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
15435 /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
15436 pub result_ok: bool,
15439 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
15440 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
15441 CResult_SocketAddressSocketAddressParseErrorZ {
15442 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15443 result: Box::into_raw(Box::new(o)),
15449 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
15450 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
15451 CResult_SocketAddressSocketAddressParseErrorZ {
15452 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15453 err: Box::into_raw(Box::new(e)),
15458 /// Checks if the given object is currently in the success state
15460 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
15464 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
15465 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
15466 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
15467 fn drop(&mut self) {
15468 if self.result_ok {
15469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15470 let _ = unsafe { Box::from_raw(self.contents.result) };
15473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15474 let _ = unsafe { Box::from_raw(self.contents.err) };
15479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
15480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
15481 let contents = if o.result_ok {
15482 let result = unsafe { o.contents.result };
15483 unsafe { o.contents.result = core::ptr::null_mut() };
15484 CResult_SocketAddressSocketAddressParseErrorZPtr { result }
15486 let err = unsafe { o.contents.err };
15487 unsafe { o.contents.err = core::ptr::null_mut(); }
15488 CResult_SocketAddressSocketAddressParseErrorZPtr { err }
15492 result_ok: o.result_ok,
15496 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
15497 fn clone(&self) -> Self {
15498 if self.result_ok {
15499 Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15500 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15503 Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15504 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
15510 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
15511 /// but with all dynamically-allocated buffers duplicated in new buffers.
15512 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
15514 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
15515 /// This corresponds to std::vector in C++
15516 pub struct CVec_UpdateAddHTLCZ {
15517 /// The elements in the array.
15518 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15519 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15520 /// The number of elements pointed to by `data`.
15523 impl CVec_UpdateAddHTLCZ {
15524 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
15525 if self.datalen == 0 { return Vec::new(); }
15526 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15527 self.data = core::ptr::null_mut();
15531 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
15532 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15535 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
15536 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
15537 let datalen = v.len();
15538 let data = Box::into_raw(v.into_boxed_slice());
15539 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15543 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15544 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
15545 impl Drop for CVec_UpdateAddHTLCZ {
15546 fn drop(&mut self) {
15547 if self.datalen == 0 { return; }
15548 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15551 impl Clone for CVec_UpdateAddHTLCZ {
15552 fn clone(&self) -> Self {
15553 let mut res = Vec::new();
15554 if self.datalen == 0 { return Self::from(res); }
15555 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15560 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
15561 /// This corresponds to std::vector in C++
15562 pub struct CVec_UpdateFulfillHTLCZ {
15563 /// The elements in the array.
15564 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15565 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
15566 /// The number of elements pointed to by `data`.
15569 impl CVec_UpdateFulfillHTLCZ {
15570 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
15571 if self.datalen == 0 { return Vec::new(); }
15572 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15573 self.data = core::ptr::null_mut();
15577 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
15578 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15581 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
15582 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
15583 let datalen = v.len();
15584 let data = Box::into_raw(v.into_boxed_slice());
15585 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15589 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15590 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
15591 impl Drop for CVec_UpdateFulfillHTLCZ {
15592 fn drop(&mut self) {
15593 if self.datalen == 0 { return; }
15594 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15597 impl Clone for CVec_UpdateFulfillHTLCZ {
15598 fn clone(&self) -> Self {
15599 let mut res = Vec::new();
15600 if self.datalen == 0 { return Self::from(res); }
15601 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15606 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
15607 /// This corresponds to std::vector in C++
15608 pub struct CVec_UpdateFailHTLCZ {
15609 /// The elements in the array.
15610 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15611 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15612 /// The number of elements pointed to by `data`.
15615 impl CVec_UpdateFailHTLCZ {
15616 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
15617 if self.datalen == 0 { return Vec::new(); }
15618 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15619 self.data = core::ptr::null_mut();
15623 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
15624 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15627 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
15628 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
15629 let datalen = v.len();
15630 let data = Box::into_raw(v.into_boxed_slice());
15631 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15635 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15636 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
15637 impl Drop for CVec_UpdateFailHTLCZ {
15638 fn drop(&mut self) {
15639 if self.datalen == 0 { return; }
15640 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15643 impl Clone for CVec_UpdateFailHTLCZ {
15644 fn clone(&self) -> Self {
15645 let mut res = Vec::new();
15646 if self.datalen == 0 { return Self::from(res); }
15647 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15652 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
15653 /// This corresponds to std::vector in C++
15654 pub struct CVec_UpdateFailMalformedHTLCZ {
15655 /// The elements in the array.
15656 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15657 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15658 /// The number of elements pointed to by `data`.
15661 impl CVec_UpdateFailMalformedHTLCZ {
15662 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
15663 if self.datalen == 0 { return Vec::new(); }
15664 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15665 self.data = core::ptr::null_mut();
15669 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
15670 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15673 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
15674 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
15675 let datalen = v.len();
15676 let data = Box::into_raw(v.into_boxed_slice());
15677 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15681 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15682 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
15683 impl Drop for CVec_UpdateFailMalformedHTLCZ {
15684 fn drop(&mut self) {
15685 if self.datalen == 0 { return; }
15686 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15689 impl Clone for CVec_UpdateFailMalformedHTLCZ {
15690 fn clone(&self) -> Self {
15691 let mut res = Vec::new();
15692 if self.datalen == 0 { return Self::from(res); }
15693 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15698 /// The contents of CResult_AcceptChannelDecodeErrorZ
15699 pub union CResult_AcceptChannelDecodeErrorZPtr {
15700 /// A pointer to the contents in the success state.
15701 /// Reading from this pointer when `result_ok` is not set is undefined.
15702 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
15703 /// A pointer to the contents in the error state.
15704 /// Reading from this pointer when `result_ok` is set is undefined.
15705 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15708 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
15709 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15711 pub struct CResult_AcceptChannelDecodeErrorZ {
15712 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
15713 /// `err` or `result` depending on the state of `result_ok`.
15714 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
15715 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
15716 pub result_ok: bool,
15719 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
15720 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
15721 CResult_AcceptChannelDecodeErrorZ {
15722 contents: CResult_AcceptChannelDecodeErrorZPtr {
15723 result: Box::into_raw(Box::new(o)),
15729 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
15730 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
15731 CResult_AcceptChannelDecodeErrorZ {
15732 contents: CResult_AcceptChannelDecodeErrorZPtr {
15733 err: Box::into_raw(Box::new(e)),
15738 /// Checks if the given object is currently in the success state
15740 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
15744 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
15745 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
15746 impl Drop for CResult_AcceptChannelDecodeErrorZ {
15747 fn drop(&mut self) {
15748 if self.result_ok {
15749 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15750 let _ = unsafe { Box::from_raw(self.contents.result) };
15753 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15754 let _ = unsafe { Box::from_raw(self.contents.err) };
15759 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
15760 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15761 let contents = if o.result_ok {
15762 let result = unsafe { o.contents.result };
15763 unsafe { o.contents.result = core::ptr::null_mut() };
15764 CResult_AcceptChannelDecodeErrorZPtr { result }
15766 let err = unsafe { o.contents.err };
15767 unsafe { o.contents.err = core::ptr::null_mut(); }
15768 CResult_AcceptChannelDecodeErrorZPtr { err }
15772 result_ok: o.result_ok,
15776 impl Clone for CResult_AcceptChannelDecodeErrorZ {
15777 fn clone(&self) -> Self {
15778 if self.result_ok {
15779 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
15780 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
15783 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
15784 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15790 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
15791 /// but with all dynamically-allocated buffers duplicated in new buffers.
15792 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
15794 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
15795 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
15796 /// A pointer to the contents in the success state.
15797 /// Reading from this pointer when `result_ok` is not set is undefined.
15798 pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
15799 /// A pointer to the contents in the error state.
15800 /// Reading from this pointer when `result_ok` is set is undefined.
15801 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15804 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
15805 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
15806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15807 pub struct CResult_AcceptChannelV2DecodeErrorZ {
15808 /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
15809 /// `err` or `result` depending on the state of `result_ok`.
15810 pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
15811 /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
15812 pub result_ok: bool,
15815 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
15816 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
15817 CResult_AcceptChannelV2DecodeErrorZ {
15818 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15819 result: Box::into_raw(Box::new(o)),
15825 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
15826 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
15827 CResult_AcceptChannelV2DecodeErrorZ {
15828 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15829 err: Box::into_raw(Box::new(e)),
15834 /// Checks if the given object is currently in the success state
15836 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
15840 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
15841 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
15842 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
15843 fn drop(&mut self) {
15844 if self.result_ok {
15845 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15846 let _ = unsafe { Box::from_raw(self.contents.result) };
15849 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15850 let _ = unsafe { Box::from_raw(self.contents.err) };
15855 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
15856 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
15857 let contents = if o.result_ok {
15858 let result = unsafe { o.contents.result };
15859 unsafe { o.contents.result = core::ptr::null_mut() };
15860 CResult_AcceptChannelV2DecodeErrorZPtr { result }
15862 let err = unsafe { o.contents.err };
15863 unsafe { o.contents.err = core::ptr::null_mut(); }
15864 CResult_AcceptChannelV2DecodeErrorZPtr { err }
15868 result_ok: o.result_ok,
15872 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
15873 fn clone(&self) -> Self {
15874 if self.result_ok {
15875 Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15876 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
15879 Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15880 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15886 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
15887 /// but with all dynamically-allocated buffers duplicated in new buffers.
15888 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
15890 /// The contents of CResult_StfuDecodeErrorZ
15891 pub union CResult_StfuDecodeErrorZPtr {
15892 /// A pointer to the contents in the success state.
15893 /// Reading from this pointer when `result_ok` is not set is undefined.
15894 pub result: *mut crate::lightning::ln::msgs::Stfu,
15895 /// A pointer to the contents in the error state.
15896 /// Reading from this pointer when `result_ok` is set is undefined.
15897 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15900 /// A CResult_StfuDecodeErrorZ represents the result of a fallible operation,
15901 /// containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure.
15902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15903 pub struct CResult_StfuDecodeErrorZ {
15904 /// The contents of this CResult_StfuDecodeErrorZ, accessible via either
15905 /// `err` or `result` depending on the state of `result_ok`.
15906 pub contents: CResult_StfuDecodeErrorZPtr,
15907 /// Whether this CResult_StfuDecodeErrorZ represents a success state.
15908 pub result_ok: bool,
15911 /// Creates a new CResult_StfuDecodeErrorZ in the success state.
15912 pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ {
15913 CResult_StfuDecodeErrorZ {
15914 contents: CResult_StfuDecodeErrorZPtr {
15915 result: Box::into_raw(Box::new(o)),
15921 /// Creates a new CResult_StfuDecodeErrorZ in the error state.
15922 pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ {
15923 CResult_StfuDecodeErrorZ {
15924 contents: CResult_StfuDecodeErrorZPtr {
15925 err: Box::into_raw(Box::new(e)),
15930 /// Checks if the given object is currently in the success state
15932 pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool {
15936 /// Frees any resources used by the CResult_StfuDecodeErrorZ.
15937 pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { }
15938 impl Drop for CResult_StfuDecodeErrorZ {
15939 fn drop(&mut self) {
15940 if self.result_ok {
15941 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15942 let _ = unsafe { Box::from_raw(self.contents.result) };
15945 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15946 let _ = unsafe { Box::from_raw(self.contents.err) };
15951 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>> for CResult_StfuDecodeErrorZ {
15952 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>) -> Self {
15953 let contents = if o.result_ok {
15954 let result = unsafe { o.contents.result };
15955 unsafe { o.contents.result = core::ptr::null_mut() };
15956 CResult_StfuDecodeErrorZPtr { result }
15958 let err = unsafe { o.contents.err };
15959 unsafe { o.contents.err = core::ptr::null_mut(); }
15960 CResult_StfuDecodeErrorZPtr { err }
15964 result_ok: o.result_ok,
15968 impl Clone for CResult_StfuDecodeErrorZ {
15969 fn clone(&self) -> Self {
15970 if self.result_ok {
15971 Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr {
15972 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Stfu>::clone(unsafe { &*self.contents.result })))
15975 Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr {
15976 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15982 /// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig`
15983 /// but with all dynamically-allocated buffers duplicated in new buffers.
15984 pub extern "C" fn CResult_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) }
15986 /// The contents of CResult_SpliceDecodeErrorZ
15987 pub union CResult_SpliceDecodeErrorZPtr {
15988 /// A pointer to the contents in the success state.
15989 /// Reading from this pointer when `result_ok` is not set is undefined.
15990 pub result: *mut crate::lightning::ln::msgs::Splice,
15991 /// A pointer to the contents in the error state.
15992 /// Reading from this pointer when `result_ok` is set is undefined.
15993 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15996 /// A CResult_SpliceDecodeErrorZ represents the result of a fallible operation,
15997 /// containing a crate::lightning::ln::msgs::Splice on success and a crate::lightning::ln::msgs::DecodeError on failure.
15998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15999 pub struct CResult_SpliceDecodeErrorZ {
16000 /// The contents of this CResult_SpliceDecodeErrorZ, accessible via either
16001 /// `err` or `result` depending on the state of `result_ok`.
16002 pub contents: CResult_SpliceDecodeErrorZPtr,
16003 /// Whether this CResult_SpliceDecodeErrorZ represents a success state.
16004 pub result_ok: bool,
16007 /// Creates a new CResult_SpliceDecodeErrorZ in the success state.
16008 pub extern "C" fn CResult_SpliceDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Splice) -> CResult_SpliceDecodeErrorZ {
16009 CResult_SpliceDecodeErrorZ {
16010 contents: CResult_SpliceDecodeErrorZPtr {
16011 result: Box::into_raw(Box::new(o)),
16017 /// Creates a new CResult_SpliceDecodeErrorZ in the error state.
16018 pub extern "C" fn CResult_SpliceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceDecodeErrorZ {
16019 CResult_SpliceDecodeErrorZ {
16020 contents: CResult_SpliceDecodeErrorZPtr {
16021 err: Box::into_raw(Box::new(e)),
16026 /// Checks if the given object is currently in the success state
16028 pub extern "C" fn CResult_SpliceDecodeErrorZ_is_ok(o: &CResult_SpliceDecodeErrorZ) -> bool {
16032 /// Frees any resources used by the CResult_SpliceDecodeErrorZ.
16033 pub extern "C" fn CResult_SpliceDecodeErrorZ_free(_res: CResult_SpliceDecodeErrorZ) { }
16034 impl Drop for CResult_SpliceDecodeErrorZ {
16035 fn drop(&mut self) {
16036 if self.result_ok {
16037 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16038 let _ = unsafe { Box::from_raw(self.contents.result) };
16041 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16042 let _ = unsafe { Box::from_raw(self.contents.err) };
16047 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceDecodeErrorZ {
16048 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>) -> Self {
16049 let contents = if o.result_ok {
16050 let result = unsafe { o.contents.result };
16051 unsafe { o.contents.result = core::ptr::null_mut() };
16052 CResult_SpliceDecodeErrorZPtr { result }
16054 let err = unsafe { o.contents.err };
16055 unsafe { o.contents.err = core::ptr::null_mut(); }
16056 CResult_SpliceDecodeErrorZPtr { err }
16060 result_ok: o.result_ok,
16064 impl Clone for CResult_SpliceDecodeErrorZ {
16065 fn clone(&self) -> Self {
16066 if self.result_ok {
16067 Self { result_ok: true, contents: CResult_SpliceDecodeErrorZPtr {
16068 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Splice>::clone(unsafe { &*self.contents.result })))
16071 Self { result_ok: false, contents: CResult_SpliceDecodeErrorZPtr {
16072 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16078 /// Creates a new CResult_SpliceDecodeErrorZ which has the same data as `orig`
16079 /// but with all dynamically-allocated buffers duplicated in new buffers.
16080 pub extern "C" fn CResult_SpliceDecodeErrorZ_clone(orig: &CResult_SpliceDecodeErrorZ) -> CResult_SpliceDecodeErrorZ { Clone::clone(&orig) }
16082 /// The contents of CResult_SpliceAckDecodeErrorZ
16083 pub union CResult_SpliceAckDecodeErrorZPtr {
16084 /// A pointer to the contents in the success state.
16085 /// Reading from this pointer when `result_ok` is not set is undefined.
16086 pub result: *mut crate::lightning::ln::msgs::SpliceAck,
16087 /// A pointer to the contents in the error state.
16088 /// Reading from this pointer when `result_ok` is set is undefined.
16089 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16092 /// A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation,
16093 /// containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure.
16094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16095 pub struct CResult_SpliceAckDecodeErrorZ {
16096 /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either
16097 /// `err` or `result` depending on the state of `result_ok`.
16098 pub contents: CResult_SpliceAckDecodeErrorZPtr,
16099 /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state.
16100 pub result_ok: bool,
16103 /// Creates a new CResult_SpliceAckDecodeErrorZ in the success state.
16104 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ {
16105 CResult_SpliceAckDecodeErrorZ {
16106 contents: CResult_SpliceAckDecodeErrorZPtr {
16107 result: Box::into_raw(Box::new(o)),
16113 /// Creates a new CResult_SpliceAckDecodeErrorZ in the error state.
16114 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ {
16115 CResult_SpliceAckDecodeErrorZ {
16116 contents: CResult_SpliceAckDecodeErrorZPtr {
16117 err: Box::into_raw(Box::new(e)),
16122 /// Checks if the given object is currently in the success state
16124 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool {
16128 /// Frees any resources used by the CResult_SpliceAckDecodeErrorZ.
16129 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { }
16130 impl Drop for CResult_SpliceAckDecodeErrorZ {
16131 fn drop(&mut self) {
16132 if self.result_ok {
16133 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16134 let _ = unsafe { Box::from_raw(self.contents.result) };
16137 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16138 let _ = unsafe { Box::from_raw(self.contents.err) };
16143 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceAckDecodeErrorZ {
16144 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>) -> Self {
16145 let contents = if o.result_ok {
16146 let result = unsafe { o.contents.result };
16147 unsafe { o.contents.result = core::ptr::null_mut() };
16148 CResult_SpliceAckDecodeErrorZPtr { result }
16150 let err = unsafe { o.contents.err };
16151 unsafe { o.contents.err = core::ptr::null_mut(); }
16152 CResult_SpliceAckDecodeErrorZPtr { err }
16156 result_ok: o.result_ok,
16160 impl Clone for CResult_SpliceAckDecodeErrorZ {
16161 fn clone(&self) -> Self {
16162 if self.result_ok {
16163 Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr {
16164 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceAck>::clone(unsafe { &*self.contents.result })))
16167 Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr {
16168 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16174 /// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig`
16175 /// but with all dynamically-allocated buffers duplicated in new buffers.
16176 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) }
16178 /// The contents of CResult_SpliceLockedDecodeErrorZ
16179 pub union CResult_SpliceLockedDecodeErrorZPtr {
16180 /// A pointer to the contents in the success state.
16181 /// Reading from this pointer when `result_ok` is not set is undefined.
16182 pub result: *mut crate::lightning::ln::msgs::SpliceLocked,
16183 /// A pointer to the contents in the error state.
16184 /// Reading from this pointer when `result_ok` is set is undefined.
16185 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16188 /// A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation,
16189 /// containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
16190 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16191 pub struct CResult_SpliceLockedDecodeErrorZ {
16192 /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either
16193 /// `err` or `result` depending on the state of `result_ok`.
16194 pub contents: CResult_SpliceLockedDecodeErrorZPtr,
16195 /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state.
16196 pub result_ok: bool,
16199 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state.
16200 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ {
16201 CResult_SpliceLockedDecodeErrorZ {
16202 contents: CResult_SpliceLockedDecodeErrorZPtr {
16203 result: Box::into_raw(Box::new(o)),
16209 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state.
16210 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ {
16211 CResult_SpliceLockedDecodeErrorZ {
16212 contents: CResult_SpliceLockedDecodeErrorZPtr {
16213 err: Box::into_raw(Box::new(e)),
16218 /// Checks if the given object is currently in the success state
16220 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool {
16224 /// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ.
16225 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { }
16226 impl Drop for CResult_SpliceLockedDecodeErrorZ {
16227 fn drop(&mut self) {
16228 if self.result_ok {
16229 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16230 let _ = unsafe { Box::from_raw(self.contents.result) };
16233 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16234 let _ = unsafe { Box::from_raw(self.contents.err) };
16239 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceLockedDecodeErrorZ {
16240 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
16241 let contents = if o.result_ok {
16242 let result = unsafe { o.contents.result };
16243 unsafe { o.contents.result = core::ptr::null_mut() };
16244 CResult_SpliceLockedDecodeErrorZPtr { result }
16246 let err = unsafe { o.contents.err };
16247 unsafe { o.contents.err = core::ptr::null_mut(); }
16248 CResult_SpliceLockedDecodeErrorZPtr { err }
16252 result_ok: o.result_ok,
16256 impl Clone for CResult_SpliceLockedDecodeErrorZ {
16257 fn clone(&self) -> Self {
16258 if self.result_ok {
16259 Self { result_ok: true, contents: CResult_SpliceLockedDecodeErrorZPtr {
16260 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceLocked>::clone(unsafe { &*self.contents.result })))
16263 Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr {
16264 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16270 /// Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig`
16271 /// but with all dynamically-allocated buffers duplicated in new buffers.
16272 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) }
16274 /// The contents of CResult_TxAddInputDecodeErrorZ
16275 pub union CResult_TxAddInputDecodeErrorZPtr {
16276 /// A pointer to the contents in the success state.
16277 /// Reading from this pointer when `result_ok` is not set is undefined.
16278 pub result: *mut crate::lightning::ln::msgs::TxAddInput,
16279 /// A pointer to the contents in the error state.
16280 /// Reading from this pointer when `result_ok` is set is undefined.
16281 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16284 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
16285 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16287 pub struct CResult_TxAddInputDecodeErrorZ {
16288 /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
16289 /// `err` or `result` depending on the state of `result_ok`.
16290 pub contents: CResult_TxAddInputDecodeErrorZPtr,
16291 /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
16292 pub result_ok: bool,
16295 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
16296 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
16297 CResult_TxAddInputDecodeErrorZ {
16298 contents: CResult_TxAddInputDecodeErrorZPtr {
16299 result: Box::into_raw(Box::new(o)),
16305 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
16306 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
16307 CResult_TxAddInputDecodeErrorZ {
16308 contents: CResult_TxAddInputDecodeErrorZPtr {
16309 err: Box::into_raw(Box::new(e)),
16314 /// Checks if the given object is currently in the success state
16316 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
16320 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
16321 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
16322 impl Drop for CResult_TxAddInputDecodeErrorZ {
16323 fn drop(&mut self) {
16324 if self.result_ok {
16325 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16326 let _ = unsafe { Box::from_raw(self.contents.result) };
16329 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16330 let _ = unsafe { Box::from_raw(self.contents.err) };
16335 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
16336 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16337 let contents = if o.result_ok {
16338 let result = unsafe { o.contents.result };
16339 unsafe { o.contents.result = core::ptr::null_mut() };
16340 CResult_TxAddInputDecodeErrorZPtr { result }
16342 let err = unsafe { o.contents.err };
16343 unsafe { o.contents.err = core::ptr::null_mut(); }
16344 CResult_TxAddInputDecodeErrorZPtr { err }
16348 result_ok: o.result_ok,
16352 impl Clone for CResult_TxAddInputDecodeErrorZ {
16353 fn clone(&self) -> Self {
16354 if self.result_ok {
16355 Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
16356 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
16359 Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
16360 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16366 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
16367 /// but with all dynamically-allocated buffers duplicated in new buffers.
16368 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
16370 /// The contents of CResult_TxAddOutputDecodeErrorZ
16371 pub union CResult_TxAddOutputDecodeErrorZPtr {
16372 /// A pointer to the contents in the success state.
16373 /// Reading from this pointer when `result_ok` is not set is undefined.
16374 pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
16375 /// A pointer to the contents in the error state.
16376 /// Reading from this pointer when `result_ok` is set is undefined.
16377 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16380 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
16381 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16383 pub struct CResult_TxAddOutputDecodeErrorZ {
16384 /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
16385 /// `err` or `result` depending on the state of `result_ok`.
16386 pub contents: CResult_TxAddOutputDecodeErrorZPtr,
16387 /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
16388 pub result_ok: bool,
16391 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
16392 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
16393 CResult_TxAddOutputDecodeErrorZ {
16394 contents: CResult_TxAddOutputDecodeErrorZPtr {
16395 result: Box::into_raw(Box::new(o)),
16401 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
16402 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
16403 CResult_TxAddOutputDecodeErrorZ {
16404 contents: CResult_TxAddOutputDecodeErrorZPtr {
16405 err: Box::into_raw(Box::new(e)),
16410 /// Checks if the given object is currently in the success state
16412 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
16416 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
16417 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
16418 impl Drop for CResult_TxAddOutputDecodeErrorZ {
16419 fn drop(&mut self) {
16420 if self.result_ok {
16421 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16422 let _ = unsafe { Box::from_raw(self.contents.result) };
16425 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16426 let _ = unsafe { Box::from_raw(self.contents.err) };
16431 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
16432 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16433 let contents = if o.result_ok {
16434 let result = unsafe { o.contents.result };
16435 unsafe { o.contents.result = core::ptr::null_mut() };
16436 CResult_TxAddOutputDecodeErrorZPtr { result }
16438 let err = unsafe { o.contents.err };
16439 unsafe { o.contents.err = core::ptr::null_mut(); }
16440 CResult_TxAddOutputDecodeErrorZPtr { err }
16444 result_ok: o.result_ok,
16448 impl Clone for CResult_TxAddOutputDecodeErrorZ {
16449 fn clone(&self) -> Self {
16450 if self.result_ok {
16451 Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
16452 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
16455 Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
16456 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16462 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
16463 /// but with all dynamically-allocated buffers duplicated in new buffers.
16464 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
16466 /// The contents of CResult_TxRemoveInputDecodeErrorZ
16467 pub union CResult_TxRemoveInputDecodeErrorZPtr {
16468 /// A pointer to the contents in the success state.
16469 /// Reading from this pointer when `result_ok` is not set is undefined.
16470 pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
16471 /// A pointer to the contents in the error state.
16472 /// Reading from this pointer when `result_ok` is set is undefined.
16473 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16476 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
16477 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16478 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16479 pub struct CResult_TxRemoveInputDecodeErrorZ {
16480 /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
16481 /// `err` or `result` depending on the state of `result_ok`.
16482 pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
16483 /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
16484 pub result_ok: bool,
16487 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
16488 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
16489 CResult_TxRemoveInputDecodeErrorZ {
16490 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16491 result: Box::into_raw(Box::new(o)),
16497 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
16498 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
16499 CResult_TxRemoveInputDecodeErrorZ {
16500 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16501 err: Box::into_raw(Box::new(e)),
16506 /// Checks if the given object is currently in the success state
16508 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
16512 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
16513 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
16514 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
16515 fn drop(&mut self) {
16516 if self.result_ok {
16517 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16518 let _ = unsafe { Box::from_raw(self.contents.result) };
16521 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16522 let _ = unsafe { Box::from_raw(self.contents.err) };
16527 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
16528 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16529 let contents = if o.result_ok {
16530 let result = unsafe { o.contents.result };
16531 unsafe { o.contents.result = core::ptr::null_mut() };
16532 CResult_TxRemoveInputDecodeErrorZPtr { result }
16534 let err = unsafe { o.contents.err };
16535 unsafe { o.contents.err = core::ptr::null_mut(); }
16536 CResult_TxRemoveInputDecodeErrorZPtr { err }
16540 result_ok: o.result_ok,
16544 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
16545 fn clone(&self) -> Self {
16546 if self.result_ok {
16547 Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16548 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
16551 Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16552 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16558 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
16559 /// but with all dynamically-allocated buffers duplicated in new buffers.
16560 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
16562 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
16563 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
16564 /// A pointer to the contents in the success state.
16565 /// Reading from this pointer when `result_ok` is not set is undefined.
16566 pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
16567 /// A pointer to the contents in the error state.
16568 /// Reading from this pointer when `result_ok` is set is undefined.
16569 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16572 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
16573 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16575 pub struct CResult_TxRemoveOutputDecodeErrorZ {
16576 /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
16577 /// `err` or `result` depending on the state of `result_ok`.
16578 pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
16579 /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
16580 pub result_ok: bool,
16583 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
16584 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
16585 CResult_TxRemoveOutputDecodeErrorZ {
16586 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16587 result: Box::into_raw(Box::new(o)),
16593 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
16594 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
16595 CResult_TxRemoveOutputDecodeErrorZ {
16596 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16597 err: Box::into_raw(Box::new(e)),
16602 /// Checks if the given object is currently in the success state
16604 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
16608 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
16609 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
16610 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
16611 fn drop(&mut self) {
16612 if self.result_ok {
16613 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16614 let _ = unsafe { Box::from_raw(self.contents.result) };
16617 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16618 let _ = unsafe { Box::from_raw(self.contents.err) };
16623 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
16624 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16625 let contents = if o.result_ok {
16626 let result = unsafe { o.contents.result };
16627 unsafe { o.contents.result = core::ptr::null_mut() };
16628 CResult_TxRemoveOutputDecodeErrorZPtr { result }
16630 let err = unsafe { o.contents.err };
16631 unsafe { o.contents.err = core::ptr::null_mut(); }
16632 CResult_TxRemoveOutputDecodeErrorZPtr { err }
16636 result_ok: o.result_ok,
16640 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
16641 fn clone(&self) -> Self {
16642 if self.result_ok {
16643 Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16644 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
16647 Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16648 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16654 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
16655 /// but with all dynamically-allocated buffers duplicated in new buffers.
16656 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
16658 /// The contents of CResult_TxCompleteDecodeErrorZ
16659 pub union CResult_TxCompleteDecodeErrorZPtr {
16660 /// A pointer to the contents in the success state.
16661 /// Reading from this pointer when `result_ok` is not set is undefined.
16662 pub result: *mut crate::lightning::ln::msgs::TxComplete,
16663 /// A pointer to the contents in the error state.
16664 /// Reading from this pointer when `result_ok` is set is undefined.
16665 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16668 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
16669 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
16670 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16671 pub struct CResult_TxCompleteDecodeErrorZ {
16672 /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
16673 /// `err` or `result` depending on the state of `result_ok`.
16674 pub contents: CResult_TxCompleteDecodeErrorZPtr,
16675 /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
16676 pub result_ok: bool,
16679 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
16680 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
16681 CResult_TxCompleteDecodeErrorZ {
16682 contents: CResult_TxCompleteDecodeErrorZPtr {
16683 result: Box::into_raw(Box::new(o)),
16689 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
16690 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
16691 CResult_TxCompleteDecodeErrorZ {
16692 contents: CResult_TxCompleteDecodeErrorZPtr {
16693 err: Box::into_raw(Box::new(e)),
16698 /// Checks if the given object is currently in the success state
16700 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
16704 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
16705 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
16706 impl Drop for CResult_TxCompleteDecodeErrorZ {
16707 fn drop(&mut self) {
16708 if self.result_ok {
16709 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16710 let _ = unsafe { Box::from_raw(self.contents.result) };
16713 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16714 let _ = unsafe { Box::from_raw(self.contents.err) };
16719 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
16720 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
16721 let contents = if o.result_ok {
16722 let result = unsafe { o.contents.result };
16723 unsafe { o.contents.result = core::ptr::null_mut() };
16724 CResult_TxCompleteDecodeErrorZPtr { result }
16726 let err = unsafe { o.contents.err };
16727 unsafe { o.contents.err = core::ptr::null_mut(); }
16728 CResult_TxCompleteDecodeErrorZPtr { err }
16732 result_ok: o.result_ok,
16736 impl Clone for CResult_TxCompleteDecodeErrorZ {
16737 fn clone(&self) -> Self {
16738 if self.result_ok {
16739 Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
16740 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
16743 Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
16744 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16750 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
16751 /// but with all dynamically-allocated buffers duplicated in new buffers.
16752 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
16754 /// The contents of CResult_TxSignaturesDecodeErrorZ
16755 pub union CResult_TxSignaturesDecodeErrorZPtr {
16756 /// A pointer to the contents in the success state.
16757 /// Reading from this pointer when `result_ok` is not set is undefined.
16758 pub result: *mut crate::lightning::ln::msgs::TxSignatures,
16759 /// A pointer to the contents in the error state.
16760 /// Reading from this pointer when `result_ok` is set is undefined.
16761 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16764 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
16765 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
16766 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16767 pub struct CResult_TxSignaturesDecodeErrorZ {
16768 /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
16769 /// `err` or `result` depending on the state of `result_ok`.
16770 pub contents: CResult_TxSignaturesDecodeErrorZPtr,
16771 /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
16772 pub result_ok: bool,
16775 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
16776 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
16777 CResult_TxSignaturesDecodeErrorZ {
16778 contents: CResult_TxSignaturesDecodeErrorZPtr {
16779 result: Box::into_raw(Box::new(o)),
16785 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
16786 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
16787 CResult_TxSignaturesDecodeErrorZ {
16788 contents: CResult_TxSignaturesDecodeErrorZPtr {
16789 err: Box::into_raw(Box::new(e)),
16794 /// Checks if the given object is currently in the success state
16796 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
16800 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
16801 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
16802 impl Drop for CResult_TxSignaturesDecodeErrorZ {
16803 fn drop(&mut self) {
16804 if self.result_ok {
16805 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16806 let _ = unsafe { Box::from_raw(self.contents.result) };
16809 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16810 let _ = unsafe { Box::from_raw(self.contents.err) };
16815 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
16816 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
16817 let contents = if o.result_ok {
16818 let result = unsafe { o.contents.result };
16819 unsafe { o.contents.result = core::ptr::null_mut() };
16820 CResult_TxSignaturesDecodeErrorZPtr { result }
16822 let err = unsafe { o.contents.err };
16823 unsafe { o.contents.err = core::ptr::null_mut(); }
16824 CResult_TxSignaturesDecodeErrorZPtr { err }
16828 result_ok: o.result_ok,
16832 impl Clone for CResult_TxSignaturesDecodeErrorZ {
16833 fn clone(&self) -> Self {
16834 if self.result_ok {
16835 Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
16836 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
16839 Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
16840 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16846 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
16847 /// but with all dynamically-allocated buffers duplicated in new buffers.
16848 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
16850 /// The contents of CResult_TxInitRbfDecodeErrorZ
16851 pub union CResult_TxInitRbfDecodeErrorZPtr {
16852 /// A pointer to the contents in the success state.
16853 /// Reading from this pointer when `result_ok` is not set is undefined.
16854 pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
16855 /// A pointer to the contents in the error state.
16856 /// Reading from this pointer when `result_ok` is set is undefined.
16857 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16860 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
16861 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
16862 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16863 pub struct CResult_TxInitRbfDecodeErrorZ {
16864 /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
16865 /// `err` or `result` depending on the state of `result_ok`.
16866 pub contents: CResult_TxInitRbfDecodeErrorZPtr,
16867 /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
16868 pub result_ok: bool,
16871 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
16872 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
16873 CResult_TxInitRbfDecodeErrorZ {
16874 contents: CResult_TxInitRbfDecodeErrorZPtr {
16875 result: Box::into_raw(Box::new(o)),
16881 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
16882 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
16883 CResult_TxInitRbfDecodeErrorZ {
16884 contents: CResult_TxInitRbfDecodeErrorZPtr {
16885 err: Box::into_raw(Box::new(e)),
16890 /// Checks if the given object is currently in the success state
16892 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
16896 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
16897 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
16898 impl Drop for CResult_TxInitRbfDecodeErrorZ {
16899 fn drop(&mut self) {
16900 if self.result_ok {
16901 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16902 let _ = unsafe { Box::from_raw(self.contents.result) };
16905 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16906 let _ = unsafe { Box::from_raw(self.contents.err) };
16911 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
16912 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
16913 let contents = if o.result_ok {
16914 let result = unsafe { o.contents.result };
16915 unsafe { o.contents.result = core::ptr::null_mut() };
16916 CResult_TxInitRbfDecodeErrorZPtr { result }
16918 let err = unsafe { o.contents.err };
16919 unsafe { o.contents.err = core::ptr::null_mut(); }
16920 CResult_TxInitRbfDecodeErrorZPtr { err }
16924 result_ok: o.result_ok,
16928 impl Clone for CResult_TxInitRbfDecodeErrorZ {
16929 fn clone(&self) -> Self {
16930 if self.result_ok {
16931 Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
16932 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
16935 Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
16936 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16942 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
16943 /// but with all dynamically-allocated buffers duplicated in new buffers.
16944 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
16946 /// The contents of CResult_TxAckRbfDecodeErrorZ
16947 pub union CResult_TxAckRbfDecodeErrorZPtr {
16948 /// A pointer to the contents in the success state.
16949 /// Reading from this pointer when `result_ok` is not set is undefined.
16950 pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
16951 /// A pointer to the contents in the error state.
16952 /// Reading from this pointer when `result_ok` is set is undefined.
16953 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16956 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
16957 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
16958 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16959 pub struct CResult_TxAckRbfDecodeErrorZ {
16960 /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
16961 /// `err` or `result` depending on the state of `result_ok`.
16962 pub contents: CResult_TxAckRbfDecodeErrorZPtr,
16963 /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
16964 pub result_ok: bool,
16967 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
16968 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
16969 CResult_TxAckRbfDecodeErrorZ {
16970 contents: CResult_TxAckRbfDecodeErrorZPtr {
16971 result: Box::into_raw(Box::new(o)),
16977 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
16978 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
16979 CResult_TxAckRbfDecodeErrorZ {
16980 contents: CResult_TxAckRbfDecodeErrorZPtr {
16981 err: Box::into_raw(Box::new(e)),
16986 /// Checks if the given object is currently in the success state
16988 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
16992 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
16993 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
16994 impl Drop for CResult_TxAckRbfDecodeErrorZ {
16995 fn drop(&mut self) {
16996 if self.result_ok {
16997 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16998 let _ = unsafe { Box::from_raw(self.contents.result) };
17001 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17002 let _ = unsafe { Box::from_raw(self.contents.err) };
17007 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
17008 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
17009 let contents = if o.result_ok {
17010 let result = unsafe { o.contents.result };
17011 unsafe { o.contents.result = core::ptr::null_mut() };
17012 CResult_TxAckRbfDecodeErrorZPtr { result }
17014 let err = unsafe { o.contents.err };
17015 unsafe { o.contents.err = core::ptr::null_mut(); }
17016 CResult_TxAckRbfDecodeErrorZPtr { err }
17020 result_ok: o.result_ok,
17024 impl Clone for CResult_TxAckRbfDecodeErrorZ {
17025 fn clone(&self) -> Self {
17026 if self.result_ok {
17027 Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
17028 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
17031 Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
17032 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17038 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
17039 /// but with all dynamically-allocated buffers duplicated in new buffers.
17040 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
17042 /// The contents of CResult_TxAbortDecodeErrorZ
17043 pub union CResult_TxAbortDecodeErrorZPtr {
17044 /// A pointer to the contents in the success state.
17045 /// Reading from this pointer when `result_ok` is not set is undefined.
17046 pub result: *mut crate::lightning::ln::msgs::TxAbort,
17047 /// A pointer to the contents in the error state.
17048 /// Reading from this pointer when `result_ok` is set is undefined.
17049 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17052 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
17053 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
17054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17055 pub struct CResult_TxAbortDecodeErrorZ {
17056 /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
17057 /// `err` or `result` depending on the state of `result_ok`.
17058 pub contents: CResult_TxAbortDecodeErrorZPtr,
17059 /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
17060 pub result_ok: bool,
17063 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
17064 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
17065 CResult_TxAbortDecodeErrorZ {
17066 contents: CResult_TxAbortDecodeErrorZPtr {
17067 result: Box::into_raw(Box::new(o)),
17073 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
17074 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
17075 CResult_TxAbortDecodeErrorZ {
17076 contents: CResult_TxAbortDecodeErrorZPtr {
17077 err: Box::into_raw(Box::new(e)),
17082 /// Checks if the given object is currently in the success state
17084 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
17088 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
17089 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
17090 impl Drop for CResult_TxAbortDecodeErrorZ {
17091 fn drop(&mut self) {
17092 if self.result_ok {
17093 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17094 let _ = unsafe { Box::from_raw(self.contents.result) };
17097 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17098 let _ = unsafe { Box::from_raw(self.contents.err) };
17103 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
17104 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
17105 let contents = if o.result_ok {
17106 let result = unsafe { o.contents.result };
17107 unsafe { o.contents.result = core::ptr::null_mut() };
17108 CResult_TxAbortDecodeErrorZPtr { result }
17110 let err = unsafe { o.contents.err };
17111 unsafe { o.contents.err = core::ptr::null_mut(); }
17112 CResult_TxAbortDecodeErrorZPtr { err }
17116 result_ok: o.result_ok,
17120 impl Clone for CResult_TxAbortDecodeErrorZ {
17121 fn clone(&self) -> Self {
17122 if self.result_ok {
17123 Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
17124 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
17127 Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
17128 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17134 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
17135 /// but with all dynamically-allocated buffers duplicated in new buffers.
17136 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
17138 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
17139 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
17140 /// A pointer to the contents in the success state.
17141 /// Reading from this pointer when `result_ok` is not set is undefined.
17142 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
17143 /// A pointer to the contents in the error state.
17144 /// Reading from this pointer when `result_ok` is set is undefined.
17145 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17148 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
17149 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
17150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17151 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
17152 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
17153 /// `err` or `result` depending on the state of `result_ok`.
17154 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
17155 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
17156 pub result_ok: bool,
17159 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
17160 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17161 CResult_AnnouncementSignaturesDecodeErrorZ {
17162 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17163 result: Box::into_raw(Box::new(o)),
17169 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
17170 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17171 CResult_AnnouncementSignaturesDecodeErrorZ {
17172 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17173 err: Box::into_raw(Box::new(e)),
17178 /// Checks if the given object is currently in the success state
17180 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
17184 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
17185 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
17186 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
17187 fn drop(&mut self) {
17188 if self.result_ok {
17189 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17190 let _ = unsafe { Box::from_raw(self.contents.result) };
17193 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17194 let _ = unsafe { Box::from_raw(self.contents.err) };
17199 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
17200 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
17201 let contents = if o.result_ok {
17202 let result = unsafe { o.contents.result };
17203 unsafe { o.contents.result = core::ptr::null_mut() };
17204 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
17206 let err = unsafe { o.contents.err };
17207 unsafe { o.contents.err = core::ptr::null_mut(); }
17208 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
17212 result_ok: o.result_ok,
17216 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
17217 fn clone(&self) -> Self {
17218 if self.result_ok {
17219 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17220 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
17223 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17224 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17230 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
17231 /// but with all dynamically-allocated buffers duplicated in new buffers.
17232 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
17234 /// The contents of CResult_ChannelReestablishDecodeErrorZ
17235 pub union CResult_ChannelReestablishDecodeErrorZPtr {
17236 /// A pointer to the contents in the success state.
17237 /// Reading from this pointer when `result_ok` is not set is undefined.
17238 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
17239 /// A pointer to the contents in the error state.
17240 /// Reading from this pointer when `result_ok` is set is undefined.
17241 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17244 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
17245 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
17246 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17247 pub struct CResult_ChannelReestablishDecodeErrorZ {
17248 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
17249 /// `err` or `result` depending on the state of `result_ok`.
17250 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
17251 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
17252 pub result_ok: bool,
17255 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
17256 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
17257 CResult_ChannelReestablishDecodeErrorZ {
17258 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17259 result: Box::into_raw(Box::new(o)),
17265 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
17266 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
17267 CResult_ChannelReestablishDecodeErrorZ {
17268 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17269 err: Box::into_raw(Box::new(e)),
17274 /// Checks if the given object is currently in the success state
17276 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
17280 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
17281 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
17282 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
17283 fn drop(&mut self) {
17284 if self.result_ok {
17285 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17286 let _ = unsafe { Box::from_raw(self.contents.result) };
17289 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17290 let _ = unsafe { Box::from_raw(self.contents.err) };
17295 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
17296 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
17297 let contents = if o.result_ok {
17298 let result = unsafe { o.contents.result };
17299 unsafe { o.contents.result = core::ptr::null_mut() };
17300 CResult_ChannelReestablishDecodeErrorZPtr { result }
17302 let err = unsafe { o.contents.err };
17303 unsafe { o.contents.err = core::ptr::null_mut(); }
17304 CResult_ChannelReestablishDecodeErrorZPtr { err }
17308 result_ok: o.result_ok,
17312 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
17313 fn clone(&self) -> Self {
17314 if self.result_ok {
17315 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17316 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
17319 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17320 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17326 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
17327 /// but with all dynamically-allocated buffers duplicated in new buffers.
17328 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
17330 /// The contents of CResult_ClosingSignedDecodeErrorZ
17331 pub union CResult_ClosingSignedDecodeErrorZPtr {
17332 /// A pointer to the contents in the success state.
17333 /// Reading from this pointer when `result_ok` is not set is undefined.
17334 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
17335 /// A pointer to the contents in the error state.
17336 /// Reading from this pointer when `result_ok` is set is undefined.
17337 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17340 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
17341 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17342 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17343 pub struct CResult_ClosingSignedDecodeErrorZ {
17344 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
17345 /// `err` or `result` depending on the state of `result_ok`.
17346 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
17347 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
17348 pub result_ok: bool,
17351 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
17352 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
17353 CResult_ClosingSignedDecodeErrorZ {
17354 contents: CResult_ClosingSignedDecodeErrorZPtr {
17355 result: Box::into_raw(Box::new(o)),
17361 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
17362 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
17363 CResult_ClosingSignedDecodeErrorZ {
17364 contents: CResult_ClosingSignedDecodeErrorZPtr {
17365 err: Box::into_raw(Box::new(e)),
17370 /// Checks if the given object is currently in the success state
17372 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
17376 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
17377 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
17378 impl Drop for CResult_ClosingSignedDecodeErrorZ {
17379 fn drop(&mut self) {
17380 if self.result_ok {
17381 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17382 let _ = unsafe { Box::from_raw(self.contents.result) };
17385 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17386 let _ = unsafe { Box::from_raw(self.contents.err) };
17391 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
17392 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17393 let contents = if o.result_ok {
17394 let result = unsafe { o.contents.result };
17395 unsafe { o.contents.result = core::ptr::null_mut() };
17396 CResult_ClosingSignedDecodeErrorZPtr { result }
17398 let err = unsafe { o.contents.err };
17399 unsafe { o.contents.err = core::ptr::null_mut(); }
17400 CResult_ClosingSignedDecodeErrorZPtr { err }
17404 result_ok: o.result_ok,
17408 impl Clone for CResult_ClosingSignedDecodeErrorZ {
17409 fn clone(&self) -> Self {
17410 if self.result_ok {
17411 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
17412 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
17415 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
17416 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17422 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
17423 /// but with all dynamically-allocated buffers duplicated in new buffers.
17424 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
17426 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
17427 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17428 /// A pointer to the contents in the success state.
17429 /// Reading from this pointer when `result_ok` is not set is undefined.
17430 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
17431 /// A pointer to the contents in the error state.
17432 /// Reading from this pointer when `result_ok` is set is undefined.
17433 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17436 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
17437 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17438 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17439 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
17440 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
17441 /// `err` or `result` depending on the state of `result_ok`.
17442 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
17443 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
17444 pub result_ok: bool,
17447 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
17448 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17449 CResult_ClosingSignedFeeRangeDecodeErrorZ {
17450 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17451 result: Box::into_raw(Box::new(o)),
17457 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
17458 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17459 CResult_ClosingSignedFeeRangeDecodeErrorZ {
17460 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17461 err: Box::into_raw(Box::new(e)),
17466 /// Checks if the given object is currently in the success state
17468 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
17472 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
17473 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
17474 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17475 fn drop(&mut self) {
17476 if self.result_ok {
17477 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17478 let _ = unsafe { Box::from_raw(self.contents.result) };
17481 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17482 let _ = unsafe { Box::from_raw(self.contents.err) };
17487 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17488 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17489 let contents = if o.result_ok {
17490 let result = unsafe { o.contents.result };
17491 unsafe { o.contents.result = core::ptr::null_mut() };
17492 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
17494 let err = unsafe { o.contents.err };
17495 unsafe { o.contents.err = core::ptr::null_mut(); }
17496 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
17500 result_ok: o.result_ok,
17504 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17505 fn clone(&self) -> Self {
17506 if self.result_ok {
17507 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17508 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
17511 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17512 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17518 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
17519 /// but with all dynamically-allocated buffers duplicated in new buffers.
17520 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
17522 /// The contents of CResult_CommitmentSignedDecodeErrorZ
17523 pub union CResult_CommitmentSignedDecodeErrorZPtr {
17524 /// A pointer to the contents in the success state.
17525 /// Reading from this pointer when `result_ok` is not set is undefined.
17526 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
17527 /// A pointer to the contents in the error state.
17528 /// Reading from this pointer when `result_ok` is set is undefined.
17529 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17532 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
17533 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17534 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17535 pub struct CResult_CommitmentSignedDecodeErrorZ {
17536 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
17537 /// `err` or `result` depending on the state of `result_ok`.
17538 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
17539 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
17540 pub result_ok: bool,
17543 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
17544 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
17545 CResult_CommitmentSignedDecodeErrorZ {
17546 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17547 result: Box::into_raw(Box::new(o)),
17553 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
17554 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
17555 CResult_CommitmentSignedDecodeErrorZ {
17556 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17557 err: Box::into_raw(Box::new(e)),
17562 /// Checks if the given object is currently in the success state
17564 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
17568 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
17569 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
17570 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
17571 fn drop(&mut self) {
17572 if self.result_ok {
17573 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17574 let _ = unsafe { Box::from_raw(self.contents.result) };
17577 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17578 let _ = unsafe { Box::from_raw(self.contents.err) };
17583 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
17584 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17585 let contents = if o.result_ok {
17586 let result = unsafe { o.contents.result };
17587 unsafe { o.contents.result = core::ptr::null_mut() };
17588 CResult_CommitmentSignedDecodeErrorZPtr { result }
17590 let err = unsafe { o.contents.err };
17591 unsafe { o.contents.err = core::ptr::null_mut(); }
17592 CResult_CommitmentSignedDecodeErrorZPtr { err }
17596 result_ok: o.result_ok,
17600 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
17601 fn clone(&self) -> Self {
17602 if self.result_ok {
17603 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17604 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
17607 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17608 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17614 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
17615 /// but with all dynamically-allocated buffers duplicated in new buffers.
17616 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
17618 /// The contents of CResult_FundingCreatedDecodeErrorZ
17619 pub union CResult_FundingCreatedDecodeErrorZPtr {
17620 /// A pointer to the contents in the success state.
17621 /// Reading from this pointer when `result_ok` is not set is undefined.
17622 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
17623 /// A pointer to the contents in the error state.
17624 /// Reading from this pointer when `result_ok` is set is undefined.
17625 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17628 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
17629 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
17630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17631 pub struct CResult_FundingCreatedDecodeErrorZ {
17632 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
17633 /// `err` or `result` depending on the state of `result_ok`.
17634 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
17635 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
17636 pub result_ok: bool,
17639 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
17640 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
17641 CResult_FundingCreatedDecodeErrorZ {
17642 contents: CResult_FundingCreatedDecodeErrorZPtr {
17643 result: Box::into_raw(Box::new(o)),
17649 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
17650 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
17651 CResult_FundingCreatedDecodeErrorZ {
17652 contents: CResult_FundingCreatedDecodeErrorZPtr {
17653 err: Box::into_raw(Box::new(e)),
17658 /// Checks if the given object is currently in the success state
17660 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
17664 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
17665 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
17666 impl Drop for CResult_FundingCreatedDecodeErrorZ {
17667 fn drop(&mut self) {
17668 if self.result_ok {
17669 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17670 let _ = unsafe { Box::from_raw(self.contents.result) };
17673 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17674 let _ = unsafe { Box::from_raw(self.contents.err) };
17679 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
17680 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
17681 let contents = if o.result_ok {
17682 let result = unsafe { o.contents.result };
17683 unsafe { o.contents.result = core::ptr::null_mut() };
17684 CResult_FundingCreatedDecodeErrorZPtr { result }
17686 let err = unsafe { o.contents.err };
17687 unsafe { o.contents.err = core::ptr::null_mut(); }
17688 CResult_FundingCreatedDecodeErrorZPtr { err }
17692 result_ok: o.result_ok,
17696 impl Clone for CResult_FundingCreatedDecodeErrorZ {
17697 fn clone(&self) -> Self {
17698 if self.result_ok {
17699 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
17700 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
17703 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
17704 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17710 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
17711 /// but with all dynamically-allocated buffers duplicated in new buffers.
17712 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
17714 /// The contents of CResult_FundingSignedDecodeErrorZ
17715 pub union CResult_FundingSignedDecodeErrorZPtr {
17716 /// A pointer to the contents in the success state.
17717 /// Reading from this pointer when `result_ok` is not set is undefined.
17718 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
17719 /// A pointer to the contents in the error state.
17720 /// Reading from this pointer when `result_ok` is set is undefined.
17721 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17724 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
17725 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17727 pub struct CResult_FundingSignedDecodeErrorZ {
17728 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
17729 /// `err` or `result` depending on the state of `result_ok`.
17730 pub contents: CResult_FundingSignedDecodeErrorZPtr,
17731 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
17732 pub result_ok: bool,
17735 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
17736 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
17737 CResult_FundingSignedDecodeErrorZ {
17738 contents: CResult_FundingSignedDecodeErrorZPtr {
17739 result: Box::into_raw(Box::new(o)),
17745 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
17746 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
17747 CResult_FundingSignedDecodeErrorZ {
17748 contents: CResult_FundingSignedDecodeErrorZPtr {
17749 err: Box::into_raw(Box::new(e)),
17754 /// Checks if the given object is currently in the success state
17756 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
17760 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
17761 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
17762 impl Drop for CResult_FundingSignedDecodeErrorZ {
17763 fn drop(&mut self) {
17764 if self.result_ok {
17765 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17766 let _ = unsafe { Box::from_raw(self.contents.result) };
17769 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17770 let _ = unsafe { Box::from_raw(self.contents.err) };
17775 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
17776 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17777 let contents = if o.result_ok {
17778 let result = unsafe { o.contents.result };
17779 unsafe { o.contents.result = core::ptr::null_mut() };
17780 CResult_FundingSignedDecodeErrorZPtr { result }
17782 let err = unsafe { o.contents.err };
17783 unsafe { o.contents.err = core::ptr::null_mut(); }
17784 CResult_FundingSignedDecodeErrorZPtr { err }
17788 result_ok: o.result_ok,
17792 impl Clone for CResult_FundingSignedDecodeErrorZ {
17793 fn clone(&self) -> Self {
17794 if self.result_ok {
17795 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
17796 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
17799 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
17800 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17806 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
17807 /// but with all dynamically-allocated buffers duplicated in new buffers.
17808 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
17810 /// The contents of CResult_ChannelReadyDecodeErrorZ
17811 pub union CResult_ChannelReadyDecodeErrorZPtr {
17812 /// A pointer to the contents in the success state.
17813 /// Reading from this pointer when `result_ok` is not set is undefined.
17814 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
17815 /// A pointer to the contents in the error state.
17816 /// Reading from this pointer when `result_ok` is set is undefined.
17817 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17820 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
17821 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
17822 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17823 pub struct CResult_ChannelReadyDecodeErrorZ {
17824 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
17825 /// `err` or `result` depending on the state of `result_ok`.
17826 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
17827 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
17828 pub result_ok: bool,
17831 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
17832 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
17833 CResult_ChannelReadyDecodeErrorZ {
17834 contents: CResult_ChannelReadyDecodeErrorZPtr {
17835 result: Box::into_raw(Box::new(o)),
17841 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
17842 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
17843 CResult_ChannelReadyDecodeErrorZ {
17844 contents: CResult_ChannelReadyDecodeErrorZPtr {
17845 err: Box::into_raw(Box::new(e)),
17850 /// Checks if the given object is currently in the success state
17852 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
17856 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
17857 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
17858 impl Drop for CResult_ChannelReadyDecodeErrorZ {
17859 fn drop(&mut self) {
17860 if self.result_ok {
17861 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17862 let _ = unsafe { Box::from_raw(self.contents.result) };
17865 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17866 let _ = unsafe { Box::from_raw(self.contents.err) };
17871 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
17872 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
17873 let contents = if o.result_ok {
17874 let result = unsafe { o.contents.result };
17875 unsafe { o.contents.result = core::ptr::null_mut() };
17876 CResult_ChannelReadyDecodeErrorZPtr { result }
17878 let err = unsafe { o.contents.err };
17879 unsafe { o.contents.err = core::ptr::null_mut(); }
17880 CResult_ChannelReadyDecodeErrorZPtr { err }
17884 result_ok: o.result_ok,
17888 impl Clone for CResult_ChannelReadyDecodeErrorZ {
17889 fn clone(&self) -> Self {
17890 if self.result_ok {
17891 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
17892 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
17895 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
17896 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17902 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
17903 /// but with all dynamically-allocated buffers duplicated in new buffers.
17904 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
17906 /// The contents of CResult_InitDecodeErrorZ
17907 pub union CResult_InitDecodeErrorZPtr {
17908 /// A pointer to the contents in the success state.
17909 /// Reading from this pointer when `result_ok` is not set is undefined.
17910 pub result: *mut crate::lightning::ln::msgs::Init,
17911 /// A pointer to the contents in the error state.
17912 /// Reading from this pointer when `result_ok` is set is undefined.
17913 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17916 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
17917 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
17918 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17919 pub struct CResult_InitDecodeErrorZ {
17920 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
17921 /// `err` or `result` depending on the state of `result_ok`.
17922 pub contents: CResult_InitDecodeErrorZPtr,
17923 /// Whether this CResult_InitDecodeErrorZ represents a success state.
17924 pub result_ok: bool,
17927 /// Creates a new CResult_InitDecodeErrorZ in the success state.
17928 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
17929 CResult_InitDecodeErrorZ {
17930 contents: CResult_InitDecodeErrorZPtr {
17931 result: Box::into_raw(Box::new(o)),
17937 /// Creates a new CResult_InitDecodeErrorZ in the error state.
17938 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
17939 CResult_InitDecodeErrorZ {
17940 contents: CResult_InitDecodeErrorZPtr {
17941 err: Box::into_raw(Box::new(e)),
17946 /// Checks if the given object is currently in the success state
17948 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
17952 /// Frees any resources used by the CResult_InitDecodeErrorZ.
17953 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
17954 impl Drop for CResult_InitDecodeErrorZ {
17955 fn drop(&mut self) {
17956 if self.result_ok {
17957 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17958 let _ = unsafe { Box::from_raw(self.contents.result) };
17961 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17962 let _ = unsafe { Box::from_raw(self.contents.err) };
17967 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
17968 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
17969 let contents = if o.result_ok {
17970 let result = unsafe { o.contents.result };
17971 unsafe { o.contents.result = core::ptr::null_mut() };
17972 CResult_InitDecodeErrorZPtr { result }
17974 let err = unsafe { o.contents.err };
17975 unsafe { o.contents.err = core::ptr::null_mut(); }
17976 CResult_InitDecodeErrorZPtr { err }
17980 result_ok: o.result_ok,
17984 impl Clone for CResult_InitDecodeErrorZ {
17985 fn clone(&self) -> Self {
17986 if self.result_ok {
17987 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
17988 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
17991 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
17992 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17998 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
17999 /// but with all dynamically-allocated buffers duplicated in new buffers.
18000 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
18002 /// The contents of CResult_OpenChannelDecodeErrorZ
18003 pub union CResult_OpenChannelDecodeErrorZPtr {
18004 /// A pointer to the contents in the success state.
18005 /// Reading from this pointer when `result_ok` is not set is undefined.
18006 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
18007 /// A pointer to the contents in the error state.
18008 /// Reading from this pointer when `result_ok` is set is undefined.
18009 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18012 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
18013 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
18014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18015 pub struct CResult_OpenChannelDecodeErrorZ {
18016 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
18017 /// `err` or `result` depending on the state of `result_ok`.
18018 pub contents: CResult_OpenChannelDecodeErrorZPtr,
18019 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
18020 pub result_ok: bool,
18023 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
18024 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
18025 CResult_OpenChannelDecodeErrorZ {
18026 contents: CResult_OpenChannelDecodeErrorZPtr {
18027 result: Box::into_raw(Box::new(o)),
18033 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
18034 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
18035 CResult_OpenChannelDecodeErrorZ {
18036 contents: CResult_OpenChannelDecodeErrorZPtr {
18037 err: Box::into_raw(Box::new(e)),
18042 /// Checks if the given object is currently in the success state
18044 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
18048 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
18049 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
18050 impl Drop for CResult_OpenChannelDecodeErrorZ {
18051 fn drop(&mut self) {
18052 if self.result_ok {
18053 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18054 let _ = unsafe { Box::from_raw(self.contents.result) };
18057 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18058 let _ = unsafe { Box::from_raw(self.contents.err) };
18063 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
18064 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
18065 let contents = if o.result_ok {
18066 let result = unsafe { o.contents.result };
18067 unsafe { o.contents.result = core::ptr::null_mut() };
18068 CResult_OpenChannelDecodeErrorZPtr { result }
18070 let err = unsafe { o.contents.err };
18071 unsafe { o.contents.err = core::ptr::null_mut(); }
18072 CResult_OpenChannelDecodeErrorZPtr { err }
18076 result_ok: o.result_ok,
18080 impl Clone for CResult_OpenChannelDecodeErrorZ {
18081 fn clone(&self) -> Self {
18082 if self.result_ok {
18083 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
18084 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
18087 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
18088 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18094 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
18095 /// but with all dynamically-allocated buffers duplicated in new buffers.
18096 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
18098 /// The contents of CResult_OpenChannelV2DecodeErrorZ
18099 pub union CResult_OpenChannelV2DecodeErrorZPtr {
18100 /// A pointer to the contents in the success state.
18101 /// Reading from this pointer when `result_ok` is not set is undefined.
18102 pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
18103 /// A pointer to the contents in the error state.
18104 /// Reading from this pointer when `result_ok` is set is undefined.
18105 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18108 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
18109 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
18110 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18111 pub struct CResult_OpenChannelV2DecodeErrorZ {
18112 /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
18113 /// `err` or `result` depending on the state of `result_ok`.
18114 pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
18115 /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
18116 pub result_ok: bool,
18119 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
18120 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
18121 CResult_OpenChannelV2DecodeErrorZ {
18122 contents: CResult_OpenChannelV2DecodeErrorZPtr {
18123 result: Box::into_raw(Box::new(o)),
18129 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
18130 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
18131 CResult_OpenChannelV2DecodeErrorZ {
18132 contents: CResult_OpenChannelV2DecodeErrorZPtr {
18133 err: Box::into_raw(Box::new(e)),
18138 /// Checks if the given object is currently in the success state
18140 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
18144 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
18145 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
18146 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
18147 fn drop(&mut self) {
18148 if self.result_ok {
18149 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18150 let _ = unsafe { Box::from_raw(self.contents.result) };
18153 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18154 let _ = unsafe { Box::from_raw(self.contents.err) };
18159 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
18160 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
18161 let contents = if o.result_ok {
18162 let result = unsafe { o.contents.result };
18163 unsafe { o.contents.result = core::ptr::null_mut() };
18164 CResult_OpenChannelV2DecodeErrorZPtr { result }
18166 let err = unsafe { o.contents.err };
18167 unsafe { o.contents.err = core::ptr::null_mut(); }
18168 CResult_OpenChannelV2DecodeErrorZPtr { err }
18172 result_ok: o.result_ok,
18176 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
18177 fn clone(&self) -> Self {
18178 if self.result_ok {
18179 Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18180 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
18183 Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18184 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18190 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
18191 /// but with all dynamically-allocated buffers duplicated in new buffers.
18192 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
18194 /// The contents of CResult_RevokeAndACKDecodeErrorZ
18195 pub union CResult_RevokeAndACKDecodeErrorZPtr {
18196 /// A pointer to the contents in the success state.
18197 /// Reading from this pointer when `result_ok` is not set is undefined.
18198 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
18199 /// A pointer to the contents in the error state.
18200 /// Reading from this pointer when `result_ok` is set is undefined.
18201 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18204 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
18205 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
18206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18207 pub struct CResult_RevokeAndACKDecodeErrorZ {
18208 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
18209 /// `err` or `result` depending on the state of `result_ok`.
18210 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
18211 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
18212 pub result_ok: bool,
18215 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
18216 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
18217 CResult_RevokeAndACKDecodeErrorZ {
18218 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18219 result: Box::into_raw(Box::new(o)),
18225 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
18226 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
18227 CResult_RevokeAndACKDecodeErrorZ {
18228 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18229 err: Box::into_raw(Box::new(e)),
18234 /// Checks if the given object is currently in the success state
18236 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
18240 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
18241 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
18242 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
18243 fn drop(&mut self) {
18244 if self.result_ok {
18245 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18246 let _ = unsafe { Box::from_raw(self.contents.result) };
18249 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18250 let _ = unsafe { Box::from_raw(self.contents.err) };
18255 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
18256 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
18257 let contents = if o.result_ok {
18258 let result = unsafe { o.contents.result };
18259 unsafe { o.contents.result = core::ptr::null_mut() };
18260 CResult_RevokeAndACKDecodeErrorZPtr { result }
18262 let err = unsafe { o.contents.err };
18263 unsafe { o.contents.err = core::ptr::null_mut(); }
18264 CResult_RevokeAndACKDecodeErrorZPtr { err }
18268 result_ok: o.result_ok,
18272 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
18273 fn clone(&self) -> Self {
18274 if self.result_ok {
18275 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18276 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
18279 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18280 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18286 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
18287 /// but with all dynamically-allocated buffers duplicated in new buffers.
18288 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
18290 /// The contents of CResult_ShutdownDecodeErrorZ
18291 pub union CResult_ShutdownDecodeErrorZPtr {
18292 /// A pointer to the contents in the success state.
18293 /// Reading from this pointer when `result_ok` is not set is undefined.
18294 pub result: *mut crate::lightning::ln::msgs::Shutdown,
18295 /// A pointer to the contents in the error state.
18296 /// Reading from this pointer when `result_ok` is set is undefined.
18297 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18300 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
18301 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
18302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18303 pub struct CResult_ShutdownDecodeErrorZ {
18304 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
18305 /// `err` or `result` depending on the state of `result_ok`.
18306 pub contents: CResult_ShutdownDecodeErrorZPtr,
18307 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
18308 pub result_ok: bool,
18311 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
18312 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
18313 CResult_ShutdownDecodeErrorZ {
18314 contents: CResult_ShutdownDecodeErrorZPtr {
18315 result: Box::into_raw(Box::new(o)),
18321 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
18322 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
18323 CResult_ShutdownDecodeErrorZ {
18324 contents: CResult_ShutdownDecodeErrorZPtr {
18325 err: Box::into_raw(Box::new(e)),
18330 /// Checks if the given object is currently in the success state
18332 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
18336 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
18337 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
18338 impl Drop for CResult_ShutdownDecodeErrorZ {
18339 fn drop(&mut self) {
18340 if self.result_ok {
18341 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18342 let _ = unsafe { Box::from_raw(self.contents.result) };
18345 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18346 let _ = unsafe { Box::from_raw(self.contents.err) };
18351 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
18352 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
18353 let contents = if o.result_ok {
18354 let result = unsafe { o.contents.result };
18355 unsafe { o.contents.result = core::ptr::null_mut() };
18356 CResult_ShutdownDecodeErrorZPtr { result }
18358 let err = unsafe { o.contents.err };
18359 unsafe { o.contents.err = core::ptr::null_mut(); }
18360 CResult_ShutdownDecodeErrorZPtr { err }
18364 result_ok: o.result_ok,
18368 impl Clone for CResult_ShutdownDecodeErrorZ {
18369 fn clone(&self) -> Self {
18370 if self.result_ok {
18371 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
18372 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
18375 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
18376 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18382 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
18383 /// but with all dynamically-allocated buffers duplicated in new buffers.
18384 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
18386 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
18387 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
18388 /// A pointer to the contents in the success state.
18389 /// Reading from this pointer when `result_ok` is not set is undefined.
18390 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
18391 /// A pointer to the contents in the error state.
18392 /// Reading from this pointer when `result_ok` is set is undefined.
18393 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18396 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
18397 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18399 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
18400 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
18401 /// `err` or `result` depending on the state of `result_ok`.
18402 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
18403 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
18404 pub result_ok: bool,
18407 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
18408 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
18409 CResult_UpdateFailHTLCDecodeErrorZ {
18410 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18411 result: Box::into_raw(Box::new(o)),
18417 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
18418 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
18419 CResult_UpdateFailHTLCDecodeErrorZ {
18420 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18421 err: Box::into_raw(Box::new(e)),
18426 /// Checks if the given object is currently in the success state
18428 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
18432 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
18433 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
18434 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
18435 fn drop(&mut self) {
18436 if self.result_ok {
18437 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18438 let _ = unsafe { Box::from_raw(self.contents.result) };
18441 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18442 let _ = unsafe { Box::from_raw(self.contents.err) };
18447 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
18448 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18449 let contents = if o.result_ok {
18450 let result = unsafe { o.contents.result };
18451 unsafe { o.contents.result = core::ptr::null_mut() };
18452 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
18454 let err = unsafe { o.contents.err };
18455 unsafe { o.contents.err = core::ptr::null_mut(); }
18456 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
18460 result_ok: o.result_ok,
18464 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
18465 fn clone(&self) -> Self {
18466 if self.result_ok {
18467 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18468 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
18471 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18472 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18478 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
18479 /// but with all dynamically-allocated buffers duplicated in new buffers.
18480 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
18482 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
18483 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18484 /// A pointer to the contents in the success state.
18485 /// Reading from this pointer when `result_ok` is not set is undefined.
18486 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
18487 /// A pointer to the contents in the error state.
18488 /// Reading from this pointer when `result_ok` is set is undefined.
18489 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18492 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
18493 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18495 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18496 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
18497 /// `err` or `result` depending on the state of `result_ok`.
18498 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
18499 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
18500 pub result_ok: bool,
18503 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
18504 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18505 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18506 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18507 result: Box::into_raw(Box::new(o)),
18513 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
18514 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18515 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18516 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18517 err: Box::into_raw(Box::new(e)),
18522 /// Checks if the given object is currently in the success state
18524 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
18528 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
18529 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
18530 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18531 fn drop(&mut self) {
18532 if self.result_ok {
18533 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18534 let _ = unsafe { Box::from_raw(self.contents.result) };
18537 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18538 let _ = unsafe { Box::from_raw(self.contents.err) };
18543 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18544 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18545 let contents = if o.result_ok {
18546 let result = unsafe { o.contents.result };
18547 unsafe { o.contents.result = core::ptr::null_mut() };
18548 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
18550 let err = unsafe { o.contents.err };
18551 unsafe { o.contents.err = core::ptr::null_mut(); }
18552 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
18556 result_ok: o.result_ok,
18560 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18561 fn clone(&self) -> Self {
18562 if self.result_ok {
18563 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18564 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
18567 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18568 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18574 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
18575 /// but with all dynamically-allocated buffers duplicated in new buffers.
18576 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
18578 /// The contents of CResult_UpdateFeeDecodeErrorZ
18579 pub union CResult_UpdateFeeDecodeErrorZPtr {
18580 /// A pointer to the contents in the success state.
18581 /// Reading from this pointer when `result_ok` is not set is undefined.
18582 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
18583 /// A pointer to the contents in the error state.
18584 /// Reading from this pointer when `result_ok` is set is undefined.
18585 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18588 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
18589 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
18590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18591 pub struct CResult_UpdateFeeDecodeErrorZ {
18592 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
18593 /// `err` or `result` depending on the state of `result_ok`.
18594 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
18595 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
18596 pub result_ok: bool,
18599 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
18600 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
18601 CResult_UpdateFeeDecodeErrorZ {
18602 contents: CResult_UpdateFeeDecodeErrorZPtr {
18603 result: Box::into_raw(Box::new(o)),
18609 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
18610 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
18611 CResult_UpdateFeeDecodeErrorZ {
18612 contents: CResult_UpdateFeeDecodeErrorZPtr {
18613 err: Box::into_raw(Box::new(e)),
18618 /// Checks if the given object is currently in the success state
18620 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
18624 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
18625 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
18626 impl Drop for CResult_UpdateFeeDecodeErrorZ {
18627 fn drop(&mut self) {
18628 if self.result_ok {
18629 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18630 let _ = unsafe { Box::from_raw(self.contents.result) };
18633 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18634 let _ = unsafe { Box::from_raw(self.contents.err) };
18639 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
18640 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
18641 let contents = if o.result_ok {
18642 let result = unsafe { o.contents.result };
18643 unsafe { o.contents.result = core::ptr::null_mut() };
18644 CResult_UpdateFeeDecodeErrorZPtr { result }
18646 let err = unsafe { o.contents.err };
18647 unsafe { o.contents.err = core::ptr::null_mut(); }
18648 CResult_UpdateFeeDecodeErrorZPtr { err }
18652 result_ok: o.result_ok,
18656 impl Clone for CResult_UpdateFeeDecodeErrorZ {
18657 fn clone(&self) -> Self {
18658 if self.result_ok {
18659 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
18660 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
18663 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
18664 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18670 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
18671 /// but with all dynamically-allocated buffers duplicated in new buffers.
18672 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
18674 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
18675 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18676 /// A pointer to the contents in the success state.
18677 /// Reading from this pointer when `result_ok` is not set is undefined.
18678 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
18679 /// A pointer to the contents in the error state.
18680 /// Reading from this pointer when `result_ok` is set is undefined.
18681 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18684 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
18685 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18687 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
18688 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
18689 /// `err` or `result` depending on the state of `result_ok`.
18690 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
18691 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
18692 pub result_ok: bool,
18695 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
18696 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18697 CResult_UpdateFulfillHTLCDecodeErrorZ {
18698 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18699 result: Box::into_raw(Box::new(o)),
18705 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
18706 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18707 CResult_UpdateFulfillHTLCDecodeErrorZ {
18708 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18709 err: Box::into_raw(Box::new(e)),
18714 /// Checks if the given object is currently in the success state
18716 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
18720 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
18721 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
18722 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
18723 fn drop(&mut self) {
18724 if self.result_ok {
18725 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18726 let _ = unsafe { Box::from_raw(self.contents.result) };
18729 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18730 let _ = unsafe { Box::from_raw(self.contents.err) };
18735 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
18736 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18737 let contents = if o.result_ok {
18738 let result = unsafe { o.contents.result };
18739 unsafe { o.contents.result = core::ptr::null_mut() };
18740 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
18742 let err = unsafe { o.contents.err };
18743 unsafe { o.contents.err = core::ptr::null_mut(); }
18744 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
18748 result_ok: o.result_ok,
18752 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
18753 fn clone(&self) -> Self {
18754 if self.result_ok {
18755 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18756 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
18759 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18760 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18766 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
18767 /// but with all dynamically-allocated buffers duplicated in new buffers.
18768 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
18770 /// The contents of CResult_OnionPacketDecodeErrorZ
18771 pub union CResult_OnionPacketDecodeErrorZPtr {
18772 /// A pointer to the contents in the success state.
18773 /// Reading from this pointer when `result_ok` is not set is undefined.
18774 pub result: *mut crate::lightning::ln::msgs::OnionPacket,
18775 /// A pointer to the contents in the error state.
18776 /// Reading from this pointer when `result_ok` is set is undefined.
18777 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18780 /// A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation,
18781 /// containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure.
18782 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18783 pub struct CResult_OnionPacketDecodeErrorZ {
18784 /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either
18785 /// `err` or `result` depending on the state of `result_ok`.
18786 pub contents: CResult_OnionPacketDecodeErrorZPtr,
18787 /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state.
18788 pub result_ok: bool,
18791 /// Creates a new CResult_OnionPacketDecodeErrorZ in the success state.
18792 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ {
18793 CResult_OnionPacketDecodeErrorZ {
18794 contents: CResult_OnionPacketDecodeErrorZPtr {
18795 result: Box::into_raw(Box::new(o)),
18801 /// Creates a new CResult_OnionPacketDecodeErrorZ in the error state.
18802 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ {
18803 CResult_OnionPacketDecodeErrorZ {
18804 contents: CResult_OnionPacketDecodeErrorZPtr {
18805 err: Box::into_raw(Box::new(e)),
18810 /// Checks if the given object is currently in the success state
18812 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool {
18816 /// Frees any resources used by the CResult_OnionPacketDecodeErrorZ.
18817 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { }
18818 impl Drop for CResult_OnionPacketDecodeErrorZ {
18819 fn drop(&mut self) {
18820 if self.result_ok {
18821 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18822 let _ = unsafe { Box::from_raw(self.contents.result) };
18825 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18826 let _ = unsafe { Box::from_raw(self.contents.err) };
18831 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionPacketDecodeErrorZ {
18832 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>) -> Self {
18833 let contents = if o.result_ok {
18834 let result = unsafe { o.contents.result };
18835 unsafe { o.contents.result = core::ptr::null_mut() };
18836 CResult_OnionPacketDecodeErrorZPtr { result }
18838 let err = unsafe { o.contents.err };
18839 unsafe { o.contents.err = core::ptr::null_mut(); }
18840 CResult_OnionPacketDecodeErrorZPtr { err }
18844 result_ok: o.result_ok,
18848 impl Clone for CResult_OnionPacketDecodeErrorZ {
18849 fn clone(&self) -> Self {
18850 if self.result_ok {
18851 Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr {
18852 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionPacket>::clone(unsafe { &*self.contents.result })))
18855 Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr {
18856 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18862 /// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig`
18863 /// but with all dynamically-allocated buffers duplicated in new buffers.
18864 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) }
18866 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
18867 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
18868 /// A pointer to the contents in the success state.
18869 /// Reading from this pointer when `result_ok` is not set is undefined.
18870 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
18871 /// A pointer to the contents in the error state.
18872 /// Reading from this pointer when `result_ok` is set is undefined.
18873 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18876 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
18877 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18879 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
18880 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
18881 /// `err` or `result` depending on the state of `result_ok`.
18882 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
18883 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
18884 pub result_ok: bool,
18887 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
18888 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
18889 CResult_UpdateAddHTLCDecodeErrorZ {
18890 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18891 result: Box::into_raw(Box::new(o)),
18897 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
18898 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
18899 CResult_UpdateAddHTLCDecodeErrorZ {
18900 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18901 err: Box::into_raw(Box::new(e)),
18906 /// Checks if the given object is currently in the success state
18908 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
18912 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
18913 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
18914 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
18915 fn drop(&mut self) {
18916 if self.result_ok {
18917 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18918 let _ = unsafe { Box::from_raw(self.contents.result) };
18921 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18922 let _ = unsafe { Box::from_raw(self.contents.err) };
18927 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
18928 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18929 let contents = if o.result_ok {
18930 let result = unsafe { o.contents.result };
18931 unsafe { o.contents.result = core::ptr::null_mut() };
18932 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
18934 let err = unsafe { o.contents.err };
18935 unsafe { o.contents.err = core::ptr::null_mut(); }
18936 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
18940 result_ok: o.result_ok,
18944 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
18945 fn clone(&self) -> Self {
18946 if self.result_ok {
18947 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18948 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
18951 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18952 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18958 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
18959 /// but with all dynamically-allocated buffers duplicated in new buffers.
18960 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
18962 /// The contents of CResult_OnionMessageDecodeErrorZ
18963 pub union CResult_OnionMessageDecodeErrorZPtr {
18964 /// A pointer to the contents in the success state.
18965 /// Reading from this pointer when `result_ok` is not set is undefined.
18966 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
18967 /// A pointer to the contents in the error state.
18968 /// Reading from this pointer when `result_ok` is set is undefined.
18969 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18972 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
18973 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
18974 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18975 pub struct CResult_OnionMessageDecodeErrorZ {
18976 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
18977 /// `err` or `result` depending on the state of `result_ok`.
18978 pub contents: CResult_OnionMessageDecodeErrorZPtr,
18979 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
18980 pub result_ok: bool,
18983 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
18984 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
18985 CResult_OnionMessageDecodeErrorZ {
18986 contents: CResult_OnionMessageDecodeErrorZPtr {
18987 result: Box::into_raw(Box::new(o)),
18993 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
18994 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
18995 CResult_OnionMessageDecodeErrorZ {
18996 contents: CResult_OnionMessageDecodeErrorZPtr {
18997 err: Box::into_raw(Box::new(e)),
19002 /// Checks if the given object is currently in the success state
19004 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
19008 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
19009 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
19010 impl Drop for CResult_OnionMessageDecodeErrorZ {
19011 fn drop(&mut self) {
19012 if self.result_ok {
19013 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19014 let _ = unsafe { Box::from_raw(self.contents.result) };
19017 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19018 let _ = unsafe { Box::from_raw(self.contents.err) };
19023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
19024 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19025 let contents = if o.result_ok {
19026 let result = unsafe { o.contents.result };
19027 unsafe { o.contents.result = core::ptr::null_mut() };
19028 CResult_OnionMessageDecodeErrorZPtr { result }
19030 let err = unsafe { o.contents.err };
19031 unsafe { o.contents.err = core::ptr::null_mut(); }
19032 CResult_OnionMessageDecodeErrorZPtr { err }
19036 result_ok: o.result_ok,
19040 impl Clone for CResult_OnionMessageDecodeErrorZ {
19041 fn clone(&self) -> Self {
19042 if self.result_ok {
19043 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
19044 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
19047 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
19048 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19054 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
19055 /// but with all dynamically-allocated buffers duplicated in new buffers.
19056 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
19058 /// The contents of CResult_FinalOnionHopDataDecodeErrorZ
19059 pub union CResult_FinalOnionHopDataDecodeErrorZPtr {
19060 /// A pointer to the contents in the success state.
19061 /// Reading from this pointer when `result_ok` is not set is undefined.
19062 pub result: *mut crate::lightning::ln::msgs::FinalOnionHopData,
19063 /// A pointer to the contents in the error state.
19064 /// Reading from this pointer when `result_ok` is set is undefined.
19065 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19068 /// A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation,
19069 /// containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure.
19070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19071 pub struct CResult_FinalOnionHopDataDecodeErrorZ {
19072 /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either
19073 /// `err` or `result` depending on the state of `result_ok`.
19074 pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr,
19075 /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state.
19076 pub result_ok: bool,
19079 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state.
19080 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ {
19081 CResult_FinalOnionHopDataDecodeErrorZ {
19082 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19083 result: Box::into_raw(Box::new(o)),
19089 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state.
19090 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ {
19091 CResult_FinalOnionHopDataDecodeErrorZ {
19092 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19093 err: Box::into_raw(Box::new(e)),
19098 /// Checks if the given object is currently in the success state
19100 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool {
19104 /// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ.
19105 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { }
19106 impl Drop for CResult_FinalOnionHopDataDecodeErrorZ {
19107 fn drop(&mut self) {
19108 if self.result_ok {
19109 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19110 let _ = unsafe { Box::from_raw(self.contents.result) };
19113 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19114 let _ = unsafe { Box::from_raw(self.contents.err) };
19119 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>> for CResult_FinalOnionHopDataDecodeErrorZ {
19120 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>) -> Self {
19121 let contents = if o.result_ok {
19122 let result = unsafe { o.contents.result };
19123 unsafe { o.contents.result = core::ptr::null_mut() };
19124 CResult_FinalOnionHopDataDecodeErrorZPtr { result }
19126 let err = unsafe { o.contents.err };
19127 unsafe { o.contents.err = core::ptr::null_mut(); }
19128 CResult_FinalOnionHopDataDecodeErrorZPtr { err }
19132 result_ok: o.result_ok,
19136 impl Clone for CResult_FinalOnionHopDataDecodeErrorZ {
19137 fn clone(&self) -> Self {
19138 if self.result_ok {
19139 Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19140 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FinalOnionHopData>::clone(unsafe { &*self.contents.result })))
19143 Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19144 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19150 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig`
19151 /// but with all dynamically-allocated buffers duplicated in new buffers.
19152 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) }
19154 /// The contents of CResult_PingDecodeErrorZ
19155 pub union CResult_PingDecodeErrorZPtr {
19156 /// A pointer to the contents in the success state.
19157 /// Reading from this pointer when `result_ok` is not set is undefined.
19158 pub result: *mut crate::lightning::ln::msgs::Ping,
19159 /// A pointer to the contents in the error state.
19160 /// Reading from this pointer when `result_ok` is set is undefined.
19161 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19164 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
19165 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
19166 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19167 pub struct CResult_PingDecodeErrorZ {
19168 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
19169 /// `err` or `result` depending on the state of `result_ok`.
19170 pub contents: CResult_PingDecodeErrorZPtr,
19171 /// Whether this CResult_PingDecodeErrorZ represents a success state.
19172 pub result_ok: bool,
19175 /// Creates a new CResult_PingDecodeErrorZ in the success state.
19176 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
19177 CResult_PingDecodeErrorZ {
19178 contents: CResult_PingDecodeErrorZPtr {
19179 result: Box::into_raw(Box::new(o)),
19185 /// Creates a new CResult_PingDecodeErrorZ in the error state.
19186 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
19187 CResult_PingDecodeErrorZ {
19188 contents: CResult_PingDecodeErrorZPtr {
19189 err: Box::into_raw(Box::new(e)),
19194 /// Checks if the given object is currently in the success state
19196 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
19200 /// Frees any resources used by the CResult_PingDecodeErrorZ.
19201 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
19202 impl Drop for CResult_PingDecodeErrorZ {
19203 fn drop(&mut self) {
19204 if self.result_ok {
19205 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19206 let _ = unsafe { Box::from_raw(self.contents.result) };
19209 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19210 let _ = unsafe { Box::from_raw(self.contents.err) };
19215 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
19216 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
19217 let contents = if o.result_ok {
19218 let result = unsafe { o.contents.result };
19219 unsafe { o.contents.result = core::ptr::null_mut() };
19220 CResult_PingDecodeErrorZPtr { result }
19222 let err = unsafe { o.contents.err };
19223 unsafe { o.contents.err = core::ptr::null_mut(); }
19224 CResult_PingDecodeErrorZPtr { err }
19228 result_ok: o.result_ok,
19232 impl Clone for CResult_PingDecodeErrorZ {
19233 fn clone(&self) -> Self {
19234 if self.result_ok {
19235 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
19236 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
19239 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
19240 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19246 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
19247 /// but with all dynamically-allocated buffers duplicated in new buffers.
19248 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
19250 /// The contents of CResult_PongDecodeErrorZ
19251 pub union CResult_PongDecodeErrorZPtr {
19252 /// A pointer to the contents in the success state.
19253 /// Reading from this pointer when `result_ok` is not set is undefined.
19254 pub result: *mut crate::lightning::ln::msgs::Pong,
19255 /// A pointer to the contents in the error state.
19256 /// Reading from this pointer when `result_ok` is set is undefined.
19257 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19260 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
19261 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
19262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19263 pub struct CResult_PongDecodeErrorZ {
19264 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
19265 /// `err` or `result` depending on the state of `result_ok`.
19266 pub contents: CResult_PongDecodeErrorZPtr,
19267 /// Whether this CResult_PongDecodeErrorZ represents a success state.
19268 pub result_ok: bool,
19271 /// Creates a new CResult_PongDecodeErrorZ in the success state.
19272 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
19273 CResult_PongDecodeErrorZ {
19274 contents: CResult_PongDecodeErrorZPtr {
19275 result: Box::into_raw(Box::new(o)),
19281 /// Creates a new CResult_PongDecodeErrorZ in the error state.
19282 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
19283 CResult_PongDecodeErrorZ {
19284 contents: CResult_PongDecodeErrorZPtr {
19285 err: Box::into_raw(Box::new(e)),
19290 /// Checks if the given object is currently in the success state
19292 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
19296 /// Frees any resources used by the CResult_PongDecodeErrorZ.
19297 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
19298 impl Drop for CResult_PongDecodeErrorZ {
19299 fn drop(&mut self) {
19300 if self.result_ok {
19301 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19302 let _ = unsafe { Box::from_raw(self.contents.result) };
19305 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19306 let _ = unsafe { Box::from_raw(self.contents.err) };
19311 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
19312 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
19313 let contents = if o.result_ok {
19314 let result = unsafe { o.contents.result };
19315 unsafe { o.contents.result = core::ptr::null_mut() };
19316 CResult_PongDecodeErrorZPtr { result }
19318 let err = unsafe { o.contents.err };
19319 unsafe { o.contents.err = core::ptr::null_mut(); }
19320 CResult_PongDecodeErrorZPtr { err }
19324 result_ok: o.result_ok,
19328 impl Clone for CResult_PongDecodeErrorZ {
19329 fn clone(&self) -> Self {
19330 if self.result_ok {
19331 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
19332 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
19335 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
19336 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19342 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
19343 /// but with all dynamically-allocated buffers duplicated in new buffers.
19344 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
19346 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
19347 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19348 /// A pointer to the contents in the success state.
19349 /// Reading from this pointer when `result_ok` is not set is undefined.
19350 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
19351 /// A pointer to the contents in the error state.
19352 /// Reading from this pointer when `result_ok` is set is undefined.
19353 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19356 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19357 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19359 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19360 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
19361 /// `err` or `result` depending on the state of `result_ok`.
19362 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
19363 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
19364 pub result_ok: bool,
19367 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
19368 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19369 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19370 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19371 result: Box::into_raw(Box::new(o)),
19377 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
19378 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19379 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19380 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19381 err: Box::into_raw(Box::new(e)),
19386 /// Checks if the given object is currently in the success state
19388 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
19392 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
19393 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
19394 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19395 fn drop(&mut self) {
19396 if self.result_ok {
19397 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19398 let _ = unsafe { Box::from_raw(self.contents.result) };
19401 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19402 let _ = unsafe { Box::from_raw(self.contents.err) };
19407 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19408 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19409 let contents = if o.result_ok {
19410 let result = unsafe { o.contents.result };
19411 unsafe { o.contents.result = core::ptr::null_mut() };
19412 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
19414 let err = unsafe { o.contents.err };
19415 unsafe { o.contents.err = core::ptr::null_mut(); }
19416 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
19420 result_ok: o.result_ok,
19424 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19425 fn clone(&self) -> Self {
19426 if self.result_ok {
19427 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19428 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19431 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19432 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19438 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19439 /// but with all dynamically-allocated buffers duplicated in new buffers.
19440 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19442 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
19443 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
19444 /// A pointer to the contents in the success state.
19445 /// Reading from this pointer when `result_ok` is not set is undefined.
19446 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
19447 /// A pointer to the contents in the error state.
19448 /// Reading from this pointer when `result_ok` is set is undefined.
19449 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19452 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19453 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19454 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19455 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
19456 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
19457 /// `err` or `result` depending on the state of `result_ok`.
19458 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
19459 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
19460 pub result_ok: bool,
19463 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
19464 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
19465 CResult_ChannelAnnouncementDecodeErrorZ {
19466 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19467 result: Box::into_raw(Box::new(o)),
19473 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
19474 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
19475 CResult_ChannelAnnouncementDecodeErrorZ {
19476 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19477 err: Box::into_raw(Box::new(e)),
19482 /// Checks if the given object is currently in the success state
19484 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
19488 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
19489 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
19490 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
19491 fn drop(&mut self) {
19492 if self.result_ok {
19493 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19494 let _ = unsafe { Box::from_raw(self.contents.result) };
19497 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19498 let _ = unsafe { Box::from_raw(self.contents.err) };
19503 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
19504 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19505 let contents = if o.result_ok {
19506 let result = unsafe { o.contents.result };
19507 unsafe { o.contents.result = core::ptr::null_mut() };
19508 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
19510 let err = unsafe { o.contents.err };
19511 unsafe { o.contents.err = core::ptr::null_mut(); }
19512 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
19516 result_ok: o.result_ok,
19520 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
19521 fn clone(&self) -> Self {
19522 if self.result_ok {
19523 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19524 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19527 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19528 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19534 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19535 /// but with all dynamically-allocated buffers duplicated in new buffers.
19536 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19538 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
19539 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19540 /// A pointer to the contents in the success state.
19541 /// Reading from this pointer when `result_ok` is not set is undefined.
19542 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
19543 /// A pointer to the contents in the error state.
19544 /// Reading from this pointer when `result_ok` is set is undefined.
19545 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19548 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19549 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19551 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
19552 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
19553 /// `err` or `result` depending on the state of `result_ok`.
19554 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
19555 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
19556 pub result_ok: bool,
19559 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
19560 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19561 CResult_UnsignedChannelUpdateDecodeErrorZ {
19562 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19563 result: Box::into_raw(Box::new(o)),
19569 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
19570 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19571 CResult_UnsignedChannelUpdateDecodeErrorZ {
19572 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19573 err: Box::into_raw(Box::new(e)),
19578 /// Checks if the given object is currently in the success state
19580 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
19584 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
19585 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
19586 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
19587 fn drop(&mut self) {
19588 if self.result_ok {
19589 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19590 let _ = unsafe { Box::from_raw(self.contents.result) };
19593 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19594 let _ = unsafe { Box::from_raw(self.contents.err) };
19599 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
19600 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19601 let contents = if o.result_ok {
19602 let result = unsafe { o.contents.result };
19603 unsafe { o.contents.result = core::ptr::null_mut() };
19604 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
19606 let err = unsafe { o.contents.err };
19607 unsafe { o.contents.err = core::ptr::null_mut(); }
19608 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
19612 result_ok: o.result_ok,
19616 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
19617 fn clone(&self) -> Self {
19618 if self.result_ok {
19619 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19620 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
19623 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19624 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19630 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
19631 /// but with all dynamically-allocated buffers duplicated in new buffers.
19632 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19634 /// The contents of CResult_ChannelUpdateDecodeErrorZ
19635 pub union CResult_ChannelUpdateDecodeErrorZPtr {
19636 /// A pointer to the contents in the success state.
19637 /// Reading from this pointer when `result_ok` is not set is undefined.
19638 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
19639 /// A pointer to the contents in the error state.
19640 /// Reading from this pointer when `result_ok` is set is undefined.
19641 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19644 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19645 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19646 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19647 pub struct CResult_ChannelUpdateDecodeErrorZ {
19648 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
19649 /// `err` or `result` depending on the state of `result_ok`.
19650 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
19651 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
19652 pub result_ok: bool,
19655 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
19656 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
19657 CResult_ChannelUpdateDecodeErrorZ {
19658 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19659 result: Box::into_raw(Box::new(o)),
19665 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
19666 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
19667 CResult_ChannelUpdateDecodeErrorZ {
19668 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19669 err: Box::into_raw(Box::new(e)),
19674 /// Checks if the given object is currently in the success state
19676 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
19680 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
19681 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
19682 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
19683 fn drop(&mut self) {
19684 if self.result_ok {
19685 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19686 let _ = unsafe { Box::from_raw(self.contents.result) };
19689 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19690 let _ = unsafe { Box::from_raw(self.contents.err) };
19695 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
19696 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19697 let contents = if o.result_ok {
19698 let result = unsafe { o.contents.result };
19699 unsafe { o.contents.result = core::ptr::null_mut() };
19700 CResult_ChannelUpdateDecodeErrorZPtr { result }
19702 let err = unsafe { o.contents.err };
19703 unsafe { o.contents.err = core::ptr::null_mut(); }
19704 CResult_ChannelUpdateDecodeErrorZPtr { err }
19708 result_ok: o.result_ok,
19712 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
19713 fn clone(&self) -> Self {
19714 if self.result_ok {
19715 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19716 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
19719 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19720 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19726 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
19727 /// but with all dynamically-allocated buffers duplicated in new buffers.
19728 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19730 /// The contents of CResult_ErrorMessageDecodeErrorZ
19731 pub union CResult_ErrorMessageDecodeErrorZPtr {
19732 /// A pointer to the contents in the success state.
19733 /// Reading from this pointer when `result_ok` is not set is undefined.
19734 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
19735 /// A pointer to the contents in the error state.
19736 /// Reading from this pointer when `result_ok` is set is undefined.
19737 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19740 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
19741 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19743 pub struct CResult_ErrorMessageDecodeErrorZ {
19744 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
19745 /// `err` or `result` depending on the state of `result_ok`.
19746 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
19747 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
19748 pub result_ok: bool,
19751 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
19752 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
19753 CResult_ErrorMessageDecodeErrorZ {
19754 contents: CResult_ErrorMessageDecodeErrorZPtr {
19755 result: Box::into_raw(Box::new(o)),
19761 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
19762 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
19763 CResult_ErrorMessageDecodeErrorZ {
19764 contents: CResult_ErrorMessageDecodeErrorZPtr {
19765 err: Box::into_raw(Box::new(e)),
19770 /// Checks if the given object is currently in the success state
19772 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
19776 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
19777 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
19778 impl Drop for CResult_ErrorMessageDecodeErrorZ {
19779 fn drop(&mut self) {
19780 if self.result_ok {
19781 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19782 let _ = unsafe { Box::from_raw(self.contents.result) };
19785 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19786 let _ = unsafe { Box::from_raw(self.contents.err) };
19791 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
19792 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19793 let contents = if o.result_ok {
19794 let result = unsafe { o.contents.result };
19795 unsafe { o.contents.result = core::ptr::null_mut() };
19796 CResult_ErrorMessageDecodeErrorZPtr { result }
19798 let err = unsafe { o.contents.err };
19799 unsafe { o.contents.err = core::ptr::null_mut(); }
19800 CResult_ErrorMessageDecodeErrorZPtr { err }
19804 result_ok: o.result_ok,
19808 impl Clone for CResult_ErrorMessageDecodeErrorZ {
19809 fn clone(&self) -> Self {
19810 if self.result_ok {
19811 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
19812 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
19815 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
19816 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19822 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
19823 /// but with all dynamically-allocated buffers duplicated in new buffers.
19824 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
19826 /// The contents of CResult_WarningMessageDecodeErrorZ
19827 pub union CResult_WarningMessageDecodeErrorZPtr {
19828 /// A pointer to the contents in the success state.
19829 /// Reading from this pointer when `result_ok` is not set is undefined.
19830 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
19831 /// A pointer to the contents in the error state.
19832 /// Reading from this pointer when `result_ok` is set is undefined.
19833 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19836 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
19837 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19839 pub struct CResult_WarningMessageDecodeErrorZ {
19840 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
19841 /// `err` or `result` depending on the state of `result_ok`.
19842 pub contents: CResult_WarningMessageDecodeErrorZPtr,
19843 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
19844 pub result_ok: bool,
19847 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
19848 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
19849 CResult_WarningMessageDecodeErrorZ {
19850 contents: CResult_WarningMessageDecodeErrorZPtr {
19851 result: Box::into_raw(Box::new(o)),
19857 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
19858 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
19859 CResult_WarningMessageDecodeErrorZ {
19860 contents: CResult_WarningMessageDecodeErrorZPtr {
19861 err: Box::into_raw(Box::new(e)),
19866 /// Checks if the given object is currently in the success state
19868 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
19872 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
19873 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
19874 impl Drop for CResult_WarningMessageDecodeErrorZ {
19875 fn drop(&mut self) {
19876 if self.result_ok {
19877 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19878 let _ = unsafe { Box::from_raw(self.contents.result) };
19881 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19882 let _ = unsafe { Box::from_raw(self.contents.err) };
19887 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
19888 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19889 let contents = if o.result_ok {
19890 let result = unsafe { o.contents.result };
19891 unsafe { o.contents.result = core::ptr::null_mut() };
19892 CResult_WarningMessageDecodeErrorZPtr { result }
19894 let err = unsafe { o.contents.err };
19895 unsafe { o.contents.err = core::ptr::null_mut(); }
19896 CResult_WarningMessageDecodeErrorZPtr { err }
19900 result_ok: o.result_ok,
19904 impl Clone for CResult_WarningMessageDecodeErrorZ {
19905 fn clone(&self) -> Self {
19906 if self.result_ok {
19907 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
19908 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
19911 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
19912 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19918 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
19919 /// but with all dynamically-allocated buffers duplicated in new buffers.
19920 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
19922 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
19923 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19924 /// A pointer to the contents in the success state.
19925 /// Reading from this pointer when `result_ok` is not set is undefined.
19926 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
19927 /// A pointer to the contents in the error state.
19928 /// Reading from this pointer when `result_ok` is set is undefined.
19929 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19932 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
19933 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19934 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19935 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19936 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
19937 /// `err` or `result` depending on the state of `result_ok`.
19938 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
19939 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
19940 pub result_ok: bool,
19943 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
19944 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19945 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19946 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19947 result: Box::into_raw(Box::new(o)),
19953 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
19954 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19955 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19956 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19957 err: Box::into_raw(Box::new(e)),
19962 /// Checks if the given object is currently in the success state
19964 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
19968 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
19969 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
19970 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19971 fn drop(&mut self) {
19972 if self.result_ok {
19973 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19974 let _ = unsafe { Box::from_raw(self.contents.result) };
19977 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19978 let _ = unsafe { Box::from_raw(self.contents.err) };
19983 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19984 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19985 let contents = if o.result_ok {
19986 let result = unsafe { o.contents.result };
19987 unsafe { o.contents.result = core::ptr::null_mut() };
19988 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
19990 let err = unsafe { o.contents.err };
19991 unsafe { o.contents.err = core::ptr::null_mut(); }
19992 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
19996 result_ok: o.result_ok,
20000 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20001 fn clone(&self) -> Self {
20002 if self.result_ok {
20003 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20004 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
20007 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20008 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20014 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
20015 /// but with all dynamically-allocated buffers duplicated in new buffers.
20016 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
20018 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
20019 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
20020 /// A pointer to the contents in the success state.
20021 /// Reading from this pointer when `result_ok` is not set is undefined.
20022 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
20023 /// A pointer to the contents in the error state.
20024 /// Reading from this pointer when `result_ok` is set is undefined.
20025 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20028 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
20029 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
20030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20031 pub struct CResult_NodeAnnouncementDecodeErrorZ {
20032 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
20033 /// `err` or `result` depending on the state of `result_ok`.
20034 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
20035 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
20036 pub result_ok: bool,
20039 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
20040 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
20041 CResult_NodeAnnouncementDecodeErrorZ {
20042 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20043 result: Box::into_raw(Box::new(o)),
20049 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
20050 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
20051 CResult_NodeAnnouncementDecodeErrorZ {
20052 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20053 err: Box::into_raw(Box::new(e)),
20058 /// Checks if the given object is currently in the success state
20060 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
20064 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
20065 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
20066 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
20067 fn drop(&mut self) {
20068 if self.result_ok {
20069 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20070 let _ = unsafe { Box::from_raw(self.contents.result) };
20073 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20074 let _ = unsafe { Box::from_raw(self.contents.err) };
20079 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
20080 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
20081 let contents = if o.result_ok {
20082 let result = unsafe { o.contents.result };
20083 unsafe { o.contents.result = core::ptr::null_mut() };
20084 CResult_NodeAnnouncementDecodeErrorZPtr { result }
20086 let err = unsafe { o.contents.err };
20087 unsafe { o.contents.err = core::ptr::null_mut(); }
20088 CResult_NodeAnnouncementDecodeErrorZPtr { err }
20092 result_ok: o.result_ok,
20096 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
20097 fn clone(&self) -> Self {
20098 if self.result_ok {
20099 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20100 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
20103 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20104 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20110 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
20111 /// but with all dynamically-allocated buffers duplicated in new buffers.
20112 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
20114 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
20115 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
20116 /// A pointer to the contents in the success state.
20117 /// Reading from this pointer when `result_ok` is not set is undefined.
20118 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
20119 /// A pointer to the contents in the error state.
20120 /// Reading from this pointer when `result_ok` is set is undefined.
20121 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20124 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
20125 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
20126 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20127 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
20128 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
20129 /// `err` or `result` depending on the state of `result_ok`.
20130 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
20131 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
20132 pub result_ok: bool,
20135 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
20136 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
20137 CResult_QueryShortChannelIdsDecodeErrorZ {
20138 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20139 result: Box::into_raw(Box::new(o)),
20145 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
20146 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
20147 CResult_QueryShortChannelIdsDecodeErrorZ {
20148 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20149 err: Box::into_raw(Box::new(e)),
20154 /// Checks if the given object is currently in the success state
20156 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
20160 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
20161 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
20162 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
20163 fn drop(&mut self) {
20164 if self.result_ok {
20165 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20166 let _ = unsafe { Box::from_raw(self.contents.result) };
20169 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20170 let _ = unsafe { Box::from_raw(self.contents.err) };
20175 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
20176 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
20177 let contents = if o.result_ok {
20178 let result = unsafe { o.contents.result };
20179 unsafe { o.contents.result = core::ptr::null_mut() };
20180 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
20182 let err = unsafe { o.contents.err };
20183 unsafe { o.contents.err = core::ptr::null_mut(); }
20184 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
20188 result_ok: o.result_ok,
20192 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
20193 fn clone(&self) -> Self {
20194 if self.result_ok {
20195 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20196 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
20199 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20200 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20206 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
20207 /// but with all dynamically-allocated buffers duplicated in new buffers.
20208 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
20210 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
20211 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20212 /// A pointer to the contents in the success state.
20213 /// Reading from this pointer when `result_ok` is not set is undefined.
20214 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
20215 /// A pointer to the contents in the error state.
20216 /// Reading from this pointer when `result_ok` is set is undefined.
20217 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20220 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
20221 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
20222 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20223 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20224 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
20225 /// `err` or `result` depending on the state of `result_ok`.
20226 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
20227 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
20228 pub result_ok: bool,
20231 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
20232 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20233 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20234 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20235 result: Box::into_raw(Box::new(o)),
20241 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
20242 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20243 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20244 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20245 err: Box::into_raw(Box::new(e)),
20250 /// Checks if the given object is currently in the success state
20252 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
20256 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
20257 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
20258 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20259 fn drop(&mut self) {
20260 if self.result_ok {
20261 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20262 let _ = unsafe { Box::from_raw(self.contents.result) };
20265 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20266 let _ = unsafe { Box::from_raw(self.contents.err) };
20271 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20272 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
20273 let contents = if o.result_ok {
20274 let result = unsafe { o.contents.result };
20275 unsafe { o.contents.result = core::ptr::null_mut() };
20276 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
20278 let err = unsafe { o.contents.err };
20279 unsafe { o.contents.err = core::ptr::null_mut(); }
20280 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
20284 result_ok: o.result_ok,
20288 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20289 fn clone(&self) -> Self {
20290 if self.result_ok {
20291 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20292 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
20295 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20296 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20302 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
20303 /// but with all dynamically-allocated buffers duplicated in new buffers.
20304 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
20306 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
20307 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
20308 /// A pointer to the contents in the success state.
20309 /// Reading from this pointer when `result_ok` is not set is undefined.
20310 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
20311 /// A pointer to the contents in the error state.
20312 /// Reading from this pointer when `result_ok` is set is undefined.
20313 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20316 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
20317 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20319 pub struct CResult_QueryChannelRangeDecodeErrorZ {
20320 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
20321 /// `err` or `result` depending on the state of `result_ok`.
20322 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
20323 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
20324 pub result_ok: bool,
20327 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
20328 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
20329 CResult_QueryChannelRangeDecodeErrorZ {
20330 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20331 result: Box::into_raw(Box::new(o)),
20337 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
20338 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
20339 CResult_QueryChannelRangeDecodeErrorZ {
20340 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20341 err: Box::into_raw(Box::new(e)),
20346 /// Checks if the given object is currently in the success state
20348 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
20352 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
20353 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
20354 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
20355 fn drop(&mut self) {
20356 if self.result_ok {
20357 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20358 let _ = unsafe { Box::from_raw(self.contents.result) };
20361 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20362 let _ = unsafe { Box::from_raw(self.contents.err) };
20367 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
20368 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20369 let contents = if o.result_ok {
20370 let result = unsafe { o.contents.result };
20371 unsafe { o.contents.result = core::ptr::null_mut() };
20372 CResult_QueryChannelRangeDecodeErrorZPtr { result }
20374 let err = unsafe { o.contents.err };
20375 unsafe { o.contents.err = core::ptr::null_mut(); }
20376 CResult_QueryChannelRangeDecodeErrorZPtr { err }
20380 result_ok: o.result_ok,
20384 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
20385 fn clone(&self) -> Self {
20386 if self.result_ok {
20387 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20388 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
20391 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20392 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20398 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
20399 /// but with all dynamically-allocated buffers duplicated in new buffers.
20400 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20402 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
20403 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
20404 /// A pointer to the contents in the success state.
20405 /// Reading from this pointer when `result_ok` is not set is undefined.
20406 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
20407 /// A pointer to the contents in the error state.
20408 /// Reading from this pointer when `result_ok` is set is undefined.
20409 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20412 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
20413 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20414 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20415 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
20416 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
20417 /// `err` or `result` depending on the state of `result_ok`.
20418 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
20419 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
20420 pub result_ok: bool,
20423 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
20424 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
20425 CResult_ReplyChannelRangeDecodeErrorZ {
20426 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20427 result: Box::into_raw(Box::new(o)),
20433 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
20434 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
20435 CResult_ReplyChannelRangeDecodeErrorZ {
20436 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20437 err: Box::into_raw(Box::new(e)),
20442 /// Checks if the given object is currently in the success state
20444 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
20448 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
20449 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
20450 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
20451 fn drop(&mut self) {
20452 if self.result_ok {
20453 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20454 let _ = unsafe { Box::from_raw(self.contents.result) };
20457 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20458 let _ = unsafe { Box::from_raw(self.contents.err) };
20463 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
20464 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20465 let contents = if o.result_ok {
20466 let result = unsafe { o.contents.result };
20467 unsafe { o.contents.result = core::ptr::null_mut() };
20468 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
20470 let err = unsafe { o.contents.err };
20471 unsafe { o.contents.err = core::ptr::null_mut(); }
20472 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
20476 result_ok: o.result_ok,
20480 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
20481 fn clone(&self) -> Self {
20482 if self.result_ok {
20483 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20484 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
20487 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20488 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20494 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
20495 /// but with all dynamically-allocated buffers duplicated in new buffers.
20496 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20498 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
20499 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
20500 /// A pointer to the contents in the success state.
20501 /// Reading from this pointer when `result_ok` is not set is undefined.
20502 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
20503 /// A pointer to the contents in the error state.
20504 /// Reading from this pointer when `result_ok` is set is undefined.
20505 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20508 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
20509 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
20510 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20511 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
20512 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
20513 /// `err` or `result` depending on the state of `result_ok`.
20514 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
20515 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
20516 pub result_ok: bool,
20519 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
20520 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
20521 CResult_GossipTimestampFilterDecodeErrorZ {
20522 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20523 result: Box::into_raw(Box::new(o)),
20529 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
20530 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
20531 CResult_GossipTimestampFilterDecodeErrorZ {
20532 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20533 err: Box::into_raw(Box::new(e)),
20538 /// Checks if the given object is currently in the success state
20540 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
20544 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
20545 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
20546 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
20547 fn drop(&mut self) {
20548 if self.result_ok {
20549 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20550 let _ = unsafe { Box::from_raw(self.contents.result) };
20553 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20554 let _ = unsafe { Box::from_raw(self.contents.err) };
20559 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
20560 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
20561 let contents = if o.result_ok {
20562 let result = unsafe { o.contents.result };
20563 unsafe { o.contents.result = core::ptr::null_mut() };
20564 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
20566 let err = unsafe { o.contents.err };
20567 unsafe { o.contents.err = core::ptr::null_mut(); }
20568 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
20572 result_ok: o.result_ok,
20576 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
20577 fn clone(&self) -> Self {
20578 if self.result_ok {
20579 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20580 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
20583 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20584 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20590 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
20591 /// but with all dynamically-allocated buffers duplicated in new buffers.
20592 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
20594 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
20595 /// This corresponds to std::vector in C++
20596 pub struct CVec_PhantomRouteHintsZ {
20597 /// The elements in the array.
20598 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20599 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
20600 /// The number of elements pointed to by `data`.
20603 impl CVec_PhantomRouteHintsZ {
20604 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
20605 if self.datalen == 0 { return Vec::new(); }
20606 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20607 self.data = core::ptr::null_mut();
20611 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
20612 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20615 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
20616 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
20617 let datalen = v.len();
20618 let data = Box::into_raw(v.into_boxed_slice());
20619 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20623 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20624 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
20625 impl Drop for CVec_PhantomRouteHintsZ {
20626 fn drop(&mut self) {
20627 if self.datalen == 0 { return; }
20628 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20631 impl Clone for CVec_PhantomRouteHintsZ {
20632 fn clone(&self) -> Self {
20633 let mut res = Vec::new();
20634 if self.datalen == 0 { return Self::from(res); }
20635 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20640 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
20641 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20642 /// A pointer to the contents in the success state.
20643 /// Reading from this pointer when `result_ok` is not set is undefined.
20644 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20645 /// A pointer to the contents in the error state.
20646 /// Reading from this pointer when `result_ok` is set is undefined.
20647 pub err: *mut crate::lightning_invoice::SignOrCreationError,
20650 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
20651 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
20652 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20653 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
20654 /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
20655 /// `err` or `result` depending on the state of `result_ok`.
20656 pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
20657 /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
20658 pub result_ok: bool,
20661 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
20662 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20663 CResult_Bolt11InvoiceSignOrCreationErrorZ {
20664 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20665 result: Box::into_raw(Box::new(o)),
20671 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
20672 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20673 CResult_Bolt11InvoiceSignOrCreationErrorZ {
20674 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20675 err: Box::into_raw(Box::new(e)),
20680 /// Checks if the given object is currently in the success state
20682 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
20686 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
20687 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
20688 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20689 fn drop(&mut self) {
20690 if self.result_ok {
20691 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20692 let _ = unsafe { Box::from_raw(self.contents.result) };
20695 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20696 let _ = unsafe { Box::from_raw(self.contents.err) };
20701 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20702 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
20703 let contents = if o.result_ok {
20704 let result = unsafe { o.contents.result };
20705 unsafe { o.contents.result = core::ptr::null_mut() };
20706 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
20708 let err = unsafe { o.contents.err };
20709 unsafe { o.contents.err = core::ptr::null_mut(); }
20710 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
20714 result_ok: o.result_ok,
20718 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20719 fn clone(&self) -> Self {
20720 if self.result_ok {
20721 Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20722 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20725 Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20726 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
20732 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
20733 /// but with all dynamically-allocated buffers duplicated in new buffers.
20734 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
20736 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
20737 /// This corresponds to std::vector in C++
20738 pub struct CVec_FutureZ {
20739 /// The elements in the array.
20740 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20741 pub data: *mut crate::lightning::util::wakers::Future,
20742 /// The number of elements pointed to by `data`.
20745 impl CVec_FutureZ {
20746 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
20747 if self.datalen == 0 { return Vec::new(); }
20748 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20749 self.data = core::ptr::null_mut();
20753 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
20754 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20757 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
20758 fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
20759 let datalen = v.len();
20760 let data = Box::into_raw(v.into_boxed_slice());
20761 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20765 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20766 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
20767 impl Drop for CVec_FutureZ {
20768 fn drop(&mut self) {
20769 if self.datalen == 0 { return; }
20770 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20774 /// The contents of CResult_OffersMessageDecodeErrorZ
20775 pub union CResult_OffersMessageDecodeErrorZPtr {
20776 /// A pointer to the contents in the success state.
20777 /// Reading from this pointer when `result_ok` is not set is undefined.
20778 pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
20779 /// A pointer to the contents in the error state.
20780 /// Reading from this pointer when `result_ok` is set is undefined.
20781 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20784 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
20785 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
20786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20787 pub struct CResult_OffersMessageDecodeErrorZ {
20788 /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
20789 /// `err` or `result` depending on the state of `result_ok`.
20790 pub contents: CResult_OffersMessageDecodeErrorZPtr,
20791 /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
20792 pub result_ok: bool,
20795 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
20796 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
20797 CResult_OffersMessageDecodeErrorZ {
20798 contents: CResult_OffersMessageDecodeErrorZPtr {
20799 result: Box::into_raw(Box::new(o)),
20805 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
20806 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
20807 CResult_OffersMessageDecodeErrorZ {
20808 contents: CResult_OffersMessageDecodeErrorZPtr {
20809 err: Box::into_raw(Box::new(e)),
20814 /// Checks if the given object is currently in the success state
20816 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
20820 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
20821 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
20822 impl Drop for CResult_OffersMessageDecodeErrorZ {
20823 fn drop(&mut self) {
20824 if self.result_ok {
20825 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20826 let _ = unsafe { Box::from_raw(self.contents.result) };
20829 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20830 let _ = unsafe { Box::from_raw(self.contents.err) };
20835 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
20836 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
20837 let contents = if o.result_ok {
20838 let result = unsafe { o.contents.result };
20839 unsafe { o.contents.result = core::ptr::null_mut() };
20840 CResult_OffersMessageDecodeErrorZPtr { result }
20842 let err = unsafe { o.contents.err };
20843 unsafe { o.contents.err = core::ptr::null_mut(); }
20844 CResult_OffersMessageDecodeErrorZPtr { err }
20848 result_ok: o.result_ok,
20852 impl Clone for CResult_OffersMessageDecodeErrorZ {
20853 fn clone(&self) -> Self {
20854 if self.result_ok {
20855 Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
20856 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
20859 Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
20860 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20866 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
20867 /// but with all dynamically-allocated buffers duplicated in new buffers.
20868 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
20870 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
20871 pub enum COption_HTLCClaimZ {
20872 /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
20873 Some(crate::lightning::ln::chan_utils::HTLCClaim),
20874 /// When we're in this state, this COption_HTLCClaimZ contains nothing
20877 impl COption_HTLCClaimZ {
20878 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20879 if let Self::None = self { false } else { true }
20881 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20884 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
20885 if let Self::Some(v) = self { v } else { unreachable!() }
20889 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
20890 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
20891 COption_HTLCClaimZ::Some(o)
20894 /// Constructs a new COption_HTLCClaimZ containing nothing
20895 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
20896 COption_HTLCClaimZ::None
20899 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
20900 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
20902 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
20903 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
20904 /// A pointer to the contents in the success state.
20905 /// Reading from this pointer when `result_ok` is not set is undefined.
20906 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
20907 /// A pointer to the contents in the error state.
20908 /// Reading from this pointer when `result_ok` is set is undefined.
20909 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20912 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
20913 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
20914 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20915 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20916 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
20917 /// `err` or `result` depending on the state of `result_ok`.
20918 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
20919 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
20920 pub result_ok: bool,
20923 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
20924 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20925 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20926 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
20927 result: Box::into_raw(Box::new(o)),
20933 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
20934 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20935 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20936 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
20937 err: Box::into_raw(Box::new(e)),
20942 /// Checks if the given object is currently in the success state
20944 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
20948 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
20949 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
20950 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20951 fn drop(&mut self) {
20952 if self.result_ok {
20953 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20954 let _ = unsafe { Box::from_raw(self.contents.result) };
20957 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20958 let _ = unsafe { Box::from_raw(self.contents.err) };
20963 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20964 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
20965 let contents = if o.result_ok {
20966 let result = unsafe { o.contents.result };
20967 unsafe { o.contents.result = core::ptr::null_mut() };
20968 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
20970 let err = unsafe { o.contents.err };
20971 unsafe { o.contents.err = core::ptr::null_mut(); }
20972 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
20976 result_ok: o.result_ok,
20980 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
20981 fn clone(&self) -> Self {
20982 if self.result_ok {
20983 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
20984 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
20987 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
20988 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20994 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
20995 /// but with all dynamically-allocated buffers duplicated in new buffers.
20996 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
20998 /// The contents of CResult_TxCreationKeysDecodeErrorZ
20999 pub union CResult_TxCreationKeysDecodeErrorZPtr {
21000 /// A pointer to the contents in the success state.
21001 /// Reading from this pointer when `result_ok` is not set is undefined.
21002 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
21003 /// A pointer to the contents in the error state.
21004 /// Reading from this pointer when `result_ok` is set is undefined.
21005 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21008 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
21009 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
21010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21011 pub struct CResult_TxCreationKeysDecodeErrorZ {
21012 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
21013 /// `err` or `result` depending on the state of `result_ok`.
21014 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
21015 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
21016 pub result_ok: bool,
21019 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
21020 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
21021 CResult_TxCreationKeysDecodeErrorZ {
21022 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21023 result: Box::into_raw(Box::new(o)),
21029 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
21030 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
21031 CResult_TxCreationKeysDecodeErrorZ {
21032 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21033 err: Box::into_raw(Box::new(e)),
21038 /// Checks if the given object is currently in the success state
21040 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
21044 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
21045 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
21046 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
21047 fn drop(&mut self) {
21048 if self.result_ok {
21049 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21050 let _ = unsafe { Box::from_raw(self.contents.result) };
21053 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21054 let _ = unsafe { Box::from_raw(self.contents.err) };
21059 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
21060 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
21061 let contents = if o.result_ok {
21062 let result = unsafe { o.contents.result };
21063 unsafe { o.contents.result = core::ptr::null_mut() };
21064 CResult_TxCreationKeysDecodeErrorZPtr { result }
21066 let err = unsafe { o.contents.err };
21067 unsafe { o.contents.err = core::ptr::null_mut(); }
21068 CResult_TxCreationKeysDecodeErrorZPtr { err }
21072 result_ok: o.result_ok,
21076 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
21077 fn clone(&self) -> Self {
21078 if self.result_ok {
21079 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21080 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
21083 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21084 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21090 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
21091 /// but with all dynamically-allocated buffers duplicated in new buffers.
21092 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
21094 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
21095 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
21096 /// A pointer to the contents in the success state.
21097 /// Reading from this pointer when `result_ok` is not set is undefined.
21098 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
21099 /// A pointer to the contents in the error state.
21100 /// Reading from this pointer when `result_ok` is set is undefined.
21101 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21104 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
21105 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
21106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21107 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
21108 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
21109 /// `err` or `result` depending on the state of `result_ok`.
21110 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
21111 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
21112 pub result_ok: bool,
21115 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
21116 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
21117 CResult_ChannelPublicKeysDecodeErrorZ {
21118 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21119 result: Box::into_raw(Box::new(o)),
21125 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
21126 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
21127 CResult_ChannelPublicKeysDecodeErrorZ {
21128 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21129 err: Box::into_raw(Box::new(e)),
21134 /// Checks if the given object is currently in the success state
21136 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
21140 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
21141 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
21142 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
21143 fn drop(&mut self) {
21144 if self.result_ok {
21145 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21146 let _ = unsafe { Box::from_raw(self.contents.result) };
21149 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21150 let _ = unsafe { Box::from_raw(self.contents.err) };
21155 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
21156 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
21157 let contents = if o.result_ok {
21158 let result = unsafe { o.contents.result };
21159 unsafe { o.contents.result = core::ptr::null_mut() };
21160 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
21162 let err = unsafe { o.contents.err };
21163 unsafe { o.contents.err = core::ptr::null_mut(); }
21164 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
21168 result_ok: o.result_ok,
21172 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
21173 fn clone(&self) -> Self {
21174 if self.result_ok {
21175 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21176 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
21179 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21180 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21186 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
21187 /// but with all dynamically-allocated buffers duplicated in new buffers.
21188 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
21190 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
21191 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21192 /// A pointer to the contents in the success state.
21193 /// Reading from this pointer when `result_ok` is not set is undefined.
21194 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
21195 /// A pointer to the contents in the error state.
21196 /// Reading from this pointer when `result_ok` is set is undefined.
21197 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21200 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
21201 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
21202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21203 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
21204 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
21205 /// `err` or `result` depending on the state of `result_ok`.
21206 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
21207 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
21208 pub result_ok: bool,
21211 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
21212 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
21213 CResult_HTLCOutputInCommitmentDecodeErrorZ {
21214 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21215 result: Box::into_raw(Box::new(o)),
21221 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
21222 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
21223 CResult_HTLCOutputInCommitmentDecodeErrorZ {
21224 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21225 err: Box::into_raw(Box::new(e)),
21230 /// Checks if the given object is currently in the success state
21232 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
21236 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
21237 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
21238 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
21239 fn drop(&mut self) {
21240 if self.result_ok {
21241 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21242 let _ = unsafe { Box::from_raw(self.contents.result) };
21245 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21246 let _ = unsafe { Box::from_raw(self.contents.err) };
21251 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
21252 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
21253 let contents = if o.result_ok {
21254 let result = unsafe { o.contents.result };
21255 unsafe { o.contents.result = core::ptr::null_mut() };
21256 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
21258 let err = unsafe { o.contents.err };
21259 unsafe { o.contents.err = core::ptr::null_mut(); }
21260 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
21264 result_ok: o.result_ok,
21268 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
21269 fn clone(&self) -> Self {
21270 if self.result_ok {
21271 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21272 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
21275 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21276 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21282 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
21283 /// but with all dynamically-allocated buffers duplicated in new buffers.
21284 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
21286 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
21287 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21288 /// A pointer to the contents in the success state.
21289 /// Reading from this pointer when `result_ok` is not set is undefined.
21290 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
21291 /// A pointer to the contents in the error state.
21292 /// Reading from this pointer when `result_ok` is set is undefined.
21293 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21296 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
21297 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
21298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21299 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21300 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
21301 /// `err` or `result` depending on the state of `result_ok`.
21302 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
21303 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
21304 pub result_ok: bool,
21307 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
21308 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21309 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21310 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21311 result: Box::into_raw(Box::new(o)),
21317 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
21318 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21319 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21320 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21321 err: Box::into_raw(Box::new(e)),
21326 /// Checks if the given object is currently in the success state
21328 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
21332 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
21333 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
21334 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21335 fn drop(&mut self) {
21336 if self.result_ok {
21337 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21338 let _ = unsafe { Box::from_raw(self.contents.result) };
21341 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21342 let _ = unsafe { Box::from_raw(self.contents.err) };
21347 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21348 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
21349 let contents = if o.result_ok {
21350 let result = unsafe { o.contents.result };
21351 unsafe { o.contents.result = core::ptr::null_mut() };
21352 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
21354 let err = unsafe { o.contents.err };
21355 unsafe { o.contents.err = core::ptr::null_mut(); }
21356 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
21360 result_ok: o.result_ok,
21364 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21365 fn clone(&self) -> Self {
21366 if self.result_ok {
21367 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21368 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
21371 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21372 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21378 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
21379 /// but with all dynamically-allocated buffers duplicated in new buffers.
21380 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
21382 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
21383 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
21384 /// A pointer to the contents in the success state.
21385 /// Reading from this pointer when `result_ok` is not set is undefined.
21386 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
21387 /// A pointer to the contents in the error state.
21388 /// Reading from this pointer when `result_ok` is set is undefined.
21389 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21392 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
21393 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
21394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21395 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
21396 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
21397 /// `err` or `result` depending on the state of `result_ok`.
21398 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
21399 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
21400 pub result_ok: bool,
21403 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
21404 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
21405 CResult_ChannelTransactionParametersDecodeErrorZ {
21406 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21407 result: Box::into_raw(Box::new(o)),
21413 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
21414 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
21415 CResult_ChannelTransactionParametersDecodeErrorZ {
21416 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21417 err: Box::into_raw(Box::new(e)),
21422 /// Checks if the given object is currently in the success state
21424 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
21428 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
21429 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
21430 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
21431 fn drop(&mut self) {
21432 if self.result_ok {
21433 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21434 let _ = unsafe { Box::from_raw(self.contents.result) };
21437 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21438 let _ = unsafe { Box::from_raw(self.contents.err) };
21443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
21444 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
21445 let contents = if o.result_ok {
21446 let result = unsafe { o.contents.result };
21447 unsafe { o.contents.result = core::ptr::null_mut() };
21448 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
21450 let err = unsafe { o.contents.err };
21451 unsafe { o.contents.err = core::ptr::null_mut(); }
21452 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
21456 result_ok: o.result_ok,
21460 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
21461 fn clone(&self) -> Self {
21462 if self.result_ok {
21463 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21464 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
21467 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21468 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21474 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
21475 /// but with all dynamically-allocated buffers duplicated in new buffers.
21476 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
21478 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
21479 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21480 /// A pointer to the contents in the success state.
21481 /// Reading from this pointer when `result_ok` is not set is undefined.
21482 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
21483 /// A pointer to the contents in the error state.
21484 /// Reading from this pointer when `result_ok` is set is undefined.
21485 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21488 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
21489 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
21490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21491 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
21492 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
21493 /// `err` or `result` depending on the state of `result_ok`.
21494 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
21495 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
21496 pub result_ok: bool,
21499 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
21500 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
21501 CResult_HolderCommitmentTransactionDecodeErrorZ {
21502 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21503 result: Box::into_raw(Box::new(o)),
21509 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
21510 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
21511 CResult_HolderCommitmentTransactionDecodeErrorZ {
21512 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21513 err: Box::into_raw(Box::new(e)),
21518 /// Checks if the given object is currently in the success state
21520 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
21524 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
21525 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
21526 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
21527 fn drop(&mut self) {
21528 if self.result_ok {
21529 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21530 let _ = unsafe { Box::from_raw(self.contents.result) };
21533 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21534 let _ = unsafe { Box::from_raw(self.contents.err) };
21539 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
21540 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
21541 let contents = if o.result_ok {
21542 let result = unsafe { o.contents.result };
21543 unsafe { o.contents.result = core::ptr::null_mut() };
21544 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
21546 let err = unsafe { o.contents.err };
21547 unsafe { o.contents.err = core::ptr::null_mut(); }
21548 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
21552 result_ok: o.result_ok,
21556 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
21557 fn clone(&self) -> Self {
21558 if self.result_ok {
21559 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21560 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
21563 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21564 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21570 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
21571 /// but with all dynamically-allocated buffers duplicated in new buffers.
21572 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
21574 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
21575 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21576 /// A pointer to the contents in the success state.
21577 /// Reading from this pointer when `result_ok` is not set is undefined.
21578 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
21579 /// A pointer to the contents in the error state.
21580 /// Reading from this pointer when `result_ok` is set is undefined.
21581 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21584 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
21585 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
21586 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21587 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
21588 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
21589 /// `err` or `result` depending on the state of `result_ok`.
21590 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
21591 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
21592 pub result_ok: bool,
21595 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
21596 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
21597 CResult_BuiltCommitmentTransactionDecodeErrorZ {
21598 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21599 result: Box::into_raw(Box::new(o)),
21605 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
21606 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
21607 CResult_BuiltCommitmentTransactionDecodeErrorZ {
21608 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21609 err: Box::into_raw(Box::new(e)),
21614 /// Checks if the given object is currently in the success state
21616 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
21620 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
21621 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
21622 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21623 fn drop(&mut self) {
21624 if self.result_ok {
21625 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21626 let _ = unsafe { Box::from_raw(self.contents.result) };
21629 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21630 let _ = unsafe { Box::from_raw(self.contents.err) };
21635 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21636 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
21637 let contents = if o.result_ok {
21638 let result = unsafe { o.contents.result };
21639 unsafe { o.contents.result = core::ptr::null_mut() };
21640 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
21642 let err = unsafe { o.contents.err };
21643 unsafe { o.contents.err = core::ptr::null_mut(); }
21644 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
21648 result_ok: o.result_ok,
21652 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21653 fn clone(&self) -> Self {
21654 if self.result_ok {
21655 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21656 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
21659 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21660 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21666 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
21667 /// but with all dynamically-allocated buffers duplicated in new buffers.
21668 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
21670 /// The contents of CResult_TrustedClosingTransactionNoneZ
21671 pub union CResult_TrustedClosingTransactionNoneZPtr {
21672 /// A pointer to the contents in the success state.
21673 /// Reading from this pointer when `result_ok` is not set is undefined.
21674 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
21675 /// Note that this value is always NULL, as there are no contents in the Err variant
21676 pub err: *mut core::ffi::c_void,
21679 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
21680 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
21681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21682 pub struct CResult_TrustedClosingTransactionNoneZ {
21683 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
21684 /// `err` or `result` depending on the state of `result_ok`.
21685 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
21686 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
21687 pub result_ok: bool,
21690 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
21691 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
21692 CResult_TrustedClosingTransactionNoneZ {
21693 contents: CResult_TrustedClosingTransactionNoneZPtr {
21694 result: Box::into_raw(Box::new(o)),
21700 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
21701 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
21702 CResult_TrustedClosingTransactionNoneZ {
21703 contents: CResult_TrustedClosingTransactionNoneZPtr {
21704 err: core::ptr::null_mut(),
21709 /// Checks if the given object is currently in the success state
21711 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
21715 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
21716 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
21717 impl Drop for CResult_TrustedClosingTransactionNoneZ {
21718 fn drop(&mut self) {
21719 if self.result_ok {
21720 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21721 let _ = unsafe { Box::from_raw(self.contents.result) };
21727 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
21728 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
21729 let contents = if o.result_ok {
21730 let result = unsafe { o.contents.result };
21731 unsafe { o.contents.result = core::ptr::null_mut() };
21732 CResult_TrustedClosingTransactionNoneZPtr { result }
21734 let _ = unsafe { Box::from_raw(o.contents.err) };
21735 o.contents.err = core::ptr::null_mut();
21736 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
21740 result_ok: o.result_ok,
21745 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
21746 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
21747 /// A pointer to the contents in the success state.
21748 /// Reading from this pointer when `result_ok` is not set is undefined.
21749 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
21750 /// A pointer to the contents in the error state.
21751 /// Reading from this pointer when `result_ok` is set is undefined.
21752 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21755 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
21756 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
21757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21758 pub struct CResult_CommitmentTransactionDecodeErrorZ {
21759 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
21760 /// `err` or `result` depending on the state of `result_ok`.
21761 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
21762 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
21763 pub result_ok: bool,
21766 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
21767 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
21768 CResult_CommitmentTransactionDecodeErrorZ {
21769 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
21770 result: Box::into_raw(Box::new(o)),
21776 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
21777 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
21778 CResult_CommitmentTransactionDecodeErrorZ {
21779 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
21780 err: Box::into_raw(Box::new(e)),
21785 /// Checks if the given object is currently in the success state
21787 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
21791 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
21792 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
21793 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
21794 fn drop(&mut self) {
21795 if self.result_ok {
21796 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21797 let _ = unsafe { Box::from_raw(self.contents.result) };
21800 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21801 let _ = unsafe { Box::from_raw(self.contents.err) };
21806 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
21807 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
21808 let contents = if o.result_ok {
21809 let result = unsafe { o.contents.result };
21810 unsafe { o.contents.result = core::ptr::null_mut() };
21811 CResult_CommitmentTransactionDecodeErrorZPtr { result }
21813 let err = unsafe { o.contents.err };
21814 unsafe { o.contents.err = core::ptr::null_mut(); }
21815 CResult_CommitmentTransactionDecodeErrorZPtr { err }
21819 result_ok: o.result_ok,
21823 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
21824 fn clone(&self) -> Self {
21825 if self.result_ok {
21826 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
21827 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
21830 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
21831 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21837 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
21838 /// but with all dynamically-allocated buffers duplicated in new buffers.
21839 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
21841 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
21842 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
21843 /// A pointer to the contents in the success state.
21844 /// Reading from this pointer when `result_ok` is not set is undefined.
21845 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
21846 /// Note that this value is always NULL, as there are no contents in the Err variant
21847 pub err: *mut core::ffi::c_void,
21850 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
21851 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
21852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21853 pub struct CResult_TrustedCommitmentTransactionNoneZ {
21854 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
21855 /// `err` or `result` depending on the state of `result_ok`.
21856 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
21857 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
21858 pub result_ok: bool,
21861 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
21862 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
21863 CResult_TrustedCommitmentTransactionNoneZ {
21864 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
21865 result: Box::into_raw(Box::new(o)),
21871 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
21872 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
21873 CResult_TrustedCommitmentTransactionNoneZ {
21874 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
21875 err: core::ptr::null_mut(),
21880 /// Checks if the given object is currently in the success state
21882 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
21886 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
21887 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
21888 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
21889 fn drop(&mut self) {
21890 if self.result_ok {
21891 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21892 let _ = unsafe { Box::from_raw(self.contents.result) };
21898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
21899 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
21900 let contents = if o.result_ok {
21901 let result = unsafe { o.contents.result };
21902 unsafe { o.contents.result = core::ptr::null_mut() };
21903 CResult_TrustedCommitmentTransactionNoneZPtr { result }
21905 let _ = unsafe { Box::from_raw(o.contents.err) };
21906 o.contents.err = core::ptr::null_mut();
21907 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
21911 result_ok: o.result_ok,
21916 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
21917 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
21918 /// A pointer to the contents in the success state.
21919 /// Reading from this pointer when `result_ok` is not set is undefined.
21920 pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
21921 /// Note that this value is always NULL, as there are no contents in the Err variant
21922 pub err: *mut core::ffi::c_void,
21925 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
21926 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
21927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21928 pub struct CResult_CVec_ECDSASignatureZNoneZ {
21929 /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
21930 /// `err` or `result` depending on the state of `result_ok`.
21931 pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
21932 /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
21933 pub result_ok: bool,
21936 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
21937 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
21938 CResult_CVec_ECDSASignatureZNoneZ {
21939 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
21940 result: Box::into_raw(Box::new(o)),
21946 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
21947 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
21948 CResult_CVec_ECDSASignatureZNoneZ {
21949 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
21950 err: core::ptr::null_mut(),
21955 /// Checks if the given object is currently in the success state
21957 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
21961 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
21962 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
21963 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
21964 fn drop(&mut self) {
21965 if self.result_ok {
21966 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21967 let _ = unsafe { Box::from_raw(self.contents.result) };
21973 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
21974 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> Self {
21975 let contents = if o.result_ok {
21976 let result = unsafe { o.contents.result };
21977 unsafe { o.contents.result = core::ptr::null_mut() };
21978 CResult_CVec_ECDSASignatureZNoneZPtr { result }
21980 let _ = unsafe { Box::from_raw(o.contents.err) };
21981 o.contents.err = core::ptr::null_mut();
21982 CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
21986 result_ok: o.result_ok,
21990 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
21991 fn clone(&self) -> Self {
21992 if self.result_ok {
21993 Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
21994 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
21997 Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
21998 err: core::ptr::null_mut()
22004 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
22005 /// but with all dynamically-allocated buffers duplicated in new buffers.
22006 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
22009 /// An enum which can either contain a usize or not
22010 pub enum COption_usizeZ {
22011 /// When we're in this state, this COption_usizeZ contains a usize
22013 /// When we're in this state, this COption_usizeZ contains nothing
22016 impl COption_usizeZ {
22017 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22018 if let Self::None = self { false } else { true }
22020 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22023 #[allow(unused)] pub(crate) fn take(mut self) -> usize {
22024 if let Self::Some(v) = self { v } else { unreachable!() }
22028 /// Constructs a new COption_usizeZ containing a usize
22029 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
22030 COption_usizeZ::Some(o)
22033 /// Constructs a new COption_usizeZ containing nothing
22034 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
22035 COption_usizeZ::None
22038 /// Frees any resources associated with the usize, if we are in the Some state
22039 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
22041 /// Creates a new COption_usizeZ which has the same data as `orig`
22042 /// but with all dynamically-allocated buffers duplicated in new buffers.
22043 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
22045 /// The contents of CResult_ShutdownScriptDecodeErrorZ
22046 pub union CResult_ShutdownScriptDecodeErrorZPtr {
22047 /// A pointer to the contents in the success state.
22048 /// Reading from this pointer when `result_ok` is not set is undefined.
22049 pub result: *mut crate::lightning::ln::script::ShutdownScript,
22050 /// A pointer to the contents in the error state.
22051 /// Reading from this pointer when `result_ok` is set is undefined.
22052 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22055 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
22056 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
22057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22058 pub struct CResult_ShutdownScriptDecodeErrorZ {
22059 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
22060 /// `err` or `result` depending on the state of `result_ok`.
22061 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
22062 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
22063 pub result_ok: bool,
22066 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
22067 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
22068 CResult_ShutdownScriptDecodeErrorZ {
22069 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22070 result: Box::into_raw(Box::new(o)),
22076 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
22077 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
22078 CResult_ShutdownScriptDecodeErrorZ {
22079 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22080 err: Box::into_raw(Box::new(e)),
22085 /// Checks if the given object is currently in the success state
22087 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
22091 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
22092 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
22093 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
22094 fn drop(&mut self) {
22095 if self.result_ok {
22096 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22097 let _ = unsafe { Box::from_raw(self.contents.result) };
22100 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22101 let _ = unsafe { Box::from_raw(self.contents.err) };
22106 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
22107 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
22108 let contents = if o.result_ok {
22109 let result = unsafe { o.contents.result };
22110 unsafe { o.contents.result = core::ptr::null_mut() };
22111 CResult_ShutdownScriptDecodeErrorZPtr { result }
22113 let err = unsafe { o.contents.err };
22114 unsafe { o.contents.err = core::ptr::null_mut(); }
22115 CResult_ShutdownScriptDecodeErrorZPtr { err }
22119 result_ok: o.result_ok,
22123 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
22124 fn clone(&self) -> Self {
22125 if self.result_ok {
22126 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22127 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
22130 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22131 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22137 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
22138 /// but with all dynamically-allocated buffers duplicated in new buffers.
22139 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
22141 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
22142 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22143 /// A pointer to the contents in the success state.
22144 /// Reading from this pointer when `result_ok` is not set is undefined.
22145 pub result: *mut crate::lightning::ln::script::ShutdownScript,
22146 /// A pointer to the contents in the error state.
22147 /// Reading from this pointer when `result_ok` is set is undefined.
22148 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
22151 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
22152 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
22153 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22154 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
22155 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
22156 /// `err` or `result` depending on the state of `result_ok`.
22157 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
22158 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
22159 pub result_ok: bool,
22162 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
22163 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22164 CResult_ShutdownScriptInvalidShutdownScriptZ {
22165 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22166 result: Box::into_raw(Box::new(o)),
22172 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
22173 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22174 CResult_ShutdownScriptInvalidShutdownScriptZ {
22175 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22176 err: Box::into_raw(Box::new(e)),
22181 /// Checks if the given object is currently in the success state
22183 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
22187 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
22188 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
22189 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
22190 fn drop(&mut self) {
22191 if self.result_ok {
22192 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22193 let _ = unsafe { Box::from_raw(self.contents.result) };
22196 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22197 let _ = unsafe { Box::from_raw(self.contents.err) };
22202 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
22203 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
22204 let contents = if o.result_ok {
22205 let result = unsafe { o.contents.result };
22206 unsafe { o.contents.result = core::ptr::null_mut() };
22207 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
22209 let err = unsafe { o.contents.err };
22210 unsafe { o.contents.err = core::ptr::null_mut(); }
22211 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
22215 result_ok: o.result_ok,
22219 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
22220 fn clone(&self) -> Self {
22221 if self.result_ok {
22222 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22223 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
22226 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22227 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
22233 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
22234 /// but with all dynamically-allocated buffers duplicated in new buffers.
22235 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
22237 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
22238 /// This corresponds to std::vector in C++
22239 pub struct CVec_TransactionZ {
22240 /// The elements in the array.
22241 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
22242 pub data: *mut crate::c_types::Transaction,
22243 /// The number of elements pointed to by `data`.
22246 impl CVec_TransactionZ {
22247 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
22248 if self.datalen == 0 { return Vec::new(); }
22249 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
22250 self.data = core::ptr::null_mut();
22254 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
22255 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
22258 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
22259 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
22260 let datalen = v.len();
22261 let data = Box::into_raw(v.into_boxed_slice());
22262 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
22266 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
22267 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
22268 impl Drop for CVec_TransactionZ {
22269 fn drop(&mut self) {
22270 if self.datalen == 0 { return; }
22271 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
22274 impl Clone for CVec_TransactionZ {
22275 fn clone(&self) -> Self {
22276 let mut res = Vec::new();
22277 if self.datalen == 0 { return Self::from(res); }
22278 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
22283 /// The contents of CResult_PaymentPurposeDecodeErrorZ
22284 pub union CResult_PaymentPurposeDecodeErrorZPtr {
22285 /// A pointer to the contents in the success state.
22286 /// Reading from this pointer when `result_ok` is not set is undefined.
22287 pub result: *mut crate::lightning::events::PaymentPurpose,
22288 /// A pointer to the contents in the error state.
22289 /// Reading from this pointer when `result_ok` is set is undefined.
22290 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22293 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
22294 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
22295 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22296 pub struct CResult_PaymentPurposeDecodeErrorZ {
22297 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
22298 /// `err` or `result` depending on the state of `result_ok`.
22299 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
22300 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
22301 pub result_ok: bool,
22304 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
22305 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
22306 CResult_PaymentPurposeDecodeErrorZ {
22307 contents: CResult_PaymentPurposeDecodeErrorZPtr {
22308 result: Box::into_raw(Box::new(o)),
22314 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
22315 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
22316 CResult_PaymentPurposeDecodeErrorZ {
22317 contents: CResult_PaymentPurposeDecodeErrorZPtr {
22318 err: Box::into_raw(Box::new(e)),
22323 /// Checks if the given object is currently in the success state
22325 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
22329 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
22330 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
22331 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
22332 fn drop(&mut self) {
22333 if self.result_ok {
22334 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22335 let _ = unsafe { Box::from_raw(self.contents.result) };
22338 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22339 let _ = unsafe { Box::from_raw(self.contents.err) };
22344 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
22345 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
22346 let contents = if o.result_ok {
22347 let result = unsafe { o.contents.result };
22348 unsafe { o.contents.result = core::ptr::null_mut() };
22349 CResult_PaymentPurposeDecodeErrorZPtr { result }
22351 let err = unsafe { o.contents.err };
22352 unsafe { o.contents.err = core::ptr::null_mut(); }
22353 CResult_PaymentPurposeDecodeErrorZPtr { err }
22357 result_ok: o.result_ok,
22361 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
22362 fn clone(&self) -> Self {
22363 if self.result_ok {
22364 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
22365 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
22368 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
22369 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22375 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
22376 /// but with all dynamically-allocated buffers duplicated in new buffers.
22377 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
22379 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
22380 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
22381 /// A pointer to the contents in the success state.
22382 /// Reading from this pointer when `result_ok` is not set is undefined.
22383 pub result: *mut crate::lightning::events::ClaimedHTLC,
22384 /// A pointer to the contents in the error state.
22385 /// Reading from this pointer when `result_ok` is set is undefined.
22386 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22389 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
22390 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
22391 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22392 pub struct CResult_ClaimedHTLCDecodeErrorZ {
22393 /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
22394 /// `err` or `result` depending on the state of `result_ok`.
22395 pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
22396 /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
22397 pub result_ok: bool,
22400 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
22401 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
22402 CResult_ClaimedHTLCDecodeErrorZ {
22403 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22404 result: Box::into_raw(Box::new(o)),
22410 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
22411 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
22412 CResult_ClaimedHTLCDecodeErrorZ {
22413 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22414 err: Box::into_raw(Box::new(e)),
22419 /// Checks if the given object is currently in the success state
22421 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
22425 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
22426 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
22427 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
22428 fn drop(&mut self) {
22429 if self.result_ok {
22430 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22431 let _ = unsafe { Box::from_raw(self.contents.result) };
22434 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22435 let _ = unsafe { Box::from_raw(self.contents.err) };
22440 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
22441 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
22442 let contents = if o.result_ok {
22443 let result = unsafe { o.contents.result };
22444 unsafe { o.contents.result = core::ptr::null_mut() };
22445 CResult_ClaimedHTLCDecodeErrorZPtr { result }
22447 let err = unsafe { o.contents.err };
22448 unsafe { o.contents.err = core::ptr::null_mut(); }
22449 CResult_ClaimedHTLCDecodeErrorZPtr { err }
22453 result_ok: o.result_ok,
22457 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
22458 fn clone(&self) -> Self {
22459 if self.result_ok {
22460 Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22461 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
22464 Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22465 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22471 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
22472 /// but with all dynamically-allocated buffers duplicated in new buffers.
22473 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
22476 /// An enum which can either contain a crate::lightning::events::PathFailure or not
22477 pub enum COption_PathFailureZ {
22478 /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
22479 Some(crate::lightning::events::PathFailure),
22480 /// When we're in this state, this COption_PathFailureZ contains nothing
22483 impl COption_PathFailureZ {
22484 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22485 if let Self::None = self { false } else { true }
22487 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22490 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
22491 if let Self::Some(v) = self { v } else { unreachable!() }
22495 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
22496 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
22497 COption_PathFailureZ::Some(o)
22500 /// Constructs a new COption_PathFailureZ containing nothing
22501 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
22502 COption_PathFailureZ::None
22505 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
22506 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
22508 /// Creates a new COption_PathFailureZ which has the same data as `orig`
22509 /// but with all dynamically-allocated buffers duplicated in new buffers.
22510 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
22512 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
22513 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
22514 /// A pointer to the contents in the success state.
22515 /// Reading from this pointer when `result_ok` is not set is undefined.
22516 pub result: *mut crate::c_types::derived::COption_PathFailureZ,
22517 /// A pointer to the contents in the error state.
22518 /// Reading from this pointer when `result_ok` is set is undefined.
22519 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22522 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
22523 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
22524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22525 pub struct CResult_COption_PathFailureZDecodeErrorZ {
22526 /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
22527 /// `err` or `result` depending on the state of `result_ok`.
22528 pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
22529 /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
22530 pub result_ok: bool,
22533 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
22534 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
22535 CResult_COption_PathFailureZDecodeErrorZ {
22536 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22537 result: Box::into_raw(Box::new(o)),
22543 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
22544 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
22545 CResult_COption_PathFailureZDecodeErrorZ {
22546 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22547 err: Box::into_raw(Box::new(e)),
22552 /// Checks if the given object is currently in the success state
22554 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
22558 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
22559 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
22560 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
22561 fn drop(&mut self) {
22562 if self.result_ok {
22563 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22564 let _ = unsafe { Box::from_raw(self.contents.result) };
22567 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22568 let _ = unsafe { Box::from_raw(self.contents.err) };
22573 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
22574 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
22575 let contents = if o.result_ok {
22576 let result = unsafe { o.contents.result };
22577 unsafe { o.contents.result = core::ptr::null_mut() };
22578 CResult_COption_PathFailureZDecodeErrorZPtr { result }
22580 let err = unsafe { o.contents.err };
22581 unsafe { o.contents.err = core::ptr::null_mut(); }
22582 CResult_COption_PathFailureZDecodeErrorZPtr { err }
22586 result_ok: o.result_ok,
22590 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
22591 fn clone(&self) -> Self {
22592 if self.result_ok {
22593 Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22594 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
22597 Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22598 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22604 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
22605 /// but with all dynamically-allocated buffers duplicated in new buffers.
22606 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
22609 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
22610 pub enum COption_ClosureReasonZ {
22611 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
22612 Some(crate::lightning::events::ClosureReason),
22613 /// When we're in this state, this COption_ClosureReasonZ contains nothing
22616 impl COption_ClosureReasonZ {
22617 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22618 if let Self::None = self { false } else { true }
22620 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22623 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
22624 if let Self::Some(v) = self { v } else { unreachable!() }
22628 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
22629 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
22630 COption_ClosureReasonZ::Some(o)
22633 /// Constructs a new COption_ClosureReasonZ containing nothing
22634 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
22635 COption_ClosureReasonZ::None
22638 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
22639 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
22641 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
22642 /// but with all dynamically-allocated buffers duplicated in new buffers.
22643 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
22645 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
22646 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
22647 /// A pointer to the contents in the success state.
22648 /// Reading from this pointer when `result_ok` is not set is undefined.
22649 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
22650 /// A pointer to the contents in the error state.
22651 /// Reading from this pointer when `result_ok` is set is undefined.
22652 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22655 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
22656 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
22657 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22658 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
22659 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
22660 /// `err` or `result` depending on the state of `result_ok`.
22661 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
22662 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
22663 pub result_ok: bool,
22666 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
22667 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
22668 CResult_COption_ClosureReasonZDecodeErrorZ {
22669 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22670 result: Box::into_raw(Box::new(o)),
22676 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
22677 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
22678 CResult_COption_ClosureReasonZDecodeErrorZ {
22679 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22680 err: Box::into_raw(Box::new(e)),
22685 /// Checks if the given object is currently in the success state
22687 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
22691 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
22692 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
22693 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
22694 fn drop(&mut self) {
22695 if self.result_ok {
22696 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22697 let _ = unsafe { Box::from_raw(self.contents.result) };
22700 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22701 let _ = unsafe { Box::from_raw(self.contents.err) };
22706 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
22707 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
22708 let contents = if o.result_ok {
22709 let result = unsafe { o.contents.result };
22710 unsafe { o.contents.result = core::ptr::null_mut() };
22711 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
22713 let err = unsafe { o.contents.err };
22714 unsafe { o.contents.err = core::ptr::null_mut(); }
22715 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
22719 result_ok: o.result_ok,
22723 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
22724 fn clone(&self) -> Self {
22725 if self.result_ok {
22726 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22727 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
22730 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22731 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22737 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
22738 /// but with all dynamically-allocated buffers duplicated in new buffers.
22739 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
22742 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
22743 pub enum COption_HTLCDestinationZ {
22744 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
22745 Some(crate::lightning::events::HTLCDestination),
22746 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
22749 impl COption_HTLCDestinationZ {
22750 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22751 if let Self::None = self { false } else { true }
22753 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22756 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
22757 if let Self::Some(v) = self { v } else { unreachable!() }
22761 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
22762 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
22763 COption_HTLCDestinationZ::Some(o)
22766 /// Constructs a new COption_HTLCDestinationZ containing nothing
22767 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
22768 COption_HTLCDestinationZ::None
22771 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
22772 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
22774 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
22775 /// but with all dynamically-allocated buffers duplicated in new buffers.
22776 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
22778 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
22779 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
22780 /// A pointer to the contents in the success state.
22781 /// Reading from this pointer when `result_ok` is not set is undefined.
22782 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
22783 /// A pointer to the contents in the error state.
22784 /// Reading from this pointer when `result_ok` is set is undefined.
22785 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22788 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
22789 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
22790 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22791 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
22792 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
22793 /// `err` or `result` depending on the state of `result_ok`.
22794 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
22795 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
22796 pub result_ok: bool,
22799 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
22800 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
22801 CResult_COption_HTLCDestinationZDecodeErrorZ {
22802 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
22803 result: Box::into_raw(Box::new(o)),
22809 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
22810 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
22811 CResult_COption_HTLCDestinationZDecodeErrorZ {
22812 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
22813 err: Box::into_raw(Box::new(e)),
22818 /// Checks if the given object is currently in the success state
22820 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
22824 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
22825 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
22826 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
22827 fn drop(&mut self) {
22828 if self.result_ok {
22829 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22830 let _ = unsafe { Box::from_raw(self.contents.result) };
22833 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22834 let _ = unsafe { Box::from_raw(self.contents.err) };
22839 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
22840 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
22841 let contents = if o.result_ok {
22842 let result = unsafe { o.contents.result };
22843 unsafe { o.contents.result = core::ptr::null_mut() };
22844 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
22846 let err = unsafe { o.contents.err };
22847 unsafe { o.contents.err = core::ptr::null_mut(); }
22848 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
22852 result_ok: o.result_ok,
22856 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
22857 fn clone(&self) -> Self {
22858 if self.result_ok {
22859 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
22860 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
22863 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
22864 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22870 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
22871 /// but with all dynamically-allocated buffers duplicated in new buffers.
22872 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
22874 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
22875 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
22876 /// A pointer to the contents in the success state.
22877 /// Reading from this pointer when `result_ok` is not set is undefined.
22878 pub result: *mut crate::lightning::events::PaymentFailureReason,
22879 /// A pointer to the contents in the error state.
22880 /// Reading from this pointer when `result_ok` is set is undefined.
22881 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22884 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
22885 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
22886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22887 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
22888 /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
22889 /// `err` or `result` depending on the state of `result_ok`.
22890 pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
22891 /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
22892 pub result_ok: bool,
22895 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
22896 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
22897 CResult_PaymentFailureReasonDecodeErrorZ {
22898 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
22899 result: Box::into_raw(Box::new(o)),
22905 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
22906 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
22907 CResult_PaymentFailureReasonDecodeErrorZ {
22908 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
22909 err: Box::into_raw(Box::new(e)),
22914 /// Checks if the given object is currently in the success state
22916 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
22920 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
22921 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
22922 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
22923 fn drop(&mut self) {
22924 if self.result_ok {
22925 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22926 let _ = unsafe { Box::from_raw(self.contents.result) };
22929 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22930 let _ = unsafe { Box::from_raw(self.contents.err) };
22935 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
22936 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
22937 let contents = if o.result_ok {
22938 let result = unsafe { o.contents.result };
22939 unsafe { o.contents.result = core::ptr::null_mut() };
22940 CResult_PaymentFailureReasonDecodeErrorZPtr { result }
22942 let err = unsafe { o.contents.err };
22943 unsafe { o.contents.err = core::ptr::null_mut(); }
22944 CResult_PaymentFailureReasonDecodeErrorZPtr { err }
22948 result_ok: o.result_ok,
22952 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
22953 fn clone(&self) -> Self {
22954 if self.result_ok {
22955 Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
22956 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
22959 Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
22960 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22966 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
22967 /// but with all dynamically-allocated buffers duplicated in new buffers.
22968 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
22971 /// An enum which can either contain a crate::c_types::U128 or not
22972 pub enum COption_U128Z {
22973 /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
22974 Some(crate::c_types::U128),
22975 /// When we're in this state, this COption_U128Z contains nothing
22978 impl COption_U128Z {
22979 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22980 if let Self::None = self { false } else { true }
22982 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22985 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
22986 if let Self::Some(v) = self { v } else { unreachable!() }
22990 /// Constructs a new COption_U128Z containing a crate::c_types::U128
22991 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
22992 COption_U128Z::Some(o)
22995 /// Constructs a new COption_U128Z containing nothing
22996 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
22997 COption_U128Z::None
23000 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
23001 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
23003 /// Creates a new COption_U128Z which has the same data as `orig`
23004 /// but with all dynamically-allocated buffers duplicated in new buffers.
23005 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
23007 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
23008 /// This corresponds to std::vector in C++
23009 pub struct CVec_ClaimedHTLCZ {
23010 /// The elements in the array.
23011 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23012 pub data: *mut crate::lightning::events::ClaimedHTLC,
23013 /// The number of elements pointed to by `data`.
23016 impl CVec_ClaimedHTLCZ {
23017 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
23018 if self.datalen == 0 { return Vec::new(); }
23019 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23020 self.data = core::ptr::null_mut();
23024 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
23025 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23028 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
23029 fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
23030 let datalen = v.len();
23031 let data = Box::into_raw(v.into_boxed_slice());
23032 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23036 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23037 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
23038 impl Drop for CVec_ClaimedHTLCZ {
23039 fn drop(&mut self) {
23040 if self.datalen == 0 { return; }
23041 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23044 impl Clone for CVec_ClaimedHTLCZ {
23045 fn clone(&self) -> Self {
23046 let mut res = Vec::new();
23047 if self.datalen == 0 { return Self::from(res); }
23048 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23054 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
23055 pub enum COption_PaymentFailureReasonZ {
23056 /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
23057 Some(crate::lightning::events::PaymentFailureReason),
23058 /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
23061 impl COption_PaymentFailureReasonZ {
23062 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23063 if let Self::None = self { false } else { true }
23065 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23068 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
23069 if let Self::Some(v) = self { v } else { unreachable!() }
23073 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
23074 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
23075 COption_PaymentFailureReasonZ::Some(o)
23078 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
23079 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
23080 COption_PaymentFailureReasonZ::None
23083 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
23084 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
23086 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
23087 /// but with all dynamically-allocated buffers duplicated in new buffers.
23088 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
23091 /// An enum which can either contain a crate::lightning::events::Event or not
23092 pub enum COption_EventZ {
23093 /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
23094 Some(crate::lightning::events::Event),
23095 /// When we're in this state, this COption_EventZ contains nothing
23098 impl COption_EventZ {
23099 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23100 if let Self::None = self { false } else { true }
23102 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23105 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
23106 if let Self::Some(v) = self { v } else { unreachable!() }
23110 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
23111 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
23112 COption_EventZ::Some(o)
23115 /// Constructs a new COption_EventZ containing nothing
23116 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
23117 COption_EventZ::None
23120 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
23121 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
23123 /// Creates a new COption_EventZ which has the same data as `orig`
23124 /// but with all dynamically-allocated buffers duplicated in new buffers.
23125 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
23127 /// The contents of CResult_COption_EventZDecodeErrorZ
23128 pub union CResult_COption_EventZDecodeErrorZPtr {
23129 /// A pointer to the contents in the success state.
23130 /// Reading from this pointer when `result_ok` is not set is undefined.
23131 pub result: *mut crate::c_types::derived::COption_EventZ,
23132 /// A pointer to the contents in the error state.
23133 /// Reading from this pointer when `result_ok` is set is undefined.
23134 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23137 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
23138 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23139 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23140 pub struct CResult_COption_EventZDecodeErrorZ {
23141 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
23142 /// `err` or `result` depending on the state of `result_ok`.
23143 pub contents: CResult_COption_EventZDecodeErrorZPtr,
23144 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
23145 pub result_ok: bool,
23148 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
23149 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
23150 CResult_COption_EventZDecodeErrorZ {
23151 contents: CResult_COption_EventZDecodeErrorZPtr {
23152 result: Box::into_raw(Box::new(o)),
23158 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
23159 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
23160 CResult_COption_EventZDecodeErrorZ {
23161 contents: CResult_COption_EventZDecodeErrorZPtr {
23162 err: Box::into_raw(Box::new(e)),
23167 /// Checks if the given object is currently in the success state
23169 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
23173 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
23174 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
23175 impl Drop for CResult_COption_EventZDecodeErrorZ {
23176 fn drop(&mut self) {
23177 if self.result_ok {
23178 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23179 let _ = unsafe { Box::from_raw(self.contents.result) };
23182 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23183 let _ = unsafe { Box::from_raw(self.contents.err) };
23188 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
23189 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23190 let contents = if o.result_ok {
23191 let result = unsafe { o.contents.result };
23192 unsafe { o.contents.result = core::ptr::null_mut() };
23193 CResult_COption_EventZDecodeErrorZPtr { result }
23195 let err = unsafe { o.contents.err };
23196 unsafe { o.contents.err = core::ptr::null_mut(); }
23197 CResult_COption_EventZDecodeErrorZPtr { err }
23201 result_ok: o.result_ok,
23205 impl Clone for CResult_COption_EventZDecodeErrorZ {
23206 fn clone(&self) -> Self {
23207 if self.result_ok {
23208 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
23209 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
23212 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
23213 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23219 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
23220 /// but with all dynamically-allocated buffers duplicated in new buffers.
23221 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
23223 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
23224 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
23225 /// A pointer to the contents in the success state.
23226 /// Reading from this pointer when `result_ok` is not set is undefined.
23227 pub result: *mut crate::lightning_invoice::SiPrefix,
23228 /// A pointer to the contents in the error state.
23229 /// Reading from this pointer when `result_ok` is set is undefined.
23230 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
23233 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
23234 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
23235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23236 pub struct CResult_SiPrefixBolt11ParseErrorZ {
23237 /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
23238 /// `err` or `result` depending on the state of `result_ok`.
23239 pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
23240 /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
23241 pub result_ok: bool,
23244 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
23245 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
23246 CResult_SiPrefixBolt11ParseErrorZ {
23247 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23248 result: Box::into_raw(Box::new(o)),
23254 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
23255 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
23256 CResult_SiPrefixBolt11ParseErrorZ {
23257 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23258 err: Box::into_raw(Box::new(e)),
23263 /// Checks if the given object is currently in the success state
23265 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
23269 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
23270 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
23271 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
23272 fn drop(&mut self) {
23273 if self.result_ok {
23274 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23275 let _ = unsafe { Box::from_raw(self.contents.result) };
23278 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23279 let _ = unsafe { Box::from_raw(self.contents.err) };
23284 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
23285 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
23286 let contents = if o.result_ok {
23287 let result = unsafe { o.contents.result };
23288 unsafe { o.contents.result = core::ptr::null_mut() };
23289 CResult_SiPrefixBolt11ParseErrorZPtr { result }
23291 let err = unsafe { o.contents.err };
23292 unsafe { o.contents.err = core::ptr::null_mut(); }
23293 CResult_SiPrefixBolt11ParseErrorZPtr { err }
23297 result_ok: o.result_ok,
23301 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
23302 fn clone(&self) -> Self {
23303 if self.result_ok {
23304 Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23305 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
23308 Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23309 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
23315 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
23316 /// but with all dynamically-allocated buffers duplicated in new buffers.
23317 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
23319 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
23320 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23321 /// A pointer to the contents in the success state.
23322 /// Reading from this pointer when `result_ok` is not set is undefined.
23323 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
23324 /// A pointer to the contents in the error state.
23325 /// Reading from this pointer when `result_ok` is set is undefined.
23326 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
23329 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
23330 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
23331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23332 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23333 /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
23334 /// `err` or `result` depending on the state of `result_ok`.
23335 pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
23336 /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
23337 pub result_ok: bool,
23340 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
23341 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23342 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23343 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23344 result: Box::into_raw(Box::new(o)),
23350 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
23351 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23352 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23353 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23354 err: Box::into_raw(Box::new(e)),
23359 /// Checks if the given object is currently in the success state
23361 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
23365 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
23366 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
23367 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23368 fn drop(&mut self) {
23369 if self.result_ok {
23370 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23371 let _ = unsafe { Box::from_raw(self.contents.result) };
23374 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23375 let _ = unsafe { Box::from_raw(self.contents.err) };
23380 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23381 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
23382 let contents = if o.result_ok {
23383 let result = unsafe { o.contents.result };
23384 unsafe { o.contents.result = core::ptr::null_mut() };
23385 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
23387 let err = unsafe { o.contents.err };
23388 unsafe { o.contents.err = core::ptr::null_mut(); }
23389 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
23393 result_ok: o.result_ok,
23397 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23398 fn clone(&self) -> Self {
23399 if self.result_ok {
23400 Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23401 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
23404 Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23405 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
23411 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
23412 /// but with all dynamically-allocated buffers duplicated in new buffers.
23413 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
23415 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
23416 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23417 /// A pointer to the contents in the success state.
23418 /// Reading from this pointer when `result_ok` is not set is undefined.
23419 pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
23420 /// A pointer to the contents in the error state.
23421 /// Reading from this pointer when `result_ok` is set is undefined.
23422 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
23425 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
23426 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
23427 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23428 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23429 /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
23430 /// `err` or `result` depending on the state of `result_ok`.
23431 pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
23432 /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
23433 pub result_ok: bool,
23436 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
23437 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23438 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23439 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23440 result: Box::into_raw(Box::new(o)),
23446 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
23447 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23448 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23449 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23450 err: Box::into_raw(Box::new(e)),
23455 /// Checks if the given object is currently in the success state
23457 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
23461 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
23462 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
23463 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23464 fn drop(&mut self) {
23465 if self.result_ok {
23466 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23467 let _ = unsafe { Box::from_raw(self.contents.result) };
23470 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23471 let _ = unsafe { Box::from_raw(self.contents.err) };
23476 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23477 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
23478 let contents = if o.result_ok {
23479 let result = unsafe { o.contents.result };
23480 unsafe { o.contents.result = core::ptr::null_mut() };
23481 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
23483 let err = unsafe { o.contents.err };
23484 unsafe { o.contents.err = core::ptr::null_mut(); }
23485 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
23489 result_ok: o.result_ok,
23493 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23494 fn clone(&self) -> Self {
23495 if self.result_ok {
23496 Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23497 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
23500 Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23501 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
23507 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
23508 /// but with all dynamically-allocated buffers duplicated in new buffers.
23509 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
23511 /// A tuple of 3 elements. See the individual fields for the types contained.
23512 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23513 /// The element at position 0
23514 pub a: crate::lightning_invoice::RawBolt11Invoice,
23515 /// The element at position 1
23516 pub b: crate::c_types::ThirtyTwoBytes,
23517 /// The element at position 2
23518 pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
23520 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23521 fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
23529 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23530 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
23531 (self.a, self.b, self.c)
23534 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23535 fn clone(&self) -> Self {
23537 a: Clone::clone(&self.a),
23538 b: Clone::clone(&self.b),
23539 c: Clone::clone(&self.c),
23544 /// Creates a new tuple which has the same data as `orig`
23545 /// but with all dynamically-allocated buffers duplicated in new buffers.
23546 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
23547 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
23549 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 {
23550 C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
23554 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
23555 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
23557 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
23558 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
23559 /// A pointer to the contents in the success state.
23560 /// Reading from this pointer when `result_ok` is not set is undefined.
23561 pub result: *mut crate::lightning_invoice::PayeePubKey,
23562 /// A pointer to the contents in the error state.
23563 /// Reading from this pointer when `result_ok` is set is undefined.
23564 pub err: *mut crate::c_types::Secp256k1Error,
23567 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
23568 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
23569 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23570 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
23571 /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
23572 /// `err` or `result` depending on the state of `result_ok`.
23573 pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
23574 /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
23575 pub result_ok: bool,
23578 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
23579 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
23580 CResult_PayeePubKeySecp256k1ErrorZ {
23581 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23582 result: Box::into_raw(Box::new(o)),
23588 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
23589 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
23590 CResult_PayeePubKeySecp256k1ErrorZ {
23591 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23592 err: Box::into_raw(Box::new(e)),
23597 /// Checks if the given object is currently in the success state
23599 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
23603 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
23604 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
23605 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
23606 fn drop(&mut self) {
23607 if self.result_ok {
23608 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23609 let _ = unsafe { Box::from_raw(self.contents.result) };
23612 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23613 let _ = unsafe { Box::from_raw(self.contents.err) };
23618 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
23619 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
23620 let contents = if o.result_ok {
23621 let result = unsafe { o.contents.result };
23622 unsafe { o.contents.result = core::ptr::null_mut() };
23623 CResult_PayeePubKeySecp256k1ErrorZPtr { result }
23625 let err = unsafe { o.contents.err };
23626 unsafe { o.contents.err = core::ptr::null_mut(); }
23627 CResult_PayeePubKeySecp256k1ErrorZPtr { err }
23631 result_ok: o.result_ok,
23635 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
23636 fn clone(&self) -> Self {
23637 if self.result_ok {
23638 Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23639 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
23642 Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23643 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
23649 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
23650 /// but with all dynamically-allocated buffers duplicated in new buffers.
23651 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
23653 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
23654 /// This corresponds to std::vector in C++
23655 pub struct CVec_PrivateRouteZ {
23656 /// The elements in the array.
23657 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23658 pub data: *mut crate::lightning_invoice::PrivateRoute,
23659 /// The number of elements pointed to by `data`.
23662 impl CVec_PrivateRouteZ {
23663 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
23664 if self.datalen == 0 { return Vec::new(); }
23665 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23666 self.data = core::ptr::null_mut();
23670 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
23671 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23674 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
23675 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
23676 let datalen = v.len();
23677 let data = Box::into_raw(v.into_boxed_slice());
23678 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23682 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23683 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
23684 impl Drop for CVec_PrivateRouteZ {
23685 fn drop(&mut self) {
23686 if self.datalen == 0 { return; }
23687 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23690 impl Clone for CVec_PrivateRouteZ {
23691 fn clone(&self) -> Self {
23692 let mut res = Vec::new();
23693 if self.datalen == 0 { return Self::from(res); }
23694 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23699 /// The contents of CResult_PositiveTimestampCreationErrorZ
23700 pub union CResult_PositiveTimestampCreationErrorZPtr {
23701 /// A pointer to the contents in the success state.
23702 /// Reading from this pointer when `result_ok` is not set is undefined.
23703 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
23704 /// A pointer to the contents in the error state.
23705 /// Reading from this pointer when `result_ok` is set is undefined.
23706 pub err: *mut crate::lightning_invoice::CreationError,
23709 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
23710 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
23711 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23712 pub struct CResult_PositiveTimestampCreationErrorZ {
23713 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
23714 /// `err` or `result` depending on the state of `result_ok`.
23715 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
23716 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
23717 pub result_ok: bool,
23720 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
23721 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
23722 CResult_PositiveTimestampCreationErrorZ {
23723 contents: CResult_PositiveTimestampCreationErrorZPtr {
23724 result: Box::into_raw(Box::new(o)),
23730 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
23731 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
23732 CResult_PositiveTimestampCreationErrorZ {
23733 contents: CResult_PositiveTimestampCreationErrorZPtr {
23734 err: Box::into_raw(Box::new(e)),
23739 /// Checks if the given object is currently in the success state
23741 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
23745 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
23746 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
23747 impl Drop for CResult_PositiveTimestampCreationErrorZ {
23748 fn drop(&mut self) {
23749 if self.result_ok {
23750 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23751 let _ = unsafe { Box::from_raw(self.contents.result) };
23754 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23755 let _ = unsafe { Box::from_raw(self.contents.err) };
23760 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
23761 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
23762 let contents = if o.result_ok {
23763 let result = unsafe { o.contents.result };
23764 unsafe { o.contents.result = core::ptr::null_mut() };
23765 CResult_PositiveTimestampCreationErrorZPtr { result }
23767 let err = unsafe { o.contents.err };
23768 unsafe { o.contents.err = core::ptr::null_mut(); }
23769 CResult_PositiveTimestampCreationErrorZPtr { err }
23773 result_ok: o.result_ok,
23777 impl Clone for CResult_PositiveTimestampCreationErrorZ {
23778 fn clone(&self) -> Self {
23779 if self.result_ok {
23780 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
23781 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
23784 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
23785 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
23791 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
23792 /// but with all dynamically-allocated buffers duplicated in new buffers.
23793 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
23795 /// The contents of CResult_NoneBolt11SemanticErrorZ
23796 pub union CResult_NoneBolt11SemanticErrorZPtr {
23797 /// Note that this value is always NULL, as there are no contents in the OK variant
23798 pub result: *mut core::ffi::c_void,
23799 /// A pointer to the contents in the error state.
23800 /// Reading from this pointer when `result_ok` is set is undefined.
23801 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
23804 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
23805 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
23806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23807 pub struct CResult_NoneBolt11SemanticErrorZ {
23808 /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
23809 /// `err` or `result` depending on the state of `result_ok`.
23810 pub contents: CResult_NoneBolt11SemanticErrorZPtr,
23811 /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
23812 pub result_ok: bool,
23815 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
23816 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
23817 CResult_NoneBolt11SemanticErrorZ {
23818 contents: CResult_NoneBolt11SemanticErrorZPtr {
23819 result: core::ptr::null_mut(),
23825 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
23826 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
23827 CResult_NoneBolt11SemanticErrorZ {
23828 contents: CResult_NoneBolt11SemanticErrorZPtr {
23829 err: Box::into_raw(Box::new(e)),
23834 /// Checks if the given object is currently in the success state
23836 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
23840 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
23841 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
23842 impl Drop for CResult_NoneBolt11SemanticErrorZ {
23843 fn drop(&mut self) {
23844 if self.result_ok {
23846 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23847 let _ = unsafe { Box::from_raw(self.contents.err) };
23852 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
23853 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
23854 let contents = if o.result_ok {
23855 let _ = unsafe { Box::from_raw(o.contents.result) };
23856 o.contents.result = core::ptr::null_mut();
23857 CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
23859 let err = unsafe { o.contents.err };
23860 unsafe { o.contents.err = core::ptr::null_mut(); }
23861 CResult_NoneBolt11SemanticErrorZPtr { err }
23865 result_ok: o.result_ok,
23869 impl Clone for CResult_NoneBolt11SemanticErrorZ {
23870 fn clone(&self) -> Self {
23871 if self.result_ok {
23872 Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
23873 result: core::ptr::null_mut()
23876 Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
23877 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
23883 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
23884 /// but with all dynamically-allocated buffers duplicated in new buffers.
23885 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
23887 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
23888 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
23889 /// A pointer to the contents in the success state.
23890 /// Reading from this pointer when `result_ok` is not set is undefined.
23891 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
23892 /// A pointer to the contents in the error state.
23893 /// Reading from this pointer when `result_ok` is set is undefined.
23894 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
23897 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
23898 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
23899 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23900 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23901 /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
23902 /// `err` or `result` depending on the state of `result_ok`.
23903 pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
23904 /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
23905 pub result_ok: bool,
23908 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
23909 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23910 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23911 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
23912 result: Box::into_raw(Box::new(o)),
23918 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
23919 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23920 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23921 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
23922 err: Box::into_raw(Box::new(e)),
23927 /// Checks if the given object is currently in the success state
23929 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
23933 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
23934 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
23935 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23936 fn drop(&mut self) {
23937 if self.result_ok {
23938 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23939 let _ = unsafe { Box::from_raw(self.contents.result) };
23942 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23943 let _ = unsafe { Box::from_raw(self.contents.err) };
23948 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23949 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
23950 let contents = if o.result_ok {
23951 let result = unsafe { o.contents.result };
23952 unsafe { o.contents.result = core::ptr::null_mut() };
23953 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
23955 let err = unsafe { o.contents.err };
23956 unsafe { o.contents.err = core::ptr::null_mut(); }
23957 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
23961 result_ok: o.result_ok,
23965 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
23966 fn clone(&self) -> Self {
23967 if self.result_ok {
23968 Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
23969 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
23972 Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
23973 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
23979 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
23980 /// but with all dynamically-allocated buffers duplicated in new buffers.
23981 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
23983 /// The contents of CResult_DescriptionCreationErrorZ
23984 pub union CResult_DescriptionCreationErrorZPtr {
23985 /// A pointer to the contents in the success state.
23986 /// Reading from this pointer when `result_ok` is not set is undefined.
23987 pub result: *mut crate::lightning_invoice::Description,
23988 /// A pointer to the contents in the error state.
23989 /// Reading from this pointer when `result_ok` is set is undefined.
23990 pub err: *mut crate::lightning_invoice::CreationError,
23993 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
23994 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
23995 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23996 pub struct CResult_DescriptionCreationErrorZ {
23997 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
23998 /// `err` or `result` depending on the state of `result_ok`.
23999 pub contents: CResult_DescriptionCreationErrorZPtr,
24000 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
24001 pub result_ok: bool,
24004 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
24005 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
24006 CResult_DescriptionCreationErrorZ {
24007 contents: CResult_DescriptionCreationErrorZPtr {
24008 result: Box::into_raw(Box::new(o)),
24014 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
24015 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
24016 CResult_DescriptionCreationErrorZ {
24017 contents: CResult_DescriptionCreationErrorZPtr {
24018 err: Box::into_raw(Box::new(e)),
24023 /// Checks if the given object is currently in the success state
24025 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
24029 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
24030 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
24031 impl Drop for CResult_DescriptionCreationErrorZ {
24032 fn drop(&mut self) {
24033 if self.result_ok {
24034 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24035 let _ = unsafe { Box::from_raw(self.contents.result) };
24038 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24039 let _ = unsafe { Box::from_raw(self.contents.err) };
24044 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
24045 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
24046 let contents = if o.result_ok {
24047 let result = unsafe { o.contents.result };
24048 unsafe { o.contents.result = core::ptr::null_mut() };
24049 CResult_DescriptionCreationErrorZPtr { result }
24051 let err = unsafe { o.contents.err };
24052 unsafe { o.contents.err = core::ptr::null_mut(); }
24053 CResult_DescriptionCreationErrorZPtr { err }
24057 result_ok: o.result_ok,
24061 impl Clone for CResult_DescriptionCreationErrorZ {
24062 fn clone(&self) -> Self {
24063 if self.result_ok {
24064 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
24065 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
24068 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
24069 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24075 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
24076 /// but with all dynamically-allocated buffers duplicated in new buffers.
24077 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
24079 /// The contents of CResult_PrivateRouteCreationErrorZ
24080 pub union CResult_PrivateRouteCreationErrorZPtr {
24081 /// A pointer to the contents in the success state.
24082 /// Reading from this pointer when `result_ok` is not set is undefined.
24083 pub result: *mut crate::lightning_invoice::PrivateRoute,
24084 /// A pointer to the contents in the error state.
24085 /// Reading from this pointer when `result_ok` is set is undefined.
24086 pub err: *mut crate::lightning_invoice::CreationError,
24089 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
24090 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
24091 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24092 pub struct CResult_PrivateRouteCreationErrorZ {
24093 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
24094 /// `err` or `result` depending on the state of `result_ok`.
24095 pub contents: CResult_PrivateRouteCreationErrorZPtr,
24096 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
24097 pub result_ok: bool,
24100 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
24101 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
24102 CResult_PrivateRouteCreationErrorZ {
24103 contents: CResult_PrivateRouteCreationErrorZPtr {
24104 result: Box::into_raw(Box::new(o)),
24110 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
24111 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
24112 CResult_PrivateRouteCreationErrorZ {
24113 contents: CResult_PrivateRouteCreationErrorZPtr {
24114 err: Box::into_raw(Box::new(e)),
24119 /// Checks if the given object is currently in the success state
24121 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
24125 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
24126 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
24127 impl Drop for CResult_PrivateRouteCreationErrorZ {
24128 fn drop(&mut self) {
24129 if self.result_ok {
24130 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24131 let _ = unsafe { Box::from_raw(self.contents.result) };
24134 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24135 let _ = unsafe { Box::from_raw(self.contents.err) };
24140 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
24141 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
24142 let contents = if o.result_ok {
24143 let result = unsafe { o.contents.result };
24144 unsafe { o.contents.result = core::ptr::null_mut() };
24145 CResult_PrivateRouteCreationErrorZPtr { result }
24147 let err = unsafe { o.contents.err };
24148 unsafe { o.contents.err = core::ptr::null_mut(); }
24149 CResult_PrivateRouteCreationErrorZPtr { err }
24153 result_ok: o.result_ok,
24157 impl Clone for CResult_PrivateRouteCreationErrorZ {
24158 fn clone(&self) -> Self {
24159 if self.result_ok {
24160 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
24161 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
24164 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
24165 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24171 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
24172 /// but with all dynamically-allocated buffers duplicated in new buffers.
24173 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
24175 /// The contents of CResult_OutPointDecodeErrorZ
24176 pub union CResult_OutPointDecodeErrorZPtr {
24177 /// A pointer to the contents in the success state.
24178 /// Reading from this pointer when `result_ok` is not set is undefined.
24179 pub result: *mut crate::lightning::chain::transaction::OutPoint,
24180 /// A pointer to the contents in the error state.
24181 /// Reading from this pointer when `result_ok` is set is undefined.
24182 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24185 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
24186 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
24187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24188 pub struct CResult_OutPointDecodeErrorZ {
24189 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
24190 /// `err` or `result` depending on the state of `result_ok`.
24191 pub contents: CResult_OutPointDecodeErrorZPtr,
24192 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
24193 pub result_ok: bool,
24196 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
24197 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
24198 CResult_OutPointDecodeErrorZ {
24199 contents: CResult_OutPointDecodeErrorZPtr {
24200 result: Box::into_raw(Box::new(o)),
24206 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
24207 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
24208 CResult_OutPointDecodeErrorZ {
24209 contents: CResult_OutPointDecodeErrorZPtr {
24210 err: Box::into_raw(Box::new(e)),
24215 /// Checks if the given object is currently in the success state
24217 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
24221 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
24222 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
24223 impl Drop for CResult_OutPointDecodeErrorZ {
24224 fn drop(&mut self) {
24225 if self.result_ok {
24226 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24227 let _ = unsafe { Box::from_raw(self.contents.result) };
24230 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24231 let _ = unsafe { Box::from_raw(self.contents.err) };
24236 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
24237 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
24238 let contents = if o.result_ok {
24239 let result = unsafe { o.contents.result };
24240 unsafe { o.contents.result = core::ptr::null_mut() };
24241 CResult_OutPointDecodeErrorZPtr { result }
24243 let err = unsafe { o.contents.err };
24244 unsafe { o.contents.err = core::ptr::null_mut(); }
24245 CResult_OutPointDecodeErrorZPtr { err }
24249 result_ok: o.result_ok,
24253 impl Clone for CResult_OutPointDecodeErrorZ {
24254 fn clone(&self) -> Self {
24255 if self.result_ok {
24256 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
24257 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
24260 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
24261 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24267 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
24268 /// but with all dynamically-allocated buffers duplicated in new buffers.
24269 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
24271 /// The contents of CResult_BigSizeDecodeErrorZ
24272 pub union CResult_BigSizeDecodeErrorZPtr {
24273 /// A pointer to the contents in the success state.
24274 /// Reading from this pointer when `result_ok` is not set is undefined.
24275 pub result: *mut crate::lightning::util::ser::BigSize,
24276 /// A pointer to the contents in the error state.
24277 /// Reading from this pointer when `result_ok` is set is undefined.
24278 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24281 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
24282 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
24283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24284 pub struct CResult_BigSizeDecodeErrorZ {
24285 /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
24286 /// `err` or `result` depending on the state of `result_ok`.
24287 pub contents: CResult_BigSizeDecodeErrorZPtr,
24288 /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
24289 pub result_ok: bool,
24292 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
24293 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
24294 CResult_BigSizeDecodeErrorZ {
24295 contents: CResult_BigSizeDecodeErrorZPtr {
24296 result: Box::into_raw(Box::new(o)),
24302 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
24303 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
24304 CResult_BigSizeDecodeErrorZ {
24305 contents: CResult_BigSizeDecodeErrorZPtr {
24306 err: Box::into_raw(Box::new(e)),
24311 /// Checks if the given object is currently in the success state
24313 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
24317 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
24318 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
24319 impl Drop for CResult_BigSizeDecodeErrorZ {
24320 fn drop(&mut self) {
24321 if self.result_ok {
24322 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24323 let _ = unsafe { Box::from_raw(self.contents.result) };
24326 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24327 let _ = unsafe { Box::from_raw(self.contents.err) };
24332 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
24333 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
24334 let contents = if o.result_ok {
24335 let result = unsafe { o.contents.result };
24336 unsafe { o.contents.result = core::ptr::null_mut() };
24337 CResult_BigSizeDecodeErrorZPtr { result }
24339 let err = unsafe { o.contents.err };
24340 unsafe { o.contents.err = core::ptr::null_mut(); }
24341 CResult_BigSizeDecodeErrorZPtr { err }
24345 result_ok: o.result_ok,
24349 impl Clone for CResult_BigSizeDecodeErrorZ {
24350 fn clone(&self) -> Self {
24351 if self.result_ok {
24352 Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
24353 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
24356 Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
24357 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24363 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
24364 /// but with all dynamically-allocated buffers duplicated in new buffers.
24365 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
24367 /// The contents of CResult_HostnameDecodeErrorZ
24368 pub union CResult_HostnameDecodeErrorZPtr {
24369 /// A pointer to the contents in the success state.
24370 /// Reading from this pointer when `result_ok` is not set is undefined.
24371 pub result: *mut crate::lightning::util::ser::Hostname,
24372 /// A pointer to the contents in the error state.
24373 /// Reading from this pointer when `result_ok` is set is undefined.
24374 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24377 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
24378 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
24379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24380 pub struct CResult_HostnameDecodeErrorZ {
24381 /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
24382 /// `err` or `result` depending on the state of `result_ok`.
24383 pub contents: CResult_HostnameDecodeErrorZPtr,
24384 /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
24385 pub result_ok: bool,
24388 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
24389 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
24390 CResult_HostnameDecodeErrorZ {
24391 contents: CResult_HostnameDecodeErrorZPtr {
24392 result: Box::into_raw(Box::new(o)),
24398 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
24399 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
24400 CResult_HostnameDecodeErrorZ {
24401 contents: CResult_HostnameDecodeErrorZPtr {
24402 err: Box::into_raw(Box::new(e)),
24407 /// Checks if the given object is currently in the success state
24409 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
24413 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
24414 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
24415 impl Drop for CResult_HostnameDecodeErrorZ {
24416 fn drop(&mut self) {
24417 if self.result_ok {
24418 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24419 let _ = unsafe { Box::from_raw(self.contents.result) };
24422 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24423 let _ = unsafe { Box::from_raw(self.contents.err) };
24428 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
24429 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
24430 let contents = if o.result_ok {
24431 let result = unsafe { o.contents.result };
24432 unsafe { o.contents.result = core::ptr::null_mut() };
24433 CResult_HostnameDecodeErrorZPtr { result }
24435 let err = unsafe { o.contents.err };
24436 unsafe { o.contents.err = core::ptr::null_mut(); }
24437 CResult_HostnameDecodeErrorZPtr { err }
24441 result_ok: o.result_ok,
24445 impl Clone for CResult_HostnameDecodeErrorZ {
24446 fn clone(&self) -> Self {
24447 if self.result_ok {
24448 Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
24449 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
24452 Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
24453 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24459 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
24460 /// but with all dynamically-allocated buffers duplicated in new buffers.
24461 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
24463 /// The contents of CResult_TransactionU16LenLimitedNoneZ
24464 pub union CResult_TransactionU16LenLimitedNoneZPtr {
24465 /// A pointer to the contents in the success state.
24466 /// Reading from this pointer when `result_ok` is not set is undefined.
24467 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
24468 /// Note that this value is always NULL, as there are no contents in the Err variant
24469 pub err: *mut core::ffi::c_void,
24472 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
24473 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
24474 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24475 pub struct CResult_TransactionU16LenLimitedNoneZ {
24476 /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
24477 /// `err` or `result` depending on the state of `result_ok`.
24478 pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
24479 /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
24480 pub result_ok: bool,
24483 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
24484 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
24485 CResult_TransactionU16LenLimitedNoneZ {
24486 contents: CResult_TransactionU16LenLimitedNoneZPtr {
24487 result: Box::into_raw(Box::new(o)),
24493 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
24494 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
24495 CResult_TransactionU16LenLimitedNoneZ {
24496 contents: CResult_TransactionU16LenLimitedNoneZPtr {
24497 err: core::ptr::null_mut(),
24502 /// Checks if the given object is currently in the success state
24504 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
24508 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
24509 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
24510 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
24511 fn drop(&mut self) {
24512 if self.result_ok {
24513 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24514 let _ = unsafe { Box::from_raw(self.contents.result) };
24520 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
24521 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
24522 let contents = if o.result_ok {
24523 let result = unsafe { o.contents.result };
24524 unsafe { o.contents.result = core::ptr::null_mut() };
24525 CResult_TransactionU16LenLimitedNoneZPtr { result }
24527 let _ = unsafe { Box::from_raw(o.contents.err) };
24528 o.contents.err = core::ptr::null_mut();
24529 CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
24533 result_ok: o.result_ok,
24537 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
24538 fn clone(&self) -> Self {
24539 if self.result_ok {
24540 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
24541 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
24544 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
24545 err: core::ptr::null_mut()
24551 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
24552 /// but with all dynamically-allocated buffers duplicated in new buffers.
24553 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
24555 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
24556 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24557 /// A pointer to the contents in the success state.
24558 /// Reading from this pointer when `result_ok` is not set is undefined.
24559 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
24560 /// A pointer to the contents in the error state.
24561 /// Reading from this pointer when `result_ok` is set is undefined.
24562 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24565 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
24566 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
24567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24568 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
24569 /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
24570 /// `err` or `result` depending on the state of `result_ok`.
24571 pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
24572 /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
24573 pub result_ok: bool,
24576 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
24577 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
24578 CResult_TransactionU16LenLimitedDecodeErrorZ {
24579 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24580 result: Box::into_raw(Box::new(o)),
24586 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
24587 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
24588 CResult_TransactionU16LenLimitedDecodeErrorZ {
24589 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24590 err: Box::into_raw(Box::new(e)),
24595 /// Checks if the given object is currently in the success state
24597 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
24601 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
24602 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
24603 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
24604 fn drop(&mut self) {
24605 if self.result_ok {
24606 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24607 let _ = unsafe { Box::from_raw(self.contents.result) };
24610 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24611 let _ = unsafe { Box::from_raw(self.contents.err) };
24616 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
24617 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
24618 let contents = if o.result_ok {
24619 let result = unsafe { o.contents.result };
24620 unsafe { o.contents.result = core::ptr::null_mut() };
24621 CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
24623 let err = unsafe { o.contents.err };
24624 unsafe { o.contents.err = core::ptr::null_mut(); }
24625 CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
24629 result_ok: o.result_ok,
24633 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
24634 fn clone(&self) -> Self {
24635 if self.result_ok {
24636 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24637 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
24640 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24641 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24647 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
24648 /// but with all dynamically-allocated buffers duplicated in new buffers.
24649 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
24651 /// The contents of CResult_UntrustedStringDecodeErrorZ
24652 pub union CResult_UntrustedStringDecodeErrorZPtr {
24653 /// A pointer to the contents in the success state.
24654 /// Reading from this pointer when `result_ok` is not set is undefined.
24655 pub result: *mut crate::lightning::util::string::UntrustedString,
24656 /// A pointer to the contents in the error state.
24657 /// Reading from this pointer when `result_ok` is set is undefined.
24658 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24661 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
24662 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
24663 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24664 pub struct CResult_UntrustedStringDecodeErrorZ {
24665 /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
24666 /// `err` or `result` depending on the state of `result_ok`.
24667 pub contents: CResult_UntrustedStringDecodeErrorZPtr,
24668 /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
24669 pub result_ok: bool,
24672 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
24673 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
24674 CResult_UntrustedStringDecodeErrorZ {
24675 contents: CResult_UntrustedStringDecodeErrorZPtr {
24676 result: Box::into_raw(Box::new(o)),
24682 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
24683 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
24684 CResult_UntrustedStringDecodeErrorZ {
24685 contents: CResult_UntrustedStringDecodeErrorZPtr {
24686 err: Box::into_raw(Box::new(e)),
24691 /// Checks if the given object is currently in the success state
24693 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
24697 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
24698 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
24699 impl Drop for CResult_UntrustedStringDecodeErrorZ {
24700 fn drop(&mut self) {
24701 if self.result_ok {
24702 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24703 let _ = unsafe { Box::from_raw(self.contents.result) };
24706 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24707 let _ = unsafe { Box::from_raw(self.contents.err) };
24712 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
24713 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
24714 let contents = if o.result_ok {
24715 let result = unsafe { o.contents.result };
24716 unsafe { o.contents.result = core::ptr::null_mut() };
24717 CResult_UntrustedStringDecodeErrorZPtr { result }
24719 let err = unsafe { o.contents.err };
24720 unsafe { o.contents.err = core::ptr::null_mut(); }
24721 CResult_UntrustedStringDecodeErrorZPtr { err }
24725 result_ok: o.result_ok,
24729 impl Clone for CResult_UntrustedStringDecodeErrorZ {
24730 fn clone(&self) -> Self {
24731 if self.result_ok {
24732 Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
24733 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
24736 Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
24737 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24743 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
24744 /// but with all dynamically-allocated buffers duplicated in new buffers.
24745 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
24747 /// The contents of CResult_ChannelIdDecodeErrorZ
24748 pub union CResult_ChannelIdDecodeErrorZPtr {
24749 /// A pointer to the contents in the success state.
24750 /// Reading from this pointer when `result_ok` is not set is undefined.
24751 pub result: *mut crate::lightning::ln::types::ChannelId,
24752 /// A pointer to the contents in the error state.
24753 /// Reading from this pointer when `result_ok` is set is undefined.
24754 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24757 /// A CResult_ChannelIdDecodeErrorZ represents the result of a fallible operation,
24758 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::ln::msgs::DecodeError on failure.
24759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24760 pub struct CResult_ChannelIdDecodeErrorZ {
24761 /// The contents of this CResult_ChannelIdDecodeErrorZ, accessible via either
24762 /// `err` or `result` depending on the state of `result_ok`.
24763 pub contents: CResult_ChannelIdDecodeErrorZPtr,
24764 /// Whether this CResult_ChannelIdDecodeErrorZ represents a success state.
24765 pub result_ok: bool,
24768 /// Creates a new CResult_ChannelIdDecodeErrorZ in the success state.
24769 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdDecodeErrorZ {
24770 CResult_ChannelIdDecodeErrorZ {
24771 contents: CResult_ChannelIdDecodeErrorZPtr {
24772 result: Box::into_raw(Box::new(o)),
24778 /// Creates a new CResult_ChannelIdDecodeErrorZ in the error state.
24779 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelIdDecodeErrorZ {
24780 CResult_ChannelIdDecodeErrorZ {
24781 contents: CResult_ChannelIdDecodeErrorZPtr {
24782 err: Box::into_raw(Box::new(e)),
24787 /// Checks if the given object is currently in the success state
24789 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_is_ok(o: &CResult_ChannelIdDecodeErrorZ) -> bool {
24793 /// Frees any resources used by the CResult_ChannelIdDecodeErrorZ.
24794 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_free(_res: CResult_ChannelIdDecodeErrorZ) { }
24795 impl Drop for CResult_ChannelIdDecodeErrorZ {
24796 fn drop(&mut self) {
24797 if self.result_ok {
24798 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24799 let _ = unsafe { Box::from_raw(self.contents.result) };
24802 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24803 let _ = unsafe { Box::from_raw(self.contents.err) };
24808 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelIdDecodeErrorZ {
24809 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>) -> Self {
24810 let contents = if o.result_ok {
24811 let result = unsafe { o.contents.result };
24812 unsafe { o.contents.result = core::ptr::null_mut() };
24813 CResult_ChannelIdDecodeErrorZPtr { result }
24815 let err = unsafe { o.contents.err };
24816 unsafe { o.contents.err = core::ptr::null_mut(); }
24817 CResult_ChannelIdDecodeErrorZPtr { err }
24821 result_ok: o.result_ok,
24825 impl Clone for CResult_ChannelIdDecodeErrorZ {
24826 fn clone(&self) -> Self {
24827 if self.result_ok {
24828 Self { result_ok: true, contents: CResult_ChannelIdDecodeErrorZPtr {
24829 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
24832 Self { result_ok: false, contents: CResult_ChannelIdDecodeErrorZPtr {
24833 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24839 /// Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig`
24840 /// but with all dynamically-allocated buffers duplicated in new buffers.
24841 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_clone(orig: &CResult_ChannelIdDecodeErrorZ) -> CResult_ChannelIdDecodeErrorZ { Clone::clone(&orig) }
24843 /// A tuple of 2 elements. See the individual fields for the types contained.
24844 pub struct C2Tuple__u832u16Z {
24845 /// The element at position 0
24846 pub a: crate::c_types::ThirtyTwoBytes,
24847 /// The element at position 1
24850 impl From<(crate::c_types::ThirtyTwoBytes, u16)> for C2Tuple__u832u16Z {
24851 fn from (tup: (crate::c_types::ThirtyTwoBytes, u16)) -> Self {
24858 impl C2Tuple__u832u16Z {
24859 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u16) {
24863 impl Clone for C2Tuple__u832u16Z {
24864 fn clone(&self) -> Self {
24866 a: Clone::clone(&self.a),
24867 b: Clone::clone(&self.b),
24872 /// Creates a new tuple which has the same data as `orig`
24873 /// but with all dynamically-allocated buffers duplicated in new buffers.
24874 pub extern "C" fn C2Tuple__u832u16Z_clone(orig: &C2Tuple__u832u16Z) -> C2Tuple__u832u16Z { Clone::clone(&orig) }
24875 /// Creates a new C2Tuple__u832u16Z from the contained elements.
24877 pub extern "C" fn C2Tuple__u832u16Z_new(a: crate::c_types::ThirtyTwoBytes, b: u16) -> C2Tuple__u832u16Z {
24878 C2Tuple__u832u16Z { a, b, }
24882 /// Frees any resources used by the C2Tuple__u832u16Z.
24883 pub extern "C" fn C2Tuple__u832u16Z_free(_res: C2Tuple__u832u16Z) { }
24885 /// The contents of CResult_PaymentRelayDecodeErrorZ
24886 pub union CResult_PaymentRelayDecodeErrorZPtr {
24887 /// A pointer to the contents in the success state.
24888 /// Reading from this pointer when `result_ok` is not set is undefined.
24889 pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay,
24890 /// A pointer to the contents in the error state.
24891 /// Reading from this pointer when `result_ok` is set is undefined.
24892 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24895 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
24896 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
24897 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24898 pub struct CResult_PaymentRelayDecodeErrorZ {
24899 /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
24900 /// `err` or `result` depending on the state of `result_ok`.
24901 pub contents: CResult_PaymentRelayDecodeErrorZPtr,
24902 /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
24903 pub result_ok: bool,
24906 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
24907 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
24908 CResult_PaymentRelayDecodeErrorZ {
24909 contents: CResult_PaymentRelayDecodeErrorZPtr {
24910 result: Box::into_raw(Box::new(o)),
24916 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
24917 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
24918 CResult_PaymentRelayDecodeErrorZ {
24919 contents: CResult_PaymentRelayDecodeErrorZPtr {
24920 err: Box::into_raw(Box::new(e)),
24925 /// Checks if the given object is currently in the success state
24927 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
24931 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
24932 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
24933 impl Drop for CResult_PaymentRelayDecodeErrorZ {
24934 fn drop(&mut self) {
24935 if self.result_ok {
24936 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24937 let _ = unsafe { Box::from_raw(self.contents.result) };
24940 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24941 let _ = unsafe { Box::from_raw(self.contents.err) };
24946 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
24947 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> Self {
24948 let contents = if o.result_ok {
24949 let result = unsafe { o.contents.result };
24950 unsafe { o.contents.result = core::ptr::null_mut() };
24951 CResult_PaymentRelayDecodeErrorZPtr { result }
24953 let err = unsafe { o.contents.err };
24954 unsafe { o.contents.err = core::ptr::null_mut(); }
24955 CResult_PaymentRelayDecodeErrorZPtr { err }
24959 result_ok: o.result_ok,
24963 impl Clone for CResult_PaymentRelayDecodeErrorZ {
24964 fn clone(&self) -> Self {
24965 if self.result_ok {
24966 Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
24967 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
24970 Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
24971 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24977 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
24978 /// but with all dynamically-allocated buffers duplicated in new buffers.
24979 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
24981 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
24982 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
24983 /// A pointer to the contents in the success state.
24984 /// Reading from this pointer when `result_ok` is not set is undefined.
24985 pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
24986 /// A pointer to the contents in the error state.
24987 /// Reading from this pointer when `result_ok` is set is undefined.
24988 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24991 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
24992 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
24993 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24994 pub struct CResult_PaymentConstraintsDecodeErrorZ {
24995 /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
24996 /// `err` or `result` depending on the state of `result_ok`.
24997 pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
24998 /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
24999 pub result_ok: bool,
25002 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
25003 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
25004 CResult_PaymentConstraintsDecodeErrorZ {
25005 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25006 result: Box::into_raw(Box::new(o)),
25012 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
25013 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
25014 CResult_PaymentConstraintsDecodeErrorZ {
25015 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25016 err: Box::into_raw(Box::new(e)),
25021 /// Checks if the given object is currently in the success state
25023 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
25027 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
25028 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
25029 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
25030 fn drop(&mut self) {
25031 if self.result_ok {
25032 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25033 let _ = unsafe { Box::from_raw(self.contents.result) };
25036 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25037 let _ = unsafe { Box::from_raw(self.contents.err) };
25042 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
25043 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
25044 let contents = if o.result_ok {
25045 let result = unsafe { o.contents.result };
25046 unsafe { o.contents.result = core::ptr::null_mut() };
25047 CResult_PaymentConstraintsDecodeErrorZPtr { result }
25049 let err = unsafe { o.contents.err };
25050 unsafe { o.contents.err = core::ptr::null_mut(); }
25051 CResult_PaymentConstraintsDecodeErrorZPtr { err }
25055 result_ok: o.result_ok,
25059 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
25060 fn clone(&self) -> Self {
25061 if self.result_ok {
25062 Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25063 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
25066 Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25067 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25073 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
25074 /// but with all dynamically-allocated buffers duplicated in new buffers.
25075 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
25077 /// The contents of CResult_PaymentContextDecodeErrorZ
25078 pub union CResult_PaymentContextDecodeErrorZPtr {
25079 /// A pointer to the contents in the success state.
25080 /// Reading from this pointer when `result_ok` is not set is undefined.
25081 pub result: *mut crate::lightning::blinded_path::payment::PaymentContext,
25082 /// A pointer to the contents in the error state.
25083 /// Reading from this pointer when `result_ok` is set is undefined.
25084 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25087 /// A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation,
25088 /// containing a crate::lightning::blinded_path::payment::PaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25090 pub struct CResult_PaymentContextDecodeErrorZ {
25091 /// The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either
25092 /// `err` or `result` depending on the state of `result_ok`.
25093 pub contents: CResult_PaymentContextDecodeErrorZPtr,
25094 /// Whether this CResult_PaymentContextDecodeErrorZ represents a success state.
25095 pub result_ok: bool,
25098 /// Creates a new CResult_PaymentContextDecodeErrorZ in the success state.
25099 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentContext) -> CResult_PaymentContextDecodeErrorZ {
25100 CResult_PaymentContextDecodeErrorZ {
25101 contents: CResult_PaymentContextDecodeErrorZPtr {
25102 result: Box::into_raw(Box::new(o)),
25108 /// Creates a new CResult_PaymentContextDecodeErrorZ in the error state.
25109 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentContextDecodeErrorZ {
25110 CResult_PaymentContextDecodeErrorZ {
25111 contents: CResult_PaymentContextDecodeErrorZPtr {
25112 err: Box::into_raw(Box::new(e)),
25117 /// Checks if the given object is currently in the success state
25119 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_is_ok(o: &CResult_PaymentContextDecodeErrorZ) -> bool {
25123 /// Frees any resources used by the CResult_PaymentContextDecodeErrorZ.
25124 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_free(_res: CResult_PaymentContextDecodeErrorZ) { }
25125 impl Drop for CResult_PaymentContextDecodeErrorZ {
25126 fn drop(&mut self) {
25127 if self.result_ok {
25128 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25129 let _ = unsafe { Box::from_raw(self.contents.result) };
25132 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25133 let _ = unsafe { Box::from_raw(self.contents.err) };
25138 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentContextDecodeErrorZ {
25139 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25140 let contents = if o.result_ok {
25141 let result = unsafe { o.contents.result };
25142 unsafe { o.contents.result = core::ptr::null_mut() };
25143 CResult_PaymentContextDecodeErrorZPtr { result }
25145 let err = unsafe { o.contents.err };
25146 unsafe { o.contents.err = core::ptr::null_mut(); }
25147 CResult_PaymentContextDecodeErrorZPtr { err }
25151 result_ok: o.result_ok,
25155 impl Clone for CResult_PaymentContextDecodeErrorZ {
25156 fn clone(&self) -> Self {
25157 if self.result_ok {
25158 Self { result_ok: true, contents: CResult_PaymentContextDecodeErrorZPtr {
25159 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentContext>::clone(unsafe { &*self.contents.result })))
25162 Self { result_ok: false, contents: CResult_PaymentContextDecodeErrorZPtr {
25163 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25169 /// Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig`
25170 /// but with all dynamically-allocated buffers duplicated in new buffers.
25171 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_clone(orig: &CResult_PaymentContextDecodeErrorZ) -> CResult_PaymentContextDecodeErrorZ { Clone::clone(&orig) }
25173 /// The contents of CResult_UnknownPaymentContextDecodeErrorZ
25174 pub union CResult_UnknownPaymentContextDecodeErrorZPtr {
25175 /// A pointer to the contents in the success state.
25176 /// Reading from this pointer when `result_ok` is not set is undefined.
25177 pub result: *mut crate::lightning::blinded_path::payment::UnknownPaymentContext,
25178 /// A pointer to the contents in the error state.
25179 /// Reading from this pointer when `result_ok` is set is undefined.
25180 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25183 /// A CResult_UnknownPaymentContextDecodeErrorZ represents the result of a fallible operation,
25184 /// containing a crate::lightning::blinded_path::payment::UnknownPaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25186 pub struct CResult_UnknownPaymentContextDecodeErrorZ {
25187 /// The contents of this CResult_UnknownPaymentContextDecodeErrorZ, accessible via either
25188 /// `err` or `result` depending on the state of `result_ok`.
25189 pub contents: CResult_UnknownPaymentContextDecodeErrorZPtr,
25190 /// Whether this CResult_UnknownPaymentContextDecodeErrorZ represents a success state.
25191 pub result_ok: bool,
25194 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the success state.
25195 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::UnknownPaymentContext) -> CResult_UnknownPaymentContextDecodeErrorZ {
25196 CResult_UnknownPaymentContextDecodeErrorZ {
25197 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25198 result: Box::into_raw(Box::new(o)),
25204 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the error state.
25205 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnknownPaymentContextDecodeErrorZ {
25206 CResult_UnknownPaymentContextDecodeErrorZ {
25207 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25208 err: Box::into_raw(Box::new(e)),
25213 /// Checks if the given object is currently in the success state
25215 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o: &CResult_UnknownPaymentContextDecodeErrorZ) -> bool {
25219 /// Frees any resources used by the CResult_UnknownPaymentContextDecodeErrorZ.
25220 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_free(_res: CResult_UnknownPaymentContextDecodeErrorZ) { }
25221 impl Drop for CResult_UnknownPaymentContextDecodeErrorZ {
25222 fn drop(&mut self) {
25223 if self.result_ok {
25224 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25225 let _ = unsafe { Box::from_raw(self.contents.result) };
25228 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25229 let _ = unsafe { Box::from_raw(self.contents.err) };
25234 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_UnknownPaymentContextDecodeErrorZ {
25235 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25236 let contents = if o.result_ok {
25237 let result = unsafe { o.contents.result };
25238 unsafe { o.contents.result = core::ptr::null_mut() };
25239 CResult_UnknownPaymentContextDecodeErrorZPtr { result }
25241 let err = unsafe { o.contents.err };
25242 unsafe { o.contents.err = core::ptr::null_mut(); }
25243 CResult_UnknownPaymentContextDecodeErrorZPtr { err }
25247 result_ok: o.result_ok,
25251 impl Clone for CResult_UnknownPaymentContextDecodeErrorZ {
25252 fn clone(&self) -> Self {
25253 if self.result_ok {
25254 Self { result_ok: true, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25255 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::UnknownPaymentContext>::clone(unsafe { &*self.contents.result })))
25258 Self { result_ok: false, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25259 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25265 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ which has the same data as `orig`
25266 /// but with all dynamically-allocated buffers duplicated in new buffers.
25267 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_clone(orig: &CResult_UnknownPaymentContextDecodeErrorZ) -> CResult_UnknownPaymentContextDecodeErrorZ { Clone::clone(&orig) }
25269 /// The contents of CResult_Bolt12OfferContextDecodeErrorZ
25270 pub union CResult_Bolt12OfferContextDecodeErrorZPtr {
25271 /// A pointer to the contents in the success state.
25272 /// Reading from this pointer when `result_ok` is not set is undefined.
25273 pub result: *mut crate::lightning::blinded_path::payment::Bolt12OfferContext,
25274 /// A pointer to the contents in the error state.
25275 /// Reading from this pointer when `result_ok` is set is undefined.
25276 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25279 /// A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation,
25280 /// containing a crate::lightning::blinded_path::payment::Bolt12OfferContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25281 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25282 pub struct CResult_Bolt12OfferContextDecodeErrorZ {
25283 /// The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either
25284 /// `err` or `result` depending on the state of `result_ok`.
25285 pub contents: CResult_Bolt12OfferContextDecodeErrorZPtr,
25286 /// Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state.
25287 pub result_ok: bool,
25290 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state.
25291 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12OfferContext) -> CResult_Bolt12OfferContextDecodeErrorZ {
25292 CResult_Bolt12OfferContextDecodeErrorZ {
25293 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25294 result: Box::into_raw(Box::new(o)),
25300 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state.
25301 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12OfferContextDecodeErrorZ {
25302 CResult_Bolt12OfferContextDecodeErrorZ {
25303 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25304 err: Box::into_raw(Box::new(e)),
25309 /// Checks if the given object is currently in the success state
25311 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o: &CResult_Bolt12OfferContextDecodeErrorZ) -> bool {
25315 /// Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ.
25316 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_free(_res: CResult_Bolt12OfferContextDecodeErrorZ) { }
25317 impl Drop for CResult_Bolt12OfferContextDecodeErrorZ {
25318 fn drop(&mut self) {
25319 if self.result_ok {
25320 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25321 let _ = unsafe { Box::from_raw(self.contents.result) };
25324 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25325 let _ = unsafe { Box::from_raw(self.contents.err) };
25330 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12OfferContextDecodeErrorZ {
25331 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25332 let contents = if o.result_ok {
25333 let result = unsafe { o.contents.result };
25334 unsafe { o.contents.result = core::ptr::null_mut() };
25335 CResult_Bolt12OfferContextDecodeErrorZPtr { result }
25337 let err = unsafe { o.contents.err };
25338 unsafe { o.contents.err = core::ptr::null_mut(); }
25339 CResult_Bolt12OfferContextDecodeErrorZPtr { err }
25343 result_ok: o.result_ok,
25347 impl Clone for CResult_Bolt12OfferContextDecodeErrorZ {
25348 fn clone(&self) -> Self {
25349 if self.result_ok {
25350 Self { result_ok: true, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25351 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12OfferContext>::clone(unsafe { &*self.contents.result })))
25354 Self { result_ok: false, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25355 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25361 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ which has the same data as `orig`
25362 /// but with all dynamically-allocated buffers duplicated in new buffers.
25363 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_clone(orig: &CResult_Bolt12OfferContextDecodeErrorZ) -> CResult_Bolt12OfferContextDecodeErrorZ { Clone::clone(&orig) }
25365 /// The contents of CResult_Bolt12RefundContextDecodeErrorZ
25366 pub union CResult_Bolt12RefundContextDecodeErrorZPtr {
25367 /// A pointer to the contents in the success state.
25368 /// Reading from this pointer when `result_ok` is not set is undefined.
25369 pub result: *mut crate::lightning::blinded_path::payment::Bolt12RefundContext,
25370 /// A pointer to the contents in the error state.
25371 /// Reading from this pointer when `result_ok` is set is undefined.
25372 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25375 /// A CResult_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation,
25376 /// containing a crate::lightning::blinded_path::payment::Bolt12RefundContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25378 pub struct CResult_Bolt12RefundContextDecodeErrorZ {
25379 /// The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either
25380 /// `err` or `result` depending on the state of `result_ok`.
25381 pub contents: CResult_Bolt12RefundContextDecodeErrorZPtr,
25382 /// Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state.
25383 pub result_ok: bool,
25386 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state.
25387 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12RefundContext) -> CResult_Bolt12RefundContextDecodeErrorZ {
25388 CResult_Bolt12RefundContextDecodeErrorZ {
25389 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25390 result: Box::into_raw(Box::new(o)),
25396 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state.
25397 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12RefundContextDecodeErrorZ {
25398 CResult_Bolt12RefundContextDecodeErrorZ {
25399 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25400 err: Box::into_raw(Box::new(e)),
25405 /// Checks if the given object is currently in the success state
25407 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o: &CResult_Bolt12RefundContextDecodeErrorZ) -> bool {
25411 /// Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ.
25412 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_free(_res: CResult_Bolt12RefundContextDecodeErrorZ) { }
25413 impl Drop for CResult_Bolt12RefundContextDecodeErrorZ {
25414 fn drop(&mut self) {
25415 if self.result_ok {
25416 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25417 let _ = unsafe { Box::from_raw(self.contents.result) };
25420 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25421 let _ = unsafe { Box::from_raw(self.contents.err) };
25426 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12RefundContextDecodeErrorZ {
25427 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25428 let contents = if o.result_ok {
25429 let result = unsafe { o.contents.result };
25430 unsafe { o.contents.result = core::ptr::null_mut() };
25431 CResult_Bolt12RefundContextDecodeErrorZPtr { result }
25433 let err = unsafe { o.contents.err };
25434 unsafe { o.contents.err = core::ptr::null_mut(); }
25435 CResult_Bolt12RefundContextDecodeErrorZPtr { err }
25439 result_ok: o.result_ok,
25443 impl Clone for CResult_Bolt12RefundContextDecodeErrorZ {
25444 fn clone(&self) -> Self {
25445 if self.result_ok {
25446 Self { result_ok: true, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25447 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12RefundContext>::clone(unsafe { &*self.contents.result })))
25450 Self { result_ok: false, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25451 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25457 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig`
25458 /// but with all dynamically-allocated buffers duplicated in new buffers.
25459 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_clone(orig: &CResult_Bolt12RefundContextDecodeErrorZ) -> CResult_Bolt12RefundContextDecodeErrorZ { Clone::clone(&orig) }
25461 /// The contents of CResult_StrSecp256k1ErrorZ
25462 pub union CResult_StrSecp256k1ErrorZPtr {
25463 /// A pointer to the contents in the success state.
25464 /// Reading from this pointer when `result_ok` is not set is undefined.
25465 pub result: *mut crate::c_types::Str,
25466 /// A pointer to the contents in the error state.
25467 /// Reading from this pointer when `result_ok` is set is undefined.
25468 pub err: *mut crate::c_types::Secp256k1Error,
25471 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
25472 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
25473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25474 pub struct CResult_StrSecp256k1ErrorZ {
25475 /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
25476 /// `err` or `result` depending on the state of `result_ok`.
25477 pub contents: CResult_StrSecp256k1ErrorZPtr,
25478 /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
25479 pub result_ok: bool,
25482 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
25483 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
25484 CResult_StrSecp256k1ErrorZ {
25485 contents: CResult_StrSecp256k1ErrorZPtr {
25486 result: Box::into_raw(Box::new(o)),
25492 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
25493 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
25494 CResult_StrSecp256k1ErrorZ {
25495 contents: CResult_StrSecp256k1ErrorZPtr {
25496 err: Box::into_raw(Box::new(e)),
25501 /// Checks if the given object is currently in the success state
25503 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
25507 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
25508 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
25509 impl Drop for CResult_StrSecp256k1ErrorZ {
25510 fn drop(&mut self) {
25511 if self.result_ok {
25512 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25513 let _ = unsafe { Box::from_raw(self.contents.result) };
25516 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25517 let _ = unsafe { Box::from_raw(self.contents.err) };
25522 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
25523 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
25524 let contents = if o.result_ok {
25525 let result = unsafe { o.contents.result };
25526 unsafe { o.contents.result = core::ptr::null_mut() };
25527 CResult_StrSecp256k1ErrorZPtr { result }
25529 let err = unsafe { o.contents.err };
25530 unsafe { o.contents.err = core::ptr::null_mut(); }
25531 CResult_StrSecp256k1ErrorZPtr { err }
25535 result_ok: o.result_ok,
25539 impl Clone for CResult_StrSecp256k1ErrorZ {
25540 fn clone(&self) -> Self {
25541 if self.result_ok {
25542 Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
25543 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
25546 Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
25547 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
25553 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
25554 /// but with all dynamically-allocated buffers duplicated in new buffers.
25555 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
25557 /// A tuple of 3 elements. See the individual fields for the types contained.
25558 pub struct C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25559 /// The element at position 0
25560 pub a: crate::c_types::ThirtyTwoBytes,
25561 /// The element at position 1
25562 pub b: crate::lightning::ln::outbound_payment::RecipientOnionFields,
25563 /// The element at position 2
25564 pub c: crate::lightning::routing::router::RouteParameters,
25566 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)> for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25567 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)) -> Self {
25575 impl C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25576 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters) {
25577 (self.a, self.b, self.c)
25580 impl Clone for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25581 fn clone(&self) -> Self {
25583 a: Clone::clone(&self.a),
25584 b: Clone::clone(&self.b),
25585 c: Clone::clone(&self.c),
25590 /// Creates a new tuple which has the same data as `orig`
25591 /// but with all dynamically-allocated buffers duplicated in new buffers.
25592 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig: &C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { Clone::clone(&orig) }
25593 /// Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements.
25595 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::outbound_payment::RecipientOnionFields, c: crate::lightning::routing::router::RouteParameters) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25596 C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { a, b, c, }
25600 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ.
25601 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res: C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) { }
25603 /// The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ
25604 pub union CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25605 /// A pointer to the contents in the success state.
25606 /// Reading from this pointer when `result_ok` is not set is undefined.
25607 pub result: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ,
25608 /// Note that this value is always NULL, as there are no contents in the Err variant
25609 pub err: *mut core::ffi::c_void,
25612 /// A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation,
25613 /// containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure.
25614 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25615 pub struct CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25616 /// The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either
25617 /// `err` or `result` depending on the state of `result_ok`.
25618 pub contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr,
25619 /// Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state.
25620 pub result_ok: bool,
25623 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state.
25624 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o: crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25625 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25626 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25627 result: Box::into_raw(Box::new(o)),
25633 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state.
25634 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25635 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25636 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25637 err: core::ptr::null_mut(),
25642 /// Checks if the given object is currently in the success state
25644 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> bool {
25648 /// Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.
25649 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) { }
25650 impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25651 fn drop(&mut self) {
25652 if self.result_ok {
25653 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25654 let _ = unsafe { Box::from_raw(self.contents.result) };
25660 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>> for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25661 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>) -> Self {
25662 let contents = if o.result_ok {
25663 let result = unsafe { o.contents.result };
25664 unsafe { o.contents.result = core::ptr::null_mut() };
25665 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { result }
25667 let _ = unsafe { Box::from_raw(o.contents.err) };
25668 o.contents.err = core::ptr::null_mut();
25669 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { err: core::ptr::null_mut() }
25673 result_ok: o.result_ok,
25677 impl Clone for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25678 fn clone(&self) -> Self {
25679 if self.result_ok {
25680 Self { result_ok: true, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25681 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ>::clone(unsafe { &*self.contents.result })))
25684 Self { result_ok: false, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25685 err: core::ptr::null_mut()
25691 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig`
25692 /// but with all dynamically-allocated buffers duplicated in new buffers.
25693 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { Clone::clone(&orig) }
25695 /// The contents of CResult_TxOutUtxoLookupErrorZ
25696 pub union CResult_TxOutUtxoLookupErrorZPtr {
25697 /// A pointer to the contents in the success state.
25698 /// Reading from this pointer when `result_ok` is not set is undefined.
25699 pub result: *mut crate::c_types::TxOut,
25700 /// A pointer to the contents in the error state.
25701 /// Reading from this pointer when `result_ok` is set is undefined.
25702 pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
25705 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
25706 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
25707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25708 pub struct CResult_TxOutUtxoLookupErrorZ {
25709 /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
25710 /// `err` or `result` depending on the state of `result_ok`.
25711 pub contents: CResult_TxOutUtxoLookupErrorZPtr,
25712 /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
25713 pub result_ok: bool,
25716 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
25717 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
25718 CResult_TxOutUtxoLookupErrorZ {
25719 contents: CResult_TxOutUtxoLookupErrorZPtr {
25720 result: Box::into_raw(Box::new(o)),
25726 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
25727 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
25728 CResult_TxOutUtxoLookupErrorZ {
25729 contents: CResult_TxOutUtxoLookupErrorZPtr {
25730 err: Box::into_raw(Box::new(e)),
25735 /// Checks if the given object is currently in the success state
25737 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
25741 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
25742 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
25743 impl Drop for CResult_TxOutUtxoLookupErrorZ {
25744 fn drop(&mut self) {
25745 if self.result_ok {
25746 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25747 let _ = unsafe { Box::from_raw(self.contents.result) };
25750 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25751 let _ = unsafe { Box::from_raw(self.contents.err) };
25756 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
25757 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
25758 let contents = if o.result_ok {
25759 let result = unsafe { o.contents.result };
25760 unsafe { o.contents.result = core::ptr::null_mut() };
25761 CResult_TxOutUtxoLookupErrorZPtr { result }
25763 let err = unsafe { o.contents.err };
25764 unsafe { o.contents.err = core::ptr::null_mut(); }
25765 CResult_TxOutUtxoLookupErrorZPtr { err }
25769 result_ok: o.result_ok,
25773 impl Clone for CResult_TxOutUtxoLookupErrorZ {
25774 fn clone(&self) -> Self {
25775 if self.result_ok {
25776 Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
25777 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
25780 Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
25781 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
25787 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
25788 /// but with all dynamically-allocated buffers duplicated in new buffers.
25789 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
25791 /// A tuple of 3 elements. See the individual fields for the types contained.
25792 pub struct C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
25793 /// The element at position 0
25794 pub a: crate::c_types::PublicKey,
25795 /// The element at position 1
25796 pub b: crate::lightning::ln::msgs::OnionMessage,
25797 /// The element at position 2
25798 pub c: crate::c_types::derived::COption_CVec_SocketAddressZZ,
25800 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)> for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
25801 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)) -> Self {
25809 impl C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
25810 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ) {
25811 (self.a, self.b, self.c)
25814 impl Clone for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
25815 fn clone(&self) -> Self {
25817 a: Clone::clone(&self.a),
25818 b: Clone::clone(&self.b),
25819 c: Clone::clone(&self.c),
25824 /// Creates a new tuple which has the same data as `orig`
25825 /// but with all dynamically-allocated buffers duplicated in new buffers.
25826 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig: &C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { Clone::clone(&orig) }
25827 /// Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements.
25829 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::msgs::OnionMessage, c: crate::c_types::derived::COption_CVec_SocketAddressZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
25830 C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { a, b, c, }
25834 /// Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ.
25835 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res: C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) { }
25837 /// The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ
25838 pub union CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
25839 /// A pointer to the contents in the success state.
25840 /// Reading from this pointer when `result_ok` is not set is undefined.
25841 pub result: *mut crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ,
25842 /// A pointer to the contents in the error state.
25843 /// Reading from this pointer when `result_ok` is set is undefined.
25844 pub err: *mut crate::lightning::onion_message::messenger::SendError,
25847 /// A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation,
25848 /// containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
25849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25850 pub struct CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25851 /// The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either
25852 /// `err` or `result` depending on the state of `result_ok`.
25853 pub contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr,
25854 /// Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state.
25855 pub result_ok: bool,
25858 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state.
25859 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o: crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25860 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25861 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
25862 result: Box::into_raw(Box::new(o)),
25868 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state.
25869 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25870 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25871 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
25872 err: Box::into_raw(Box::new(e)),
25877 /// Checks if the given object is currently in the success state
25879 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> bool {
25883 /// Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.
25884 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) { }
25885 impl Drop for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25886 fn drop(&mut self) {
25887 if self.result_ok {
25888 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25889 let _ = unsafe { Box::from_raw(self.contents.result) };
25892 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25893 let _ = unsafe { Box::from_raw(self.contents.err) };
25898 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>> for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25899 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
25900 let contents = if o.result_ok {
25901 let result = unsafe { o.contents.result };
25902 unsafe { o.contents.result = core::ptr::null_mut() };
25903 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { result }
25905 let err = unsafe { o.contents.err };
25906 unsafe { o.contents.err = core::ptr::null_mut(); }
25907 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { err }
25911 result_ok: o.result_ok,
25915 impl Clone for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
25916 fn clone(&self) -> Self {
25917 if self.result_ok {
25918 Self { result_ok: true, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
25919 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ>::clone(unsafe { &*self.contents.result })))
25922 Self { result_ok: false, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
25923 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
25929 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ which has the same data as `orig`
25930 /// but with all dynamically-allocated buffers duplicated in new buffers.
25931 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { Clone::clone(&orig) }
25933 /// The contents of CResult_PeeledOnionNoneZ
25934 pub union CResult_PeeledOnionNoneZPtr {
25935 /// A pointer to the contents in the success state.
25936 /// Reading from this pointer when `result_ok` is not set is undefined.
25937 pub result: *mut crate::lightning::onion_message::messenger::PeeledOnion,
25938 /// Note that this value is always NULL, as there are no contents in the Err variant
25939 pub err: *mut core::ffi::c_void,
25942 /// A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
25943 /// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
25944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25945 pub struct CResult_PeeledOnionNoneZ {
25946 /// The contents of this CResult_PeeledOnionNoneZ, accessible via either
25947 /// `err` or `result` depending on the state of `result_ok`.
25948 pub contents: CResult_PeeledOnionNoneZPtr,
25949 /// Whether this CResult_PeeledOnionNoneZ represents a success state.
25950 pub result_ok: bool,
25953 /// Creates a new CResult_PeeledOnionNoneZ in the success state.
25954 pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ {
25955 CResult_PeeledOnionNoneZ {
25956 contents: CResult_PeeledOnionNoneZPtr {
25957 result: Box::into_raw(Box::new(o)),
25963 /// Creates a new CResult_PeeledOnionNoneZ in the error state.
25964 pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ {
25965 CResult_PeeledOnionNoneZ {
25966 contents: CResult_PeeledOnionNoneZPtr {
25967 err: core::ptr::null_mut(),
25972 /// Checks if the given object is currently in the success state
25974 pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool {
25978 /// Frees any resources used by the CResult_PeeledOnionNoneZ.
25979 pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { }
25980 impl Drop for CResult_PeeledOnionNoneZ {
25981 fn drop(&mut self) {
25982 if self.result_ok {
25983 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25984 let _ = unsafe { Box::from_raw(self.contents.result) };
25990 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>> for CResult_PeeledOnionNoneZ {
25991 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>) -> Self {
25992 let contents = if o.result_ok {
25993 let result = unsafe { o.contents.result };
25994 unsafe { o.contents.result = core::ptr::null_mut() };
25995 CResult_PeeledOnionNoneZPtr { result }
25997 let _ = unsafe { Box::from_raw(o.contents.err) };
25998 o.contents.err = core::ptr::null_mut();
25999 CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() }
26003 result_ok: o.result_ok,
26007 impl Clone for CResult_PeeledOnionNoneZ {
26008 fn clone(&self) -> Self {
26009 if self.result_ok {
26010 Self { result_ok: true, contents: CResult_PeeledOnionNoneZPtr {
26011 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::PeeledOnion>::clone(unsafe { &*self.contents.result })))
26014 Self { result_ok: false, contents: CResult_PeeledOnionNoneZPtr {
26015 err: core::ptr::null_mut()
26021 /// Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig`
26022 /// but with all dynamically-allocated buffers duplicated in new buffers.
26023 pub extern "C" fn CResult_PeeledOnionNoneZ_clone(orig: &CResult_PeeledOnionNoneZ) -> CResult_PeeledOnionNoneZ { Clone::clone(&orig) }
26025 /// The contents of CResult_SendSuccessSendErrorZ
26026 pub union CResult_SendSuccessSendErrorZPtr {
26027 /// A pointer to the contents in the success state.
26028 /// Reading from this pointer when `result_ok` is not set is undefined.
26029 pub result: *mut crate::lightning::onion_message::messenger::SendSuccess,
26030 /// A pointer to the contents in the error state.
26031 /// Reading from this pointer when `result_ok` is set is undefined.
26032 pub err: *mut crate::lightning::onion_message::messenger::SendError,
26035 /// A CResult_SendSuccessSendErrorZ represents the result of a fallible operation,
26036 /// containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure.
26037 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26038 pub struct CResult_SendSuccessSendErrorZ {
26039 /// The contents of this CResult_SendSuccessSendErrorZ, accessible via either
26040 /// `err` or `result` depending on the state of `result_ok`.
26041 pub contents: CResult_SendSuccessSendErrorZPtr,
26042 /// Whether this CResult_SendSuccessSendErrorZ represents a success state.
26043 pub result_ok: bool,
26046 /// Creates a new CResult_SendSuccessSendErrorZ in the success state.
26047 pub extern "C" fn CResult_SendSuccessSendErrorZ_ok(o: crate::lightning::onion_message::messenger::SendSuccess) -> CResult_SendSuccessSendErrorZ {
26048 CResult_SendSuccessSendErrorZ {
26049 contents: CResult_SendSuccessSendErrorZPtr {
26050 result: Box::into_raw(Box::new(o)),
26056 /// Creates a new CResult_SendSuccessSendErrorZ in the error state.
26057 pub extern "C" fn CResult_SendSuccessSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_SendSuccessSendErrorZ {
26058 CResult_SendSuccessSendErrorZ {
26059 contents: CResult_SendSuccessSendErrorZPtr {
26060 err: Box::into_raw(Box::new(e)),
26065 /// Checks if the given object is currently in the success state
26067 pub extern "C" fn CResult_SendSuccessSendErrorZ_is_ok(o: &CResult_SendSuccessSendErrorZ) -> bool {
26071 /// Frees any resources used by the CResult_SendSuccessSendErrorZ.
26072 pub extern "C" fn CResult_SendSuccessSendErrorZ_free(_res: CResult_SendSuccessSendErrorZ) { }
26073 impl Drop for CResult_SendSuccessSendErrorZ {
26074 fn drop(&mut self) {
26075 if self.result_ok {
26076 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26077 let _ = unsafe { Box::from_raw(self.contents.result) };
26080 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26081 let _ = unsafe { Box::from_raw(self.contents.err) };
26086 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>> for CResult_SendSuccessSendErrorZ {
26087 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>) -> Self {
26088 let contents = if o.result_ok {
26089 let result = unsafe { o.contents.result };
26090 unsafe { o.contents.result = core::ptr::null_mut() };
26091 CResult_SendSuccessSendErrorZPtr { result }
26093 let err = unsafe { o.contents.err };
26094 unsafe { o.contents.err = core::ptr::null_mut(); }
26095 CResult_SendSuccessSendErrorZPtr { err }
26099 result_ok: o.result_ok,
26103 impl Clone for CResult_SendSuccessSendErrorZ {
26104 fn clone(&self) -> Self {
26105 if self.result_ok {
26106 Self { result_ok: true, contents: CResult_SendSuccessSendErrorZPtr {
26107 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendSuccess>::clone(unsafe { &*self.contents.result })))
26110 Self { result_ok: false, contents: CResult_SendSuccessSendErrorZPtr {
26111 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
26117 /// Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig`
26118 /// but with all dynamically-allocated buffers duplicated in new buffers.
26119 pub extern "C" fn CResult_SendSuccessSendErrorZ_clone(orig: &CResult_SendSuccessSendErrorZ) -> CResult_SendSuccessSendErrorZ { Clone::clone(&orig) }
26121 /// The contents of CResult_BlindedPathNoneZ
26122 pub union CResult_BlindedPathNoneZPtr {
26123 /// A pointer to the contents in the success state.
26124 /// Reading from this pointer when `result_ok` is not set is undefined.
26125 pub result: *mut crate::lightning::blinded_path::BlindedPath,
26126 /// Note that this value is always NULL, as there are no contents in the Err variant
26127 pub err: *mut core::ffi::c_void,
26130 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
26131 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
26132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26133 pub struct CResult_BlindedPathNoneZ {
26134 /// The contents of this CResult_BlindedPathNoneZ, accessible via either
26135 /// `err` or `result` depending on the state of `result_ok`.
26136 pub contents: CResult_BlindedPathNoneZPtr,
26137 /// Whether this CResult_BlindedPathNoneZ represents a success state.
26138 pub result_ok: bool,
26141 /// Creates a new CResult_BlindedPathNoneZ in the success state.
26142 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
26143 CResult_BlindedPathNoneZ {
26144 contents: CResult_BlindedPathNoneZPtr {
26145 result: Box::into_raw(Box::new(o)),
26151 /// Creates a new CResult_BlindedPathNoneZ in the error state.
26152 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
26153 CResult_BlindedPathNoneZ {
26154 contents: CResult_BlindedPathNoneZPtr {
26155 err: core::ptr::null_mut(),
26160 /// Checks if the given object is currently in the success state
26162 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
26166 /// Frees any resources used by the CResult_BlindedPathNoneZ.
26167 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
26168 impl Drop for CResult_BlindedPathNoneZ {
26169 fn drop(&mut self) {
26170 if self.result_ok {
26171 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26172 let _ = unsafe { Box::from_raw(self.contents.result) };
26178 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
26179 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
26180 let contents = if o.result_ok {
26181 let result = unsafe { o.contents.result };
26182 unsafe { o.contents.result = core::ptr::null_mut() };
26183 CResult_BlindedPathNoneZPtr { result }
26185 let _ = unsafe { Box::from_raw(o.contents.err) };
26186 o.contents.err = core::ptr::null_mut();
26187 CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
26191 result_ok: o.result_ok,
26195 impl Clone for CResult_BlindedPathNoneZ {
26196 fn clone(&self) -> Self {
26197 if self.result_ok {
26198 Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
26199 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
26202 Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
26203 err: core::ptr::null_mut()
26209 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
26210 /// but with all dynamically-allocated buffers duplicated in new buffers.
26211 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
26213 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
26214 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26215 /// A pointer to the contents in the success state.
26216 /// Reading from this pointer when `result_ok` is not set is undefined.
26217 pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
26218 /// Note that this value is always NULL, as there are no contents in the Err variant
26219 pub err: *mut core::ffi::c_void,
26222 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
26223 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
26224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26225 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26226 /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
26227 /// `err` or `result` depending on the state of `result_ok`.
26228 pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
26229 /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
26230 pub result_ok: bool,
26233 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
26234 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26235 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26236 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26237 result: Box::into_raw(Box::new(o)),
26243 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
26244 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26245 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26246 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26247 err: core::ptr::null_mut(),
26252 /// Checks if the given object is currently in the success state
26254 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
26258 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
26259 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
26260 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26261 fn drop(&mut self) {
26262 if self.result_ok {
26263 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26264 let _ = unsafe { Box::from_raw(self.contents.result) };
26270 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26271 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
26272 let contents = if o.result_ok {
26273 let result = unsafe { o.contents.result };
26274 unsafe { o.contents.result = core::ptr::null_mut() };
26275 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
26277 let _ = unsafe { Box::from_raw(o.contents.err) };
26278 o.contents.err = core::ptr::null_mut();
26279 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
26283 result_ok: o.result_ok,
26287 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26288 fn clone(&self) -> Self {
26289 if self.result_ok {
26290 Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26291 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
26294 Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26295 err: core::ptr::null_mut()
26301 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
26302 /// but with all dynamically-allocated buffers duplicated in new buffers.
26303 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
26305 /// A dynamically-allocated array of crate::lightning::blinded_path::payment::ForwardNodes of arbitrary size.
26306 /// This corresponds to std::vector in C++
26307 pub struct CVec_ForwardNodeZ {
26308 /// The elements in the array.
26309 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
26310 pub data: *mut crate::lightning::blinded_path::payment::ForwardNode,
26311 /// The number of elements pointed to by `data`.
26314 impl CVec_ForwardNodeZ {
26315 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::payment::ForwardNode> {
26316 if self.datalen == 0 { return Vec::new(); }
26317 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
26318 self.data = core::ptr::null_mut();
26322 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::payment::ForwardNode] {
26323 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
26326 impl From<Vec<crate::lightning::blinded_path::payment::ForwardNode>> for CVec_ForwardNodeZ {
26327 fn from(v: Vec<crate::lightning::blinded_path::payment::ForwardNode>) -> Self {
26328 let datalen = v.len();
26329 let data = Box::into_raw(v.into_boxed_slice());
26330 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
26334 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
26335 pub extern "C" fn CVec_ForwardNodeZ_free(_res: CVec_ForwardNodeZ) { }
26336 impl Drop for CVec_ForwardNodeZ {
26337 fn drop(&mut self) {
26338 if self.datalen == 0 { return; }
26339 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
26342 impl Clone for CVec_ForwardNodeZ {
26343 fn clone(&self) -> Self {
26344 let mut res = Vec::new();
26345 if self.datalen == 0 { return Self::from(res); }
26346 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
26351 /// The contents of CResult_BlindedPathDecodeErrorZ
26352 pub union CResult_BlindedPathDecodeErrorZPtr {
26353 /// A pointer to the contents in the success state.
26354 /// Reading from this pointer when `result_ok` is not set is undefined.
26355 pub result: *mut crate::lightning::blinded_path::BlindedPath,
26356 /// A pointer to the contents in the error state.
26357 /// Reading from this pointer when `result_ok` is set is undefined.
26358 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26361 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
26362 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
26363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26364 pub struct CResult_BlindedPathDecodeErrorZ {
26365 /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
26366 /// `err` or `result` depending on the state of `result_ok`.
26367 pub contents: CResult_BlindedPathDecodeErrorZPtr,
26368 /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
26369 pub result_ok: bool,
26372 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
26373 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
26374 CResult_BlindedPathDecodeErrorZ {
26375 contents: CResult_BlindedPathDecodeErrorZPtr {
26376 result: Box::into_raw(Box::new(o)),
26382 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
26383 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
26384 CResult_BlindedPathDecodeErrorZ {
26385 contents: CResult_BlindedPathDecodeErrorZPtr {
26386 err: Box::into_raw(Box::new(e)),
26391 /// Checks if the given object is currently in the success state
26393 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
26397 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
26398 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
26399 impl Drop for CResult_BlindedPathDecodeErrorZ {
26400 fn drop(&mut self) {
26401 if self.result_ok {
26402 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26403 let _ = unsafe { Box::from_raw(self.contents.result) };
26406 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26407 let _ = unsafe { Box::from_raw(self.contents.err) };
26412 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
26413 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
26414 let contents = if o.result_ok {
26415 let result = unsafe { o.contents.result };
26416 unsafe { o.contents.result = core::ptr::null_mut() };
26417 CResult_BlindedPathDecodeErrorZPtr { result }
26419 let err = unsafe { o.contents.err };
26420 unsafe { o.contents.err = core::ptr::null_mut(); }
26421 CResult_BlindedPathDecodeErrorZPtr { err }
26425 result_ok: o.result_ok,
26429 impl Clone for CResult_BlindedPathDecodeErrorZ {
26430 fn clone(&self) -> Self {
26431 if self.result_ok {
26432 Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
26433 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
26436 Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
26437 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26443 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
26444 /// but with all dynamically-allocated buffers duplicated in new buffers.
26445 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
26447 /// The contents of CResult_BlindedHopDecodeErrorZ
26448 pub union CResult_BlindedHopDecodeErrorZPtr {
26449 /// A pointer to the contents in the success state.
26450 /// Reading from this pointer when `result_ok` is not set is undefined.
26451 pub result: *mut crate::lightning::blinded_path::BlindedHop,
26452 /// A pointer to the contents in the error state.
26453 /// Reading from this pointer when `result_ok` is set is undefined.
26454 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26457 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
26458 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
26459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26460 pub struct CResult_BlindedHopDecodeErrorZ {
26461 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
26462 /// `err` or `result` depending on the state of `result_ok`.
26463 pub contents: CResult_BlindedHopDecodeErrorZPtr,
26464 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
26465 pub result_ok: bool,
26468 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
26469 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
26470 CResult_BlindedHopDecodeErrorZ {
26471 contents: CResult_BlindedHopDecodeErrorZPtr {
26472 result: Box::into_raw(Box::new(o)),
26478 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
26479 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
26480 CResult_BlindedHopDecodeErrorZ {
26481 contents: CResult_BlindedHopDecodeErrorZPtr {
26482 err: Box::into_raw(Box::new(e)),
26487 /// Checks if the given object is currently in the success state
26489 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
26493 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
26494 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
26495 impl Drop for CResult_BlindedHopDecodeErrorZ {
26496 fn drop(&mut self) {
26497 if self.result_ok {
26498 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26499 let _ = unsafe { Box::from_raw(self.contents.result) };
26502 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26503 let _ = unsafe { Box::from_raw(self.contents.err) };
26508 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
26509 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
26510 let contents = if o.result_ok {
26511 let result = unsafe { o.contents.result };
26512 unsafe { o.contents.result = core::ptr::null_mut() };
26513 CResult_BlindedHopDecodeErrorZPtr { result }
26515 let err = unsafe { o.contents.err };
26516 unsafe { o.contents.err = core::ptr::null_mut(); }
26517 CResult_BlindedHopDecodeErrorZPtr { err }
26521 result_ok: o.result_ok,
26525 impl Clone for CResult_BlindedHopDecodeErrorZ {
26526 fn clone(&self) -> Self {
26527 if self.result_ok {
26528 Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
26529 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
26532 Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
26533 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26539 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
26540 /// but with all dynamically-allocated buffers duplicated in new buffers.
26541 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
26543 /// The contents of CResult_InvoiceErrorDecodeErrorZ
26544 pub union CResult_InvoiceErrorDecodeErrorZPtr {
26545 /// A pointer to the contents in the success state.
26546 /// Reading from this pointer when `result_ok` is not set is undefined.
26547 pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
26548 /// A pointer to the contents in the error state.
26549 /// Reading from this pointer when `result_ok` is set is undefined.
26550 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26553 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
26554 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
26555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26556 pub struct CResult_InvoiceErrorDecodeErrorZ {
26557 /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
26558 /// `err` or `result` depending on the state of `result_ok`.
26559 pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
26560 /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
26561 pub result_ok: bool,
26564 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
26565 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
26566 CResult_InvoiceErrorDecodeErrorZ {
26567 contents: CResult_InvoiceErrorDecodeErrorZPtr {
26568 result: Box::into_raw(Box::new(o)),
26574 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
26575 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
26576 CResult_InvoiceErrorDecodeErrorZ {
26577 contents: CResult_InvoiceErrorDecodeErrorZPtr {
26578 err: Box::into_raw(Box::new(e)),
26583 /// Checks if the given object is currently in the success state
26585 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
26589 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
26590 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
26591 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
26592 fn drop(&mut self) {
26593 if self.result_ok {
26594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26595 let _ = unsafe { Box::from_raw(self.contents.result) };
26598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26599 let _ = unsafe { Box::from_raw(self.contents.err) };
26604 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
26605 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
26606 let contents = if o.result_ok {
26607 let result = unsafe { o.contents.result };
26608 unsafe { o.contents.result = core::ptr::null_mut() };
26609 CResult_InvoiceErrorDecodeErrorZPtr { result }
26611 let err = unsafe { o.contents.err };
26612 unsafe { o.contents.err = core::ptr::null_mut(); }
26613 CResult_InvoiceErrorDecodeErrorZPtr { err }
26617 result_ok: o.result_ok,
26621 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
26622 fn clone(&self) -> Self {
26623 if self.result_ok {
26624 Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
26625 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
26628 Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
26629 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26635 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
26636 /// but with all dynamically-allocated buffers duplicated in new buffers.
26637 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
26639 /// The contents of CResult_TrackedSpendableOutputDecodeErrorZ
26640 pub union CResult_TrackedSpendableOutputDecodeErrorZPtr {
26641 /// A pointer to the contents in the success state.
26642 /// Reading from this pointer when `result_ok` is not set is undefined.
26643 pub result: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
26644 /// A pointer to the contents in the error state.
26645 /// Reading from this pointer when `result_ok` is set is undefined.
26646 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26649 /// A CResult_TrackedSpendableOutputDecodeErrorZ represents the result of a fallible operation,
26650 /// containing a crate::lightning::util::sweep::TrackedSpendableOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
26651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26652 pub struct CResult_TrackedSpendableOutputDecodeErrorZ {
26653 /// The contents of this CResult_TrackedSpendableOutputDecodeErrorZ, accessible via either
26654 /// `err` or `result` depending on the state of `result_ok`.
26655 pub contents: CResult_TrackedSpendableOutputDecodeErrorZPtr,
26656 /// Whether this CResult_TrackedSpendableOutputDecodeErrorZ represents a success state.
26657 pub result_ok: bool,
26660 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the success state.
26661 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_ok(o: crate::lightning::util::sweep::TrackedSpendableOutput) -> CResult_TrackedSpendableOutputDecodeErrorZ {
26662 CResult_TrackedSpendableOutputDecodeErrorZ {
26663 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26664 result: Box::into_raw(Box::new(o)),
26670 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the error state.
26671 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TrackedSpendableOutputDecodeErrorZ {
26672 CResult_TrackedSpendableOutputDecodeErrorZ {
26673 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26674 err: Box::into_raw(Box::new(e)),
26679 /// Checks if the given object is currently in the success state
26681 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o: &CResult_TrackedSpendableOutputDecodeErrorZ) -> bool {
26685 /// Frees any resources used by the CResult_TrackedSpendableOutputDecodeErrorZ.
26686 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_free(_res: CResult_TrackedSpendableOutputDecodeErrorZ) { }
26687 impl Drop for CResult_TrackedSpendableOutputDecodeErrorZ {
26688 fn drop(&mut self) {
26689 if self.result_ok {
26690 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26691 let _ = unsafe { Box::from_raw(self.contents.result) };
26694 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26695 let _ = unsafe { Box::from_raw(self.contents.err) };
26700 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TrackedSpendableOutputDecodeErrorZ {
26701 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
26702 let contents = if o.result_ok {
26703 let result = unsafe { o.contents.result };
26704 unsafe { o.contents.result = core::ptr::null_mut() };
26705 CResult_TrackedSpendableOutputDecodeErrorZPtr { result }
26707 let err = unsafe { o.contents.err };
26708 unsafe { o.contents.err = core::ptr::null_mut(); }
26709 CResult_TrackedSpendableOutputDecodeErrorZPtr { err }
26713 result_ok: o.result_ok,
26717 impl Clone for CResult_TrackedSpendableOutputDecodeErrorZ {
26718 fn clone(&self) -> Self {
26719 if self.result_ok {
26720 Self { result_ok: true, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26721 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::TrackedSpendableOutput>::clone(unsafe { &*self.contents.result })))
26724 Self { result_ok: false, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26725 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26731 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ which has the same data as `orig`
26732 /// but with all dynamically-allocated buffers duplicated in new buffers.
26733 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig: &CResult_TrackedSpendableOutputDecodeErrorZ) -> CResult_TrackedSpendableOutputDecodeErrorZ { Clone::clone(&orig) }
26735 /// The contents of CResult_OutputSpendStatusDecodeErrorZ
26736 pub union CResult_OutputSpendStatusDecodeErrorZPtr {
26737 /// A pointer to the contents in the success state.
26738 /// Reading from this pointer when `result_ok` is not set is undefined.
26739 pub result: *mut crate::lightning::util::sweep::OutputSpendStatus,
26740 /// A pointer to the contents in the error state.
26741 /// Reading from this pointer when `result_ok` is set is undefined.
26742 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26745 /// A CResult_OutputSpendStatusDecodeErrorZ represents the result of a fallible operation,
26746 /// containing a crate::lightning::util::sweep::OutputSpendStatus on success and a crate::lightning::ln::msgs::DecodeError on failure.
26747 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26748 pub struct CResult_OutputSpendStatusDecodeErrorZ {
26749 /// The contents of this CResult_OutputSpendStatusDecodeErrorZ, accessible via either
26750 /// `err` or `result` depending on the state of `result_ok`.
26751 pub contents: CResult_OutputSpendStatusDecodeErrorZPtr,
26752 /// Whether this CResult_OutputSpendStatusDecodeErrorZ represents a success state.
26753 pub result_ok: bool,
26756 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the success state.
26757 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSpendStatus) -> CResult_OutputSpendStatusDecodeErrorZ {
26758 CResult_OutputSpendStatusDecodeErrorZ {
26759 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
26760 result: Box::into_raw(Box::new(o)),
26766 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the error state.
26767 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSpendStatusDecodeErrorZ {
26768 CResult_OutputSpendStatusDecodeErrorZ {
26769 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
26770 err: Box::into_raw(Box::new(e)),
26775 /// Checks if the given object is currently in the success state
26777 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_is_ok(o: &CResult_OutputSpendStatusDecodeErrorZ) -> bool {
26781 /// Frees any resources used by the CResult_OutputSpendStatusDecodeErrorZ.
26782 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_free(_res: CResult_OutputSpendStatusDecodeErrorZ) { }
26783 impl Drop for CResult_OutputSpendStatusDecodeErrorZ {
26784 fn drop(&mut self) {
26785 if self.result_ok {
26786 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26787 let _ = unsafe { Box::from_raw(self.contents.result) };
26790 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26791 let _ = unsafe { Box::from_raw(self.contents.err) };
26796 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSpendStatusDecodeErrorZ {
26797 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>) -> Self {
26798 let contents = if o.result_ok {
26799 let result = unsafe { o.contents.result };
26800 unsafe { o.contents.result = core::ptr::null_mut() };
26801 CResult_OutputSpendStatusDecodeErrorZPtr { result }
26803 let err = unsafe { o.contents.err };
26804 unsafe { o.contents.err = core::ptr::null_mut(); }
26805 CResult_OutputSpendStatusDecodeErrorZPtr { err }
26809 result_ok: o.result_ok,
26813 impl Clone for CResult_OutputSpendStatusDecodeErrorZ {
26814 fn clone(&self) -> Self {
26815 if self.result_ok {
26816 Self { result_ok: true, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
26817 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::OutputSpendStatus>::clone(unsafe { &*self.contents.result })))
26820 Self { result_ok: false, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
26821 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26827 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ which has the same data as `orig`
26828 /// but with all dynamically-allocated buffers duplicated in new buffers.
26829 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_clone(orig: &CResult_OutputSpendStatusDecodeErrorZ) -> CResult_OutputSpendStatusDecodeErrorZ { Clone::clone(&orig) }
26831 /// An enum which can either contain a crate::lightning::chain::Filter or not
26832 pub enum COption_FilterZ {
26833 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
26834 Some(crate::lightning::chain::Filter),
26835 /// When we're in this state, this COption_FilterZ contains nothing
26838 impl COption_FilterZ {
26839 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
26840 if let Self::None = self { false } else { true }
26842 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
26845 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
26846 if let Self::Some(v) = self { v } else { unreachable!() }
26850 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
26851 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
26852 COption_FilterZ::Some(o)
26855 /// Constructs a new COption_FilterZ containing nothing
26856 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
26857 COption_FilterZ::None
26860 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
26861 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
26863 /// A dynamically-allocated array of crate::lightning::util::sweep::TrackedSpendableOutputs of arbitrary size.
26864 /// This corresponds to std::vector in C++
26865 pub struct CVec_TrackedSpendableOutputZ {
26866 /// The elements in the array.
26867 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
26868 pub data: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
26869 /// The number of elements pointed to by `data`.
26872 impl CVec_TrackedSpendableOutputZ {
26873 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::sweep::TrackedSpendableOutput> {
26874 if self.datalen == 0 { return Vec::new(); }
26875 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
26876 self.data = core::ptr::null_mut();
26880 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::sweep::TrackedSpendableOutput] {
26881 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
26884 impl From<Vec<crate::lightning::util::sweep::TrackedSpendableOutput>> for CVec_TrackedSpendableOutputZ {
26885 fn from(v: Vec<crate::lightning::util::sweep::TrackedSpendableOutput>) -> Self {
26886 let datalen = v.len();
26887 let data = Box::into_raw(v.into_boxed_slice());
26888 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
26892 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
26893 pub extern "C" fn CVec_TrackedSpendableOutputZ_free(_res: CVec_TrackedSpendableOutputZ) { }
26894 impl Drop for CVec_TrackedSpendableOutputZ {
26895 fn drop(&mut self) {
26896 if self.datalen == 0 { return; }
26897 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
26900 impl Clone for CVec_TrackedSpendableOutputZ {
26901 fn clone(&self) -> Self {
26902 let mut res = Vec::new();
26903 if self.datalen == 0 { return Self::from(res); }
26904 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
26909 /// The contents of CResult_OutputSweeperDecodeErrorZ
26910 pub union CResult_OutputSweeperDecodeErrorZPtr {
26911 /// A pointer to the contents in the success state.
26912 /// Reading from this pointer when `result_ok` is not set is undefined.
26913 pub result: *mut crate::lightning::util::sweep::OutputSweeper,
26914 /// A pointer to the contents in the error state.
26915 /// Reading from this pointer when `result_ok` is set is undefined.
26916 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26919 /// A CResult_OutputSweeperDecodeErrorZ represents the result of a fallible operation,
26920 /// containing a crate::lightning::util::sweep::OutputSweeper on success and a crate::lightning::ln::msgs::DecodeError on failure.
26921 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26922 pub struct CResult_OutputSweeperDecodeErrorZ {
26923 /// The contents of this CResult_OutputSweeperDecodeErrorZ, accessible via either
26924 /// `err` or `result` depending on the state of `result_ok`.
26925 pub contents: CResult_OutputSweeperDecodeErrorZPtr,
26926 /// Whether this CResult_OutputSweeperDecodeErrorZ represents a success state.
26927 pub result_ok: bool,
26930 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the success state.
26931 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSweeper) -> CResult_OutputSweeperDecodeErrorZ {
26932 CResult_OutputSweeperDecodeErrorZ {
26933 contents: CResult_OutputSweeperDecodeErrorZPtr {
26934 result: Box::into_raw(Box::new(o)),
26940 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the error state.
26941 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSweeperDecodeErrorZ {
26942 CResult_OutputSweeperDecodeErrorZ {
26943 contents: CResult_OutputSweeperDecodeErrorZPtr {
26944 err: Box::into_raw(Box::new(e)),
26949 /// Checks if the given object is currently in the success state
26951 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_is_ok(o: &CResult_OutputSweeperDecodeErrorZ) -> bool {
26955 /// Frees any resources used by the CResult_OutputSweeperDecodeErrorZ.
26956 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_free(_res: CResult_OutputSweeperDecodeErrorZ) { }
26957 impl Drop for CResult_OutputSweeperDecodeErrorZ {
26958 fn drop(&mut self) {
26959 if self.result_ok {
26960 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26961 let _ = unsafe { Box::from_raw(self.contents.result) };
26964 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26965 let _ = unsafe { Box::from_raw(self.contents.err) };
26970 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSweeperDecodeErrorZ {
26971 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>) -> Self {
26972 let contents = if o.result_ok {
26973 let result = unsafe { o.contents.result };
26974 unsafe { o.contents.result = core::ptr::null_mut() };
26975 CResult_OutputSweeperDecodeErrorZPtr { result }
26977 let err = unsafe { o.contents.err };
26978 unsafe { o.contents.err = core::ptr::null_mut(); }
26979 CResult_OutputSweeperDecodeErrorZPtr { err }
26983 result_ok: o.result_ok,
26988 /// A tuple of 2 elements. See the individual fields for the types contained.
26989 pub struct C2Tuple_BestBlockOutputSweeperZ {
26990 /// The element at position 0
26991 pub a: crate::lightning::chain::BestBlock,
26992 /// The element at position 1
26993 pub b: crate::lightning::util::sweep::OutputSweeper,
26995 impl From<(crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)> for C2Tuple_BestBlockOutputSweeperZ {
26996 fn from (tup: (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)) -> Self {
27003 impl C2Tuple_BestBlockOutputSweeperZ {
27004 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper) {
27008 /// Creates a new C2Tuple_BestBlockOutputSweeperZ from the contained elements.
27010 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_new(a: crate::lightning::chain::BestBlock, b: crate::lightning::util::sweep::OutputSweeper) -> C2Tuple_BestBlockOutputSweeperZ {
27011 C2Tuple_BestBlockOutputSweeperZ { a, b, }
27015 /// Frees any resources used by the C2Tuple_BestBlockOutputSweeperZ.
27016 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_free(_res: C2Tuple_BestBlockOutputSweeperZ) { }
27018 /// The contents of CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ
27019 pub union CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27020 /// A pointer to the contents in the success state.
27021 /// Reading from this pointer when `result_ok` is not set is undefined.
27022 pub result: *mut crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ,
27023 /// A pointer to the contents in the error state.
27024 /// Reading from this pointer when `result_ok` is set is undefined.
27025 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27028 /// A CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents the result of a fallible operation,
27029 /// containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
27030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27031 pub struct CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27032 /// The contents of this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ, accessible via either
27033 /// `err` or `result` depending on the state of `result_ok`.
27034 pub contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr,
27035 /// Whether this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents a success state.
27036 pub result_ok: bool,
27039 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the success state.
27040 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27041 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27042 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27043 result: Box::into_raw(Box::new(o)),
27049 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the error state.
27050 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27051 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27052 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27053 err: Box::into_raw(Box::new(e)),
27058 /// Checks if the given object is currently in the success state
27060 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) -> bool {
27064 /// Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ.
27065 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) { }
27066 impl Drop for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27067 fn drop(&mut self) {
27068 if self.result_ok {
27069 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27070 let _ = unsafe { Box::from_raw(self.contents.result) };
27073 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27074 let _ = unsafe { Box::from_raw(self.contents.err) };
27079 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27080 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
27081 let contents = if o.result_ok {
27082 let result = unsafe { o.contents.result };
27083 unsafe { o.contents.result = core::ptr::null_mut() };
27084 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { result }
27086 let err = unsafe { o.contents.err };
27087 unsafe { o.contents.err = core::ptr::null_mut(); }
27088 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { err }
27092 result_ok: o.result_ok,
27097 /// The contents of CResult_DelayedPaymentBasepointDecodeErrorZ
27098 pub union CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27099 /// A pointer to the contents in the success state.
27100 /// Reading from this pointer when `result_ok` is not set is undefined.
27101 pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentBasepoint,
27102 /// A pointer to the contents in the error state.
27103 /// Reading from this pointer when `result_ok` is set is undefined.
27104 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27107 /// A CResult_DelayedPaymentBasepointDecodeErrorZ represents the result of a fallible operation,
27108 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27110 pub struct CResult_DelayedPaymentBasepointDecodeErrorZ {
27111 /// The contents of this CResult_DelayedPaymentBasepointDecodeErrorZ, accessible via either
27112 /// `err` or `result` depending on the state of `result_ok`.
27113 pub contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr,
27114 /// Whether this CResult_DelayedPaymentBasepointDecodeErrorZ represents a success state.
27115 pub result_ok: bool,
27118 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state.
27119 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentBasepoint) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
27120 CResult_DelayedPaymentBasepointDecodeErrorZ {
27121 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27122 result: Box::into_raw(Box::new(o)),
27128 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state.
27129 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
27130 CResult_DelayedPaymentBasepointDecodeErrorZ {
27131 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27132 err: Box::into_raw(Box::new(e)),
27137 /// Checks if the given object is currently in the success state
27139 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> bool {
27143 /// Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ.
27144 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res: CResult_DelayedPaymentBasepointDecodeErrorZ) { }
27145 impl Drop for CResult_DelayedPaymentBasepointDecodeErrorZ {
27146 fn drop(&mut self) {
27147 if self.result_ok {
27148 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27149 let _ = unsafe { Box::from_raw(self.contents.result) };
27152 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27153 let _ = unsafe { Box::from_raw(self.contents.err) };
27158 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentBasepointDecodeErrorZ {
27159 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27160 let contents = if o.result_ok {
27161 let result = unsafe { o.contents.result };
27162 unsafe { o.contents.result = core::ptr::null_mut() };
27163 CResult_DelayedPaymentBasepointDecodeErrorZPtr { result }
27165 let err = unsafe { o.contents.err };
27166 unsafe { o.contents.err = core::ptr::null_mut(); }
27167 CResult_DelayedPaymentBasepointDecodeErrorZPtr { err }
27171 result_ok: o.result_ok,
27175 impl Clone for CResult_DelayedPaymentBasepointDecodeErrorZ {
27176 fn clone(&self) -> Self {
27177 if self.result_ok {
27178 Self { result_ok: true, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27179 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint>::clone(unsafe { &*self.contents.result })))
27182 Self { result_ok: false, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27183 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27189 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig`
27190 /// but with all dynamically-allocated buffers duplicated in new buffers.
27191 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> CResult_DelayedPaymentBasepointDecodeErrorZ { Clone::clone(&orig) }
27193 /// The contents of CResult_DelayedPaymentKeyDecodeErrorZ
27194 pub union CResult_DelayedPaymentKeyDecodeErrorZPtr {
27195 /// A pointer to the contents in the success state.
27196 /// Reading from this pointer when `result_ok` is not set is undefined.
27197 pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentKey,
27198 /// A pointer to the contents in the error state.
27199 /// Reading from this pointer when `result_ok` is set is undefined.
27200 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27203 /// A CResult_DelayedPaymentKeyDecodeErrorZ represents the result of a fallible operation,
27204 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27206 pub struct CResult_DelayedPaymentKeyDecodeErrorZ {
27207 /// The contents of this CResult_DelayedPaymentKeyDecodeErrorZ, accessible via either
27208 /// `err` or `result` depending on the state of `result_ok`.
27209 pub contents: CResult_DelayedPaymentKeyDecodeErrorZPtr,
27210 /// Whether this CResult_DelayedPaymentKeyDecodeErrorZ represents a success state.
27211 pub result_ok: bool,
27214 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state.
27215 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentKey) -> CResult_DelayedPaymentKeyDecodeErrorZ {
27216 CResult_DelayedPaymentKeyDecodeErrorZ {
27217 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27218 result: Box::into_raw(Box::new(o)),
27224 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state.
27225 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentKeyDecodeErrorZ {
27226 CResult_DelayedPaymentKeyDecodeErrorZ {
27227 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27228 err: Box::into_raw(Box::new(e)),
27233 /// Checks if the given object is currently in the success state
27235 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentKeyDecodeErrorZ) -> bool {
27239 /// Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ.
27240 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_free(_res: CResult_DelayedPaymentKeyDecodeErrorZ) { }
27241 impl Drop for CResult_DelayedPaymentKeyDecodeErrorZ {
27242 fn drop(&mut self) {
27243 if self.result_ok {
27244 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27245 let _ = unsafe { Box::from_raw(self.contents.result) };
27248 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27249 let _ = unsafe { Box::from_raw(self.contents.err) };
27254 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentKeyDecodeErrorZ {
27255 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27256 let contents = if o.result_ok {
27257 let result = unsafe { o.contents.result };
27258 unsafe { o.contents.result = core::ptr::null_mut() };
27259 CResult_DelayedPaymentKeyDecodeErrorZPtr { result }
27261 let err = unsafe { o.contents.err };
27262 unsafe { o.contents.err = core::ptr::null_mut(); }
27263 CResult_DelayedPaymentKeyDecodeErrorZPtr { err }
27267 result_ok: o.result_ok,
27271 impl Clone for CResult_DelayedPaymentKeyDecodeErrorZ {
27272 fn clone(&self) -> Self {
27273 if self.result_ok {
27274 Self { result_ok: true, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27275 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentKey>::clone(unsafe { &*self.contents.result })))
27278 Self { result_ok: false, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27279 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27285 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig`
27286 /// but with all dynamically-allocated buffers duplicated in new buffers.
27287 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig: &CResult_DelayedPaymentKeyDecodeErrorZ) -> CResult_DelayedPaymentKeyDecodeErrorZ { Clone::clone(&orig) }
27289 /// The contents of CResult_HtlcBasepointDecodeErrorZ
27290 pub union CResult_HtlcBasepointDecodeErrorZPtr {
27291 /// A pointer to the contents in the success state.
27292 /// Reading from this pointer when `result_ok` is not set is undefined.
27293 pub result: *mut crate::lightning::ln::channel_keys::HtlcBasepoint,
27294 /// A pointer to the contents in the error state.
27295 /// Reading from this pointer when `result_ok` is set is undefined.
27296 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27299 /// A CResult_HtlcBasepointDecodeErrorZ represents the result of a fallible operation,
27300 /// containing a crate::lightning::ln::channel_keys::HtlcBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27301 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27302 pub struct CResult_HtlcBasepointDecodeErrorZ {
27303 /// The contents of this CResult_HtlcBasepointDecodeErrorZ, accessible via either
27304 /// `err` or `result` depending on the state of `result_ok`.
27305 pub contents: CResult_HtlcBasepointDecodeErrorZPtr,
27306 /// Whether this CResult_HtlcBasepointDecodeErrorZ represents a success state.
27307 pub result_ok: bool,
27310 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state.
27311 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcBasepoint) -> CResult_HtlcBasepointDecodeErrorZ {
27312 CResult_HtlcBasepointDecodeErrorZ {
27313 contents: CResult_HtlcBasepointDecodeErrorZPtr {
27314 result: Box::into_raw(Box::new(o)),
27320 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state.
27321 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcBasepointDecodeErrorZ {
27322 CResult_HtlcBasepointDecodeErrorZ {
27323 contents: CResult_HtlcBasepointDecodeErrorZPtr {
27324 err: Box::into_raw(Box::new(e)),
27329 /// Checks if the given object is currently in the success state
27331 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_is_ok(o: &CResult_HtlcBasepointDecodeErrorZ) -> bool {
27335 /// Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ.
27336 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_free(_res: CResult_HtlcBasepointDecodeErrorZ) { }
27337 impl Drop for CResult_HtlcBasepointDecodeErrorZ {
27338 fn drop(&mut self) {
27339 if self.result_ok {
27340 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27341 let _ = unsafe { Box::from_raw(self.contents.result) };
27344 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27345 let _ = unsafe { Box::from_raw(self.contents.err) };
27350 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcBasepointDecodeErrorZ {
27351 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27352 let contents = if o.result_ok {
27353 let result = unsafe { o.contents.result };
27354 unsafe { o.contents.result = core::ptr::null_mut() };
27355 CResult_HtlcBasepointDecodeErrorZPtr { result }
27357 let err = unsafe { o.contents.err };
27358 unsafe { o.contents.err = core::ptr::null_mut(); }
27359 CResult_HtlcBasepointDecodeErrorZPtr { err }
27363 result_ok: o.result_ok,
27367 impl Clone for CResult_HtlcBasepointDecodeErrorZ {
27368 fn clone(&self) -> Self {
27369 if self.result_ok {
27370 Self { result_ok: true, contents: CResult_HtlcBasepointDecodeErrorZPtr {
27371 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcBasepoint>::clone(unsafe { &*self.contents.result })))
27374 Self { result_ok: false, contents: CResult_HtlcBasepointDecodeErrorZPtr {
27375 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27381 /// Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig`
27382 /// but with all dynamically-allocated buffers duplicated in new buffers.
27383 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_clone(orig: &CResult_HtlcBasepointDecodeErrorZ) -> CResult_HtlcBasepointDecodeErrorZ { Clone::clone(&orig) }
27385 /// The contents of CResult_HtlcKeyDecodeErrorZ
27386 pub union CResult_HtlcKeyDecodeErrorZPtr {
27387 /// A pointer to the contents in the success state.
27388 /// Reading from this pointer when `result_ok` is not set is undefined.
27389 pub result: *mut crate::lightning::ln::channel_keys::HtlcKey,
27390 /// A pointer to the contents in the error state.
27391 /// Reading from this pointer when `result_ok` is set is undefined.
27392 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27395 /// A CResult_HtlcKeyDecodeErrorZ represents the result of a fallible operation,
27396 /// containing a crate::lightning::ln::channel_keys::HtlcKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27397 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27398 pub struct CResult_HtlcKeyDecodeErrorZ {
27399 /// The contents of this CResult_HtlcKeyDecodeErrorZ, accessible via either
27400 /// `err` or `result` depending on the state of `result_ok`.
27401 pub contents: CResult_HtlcKeyDecodeErrorZPtr,
27402 /// Whether this CResult_HtlcKeyDecodeErrorZ represents a success state.
27403 pub result_ok: bool,
27406 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the success state.
27407 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcKey) -> CResult_HtlcKeyDecodeErrorZ {
27408 CResult_HtlcKeyDecodeErrorZ {
27409 contents: CResult_HtlcKeyDecodeErrorZPtr {
27410 result: Box::into_raw(Box::new(o)),
27416 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the error state.
27417 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcKeyDecodeErrorZ {
27418 CResult_HtlcKeyDecodeErrorZ {
27419 contents: CResult_HtlcKeyDecodeErrorZPtr {
27420 err: Box::into_raw(Box::new(e)),
27425 /// Checks if the given object is currently in the success state
27427 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_is_ok(o: &CResult_HtlcKeyDecodeErrorZ) -> bool {
27431 /// Frees any resources used by the CResult_HtlcKeyDecodeErrorZ.
27432 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_free(_res: CResult_HtlcKeyDecodeErrorZ) { }
27433 impl Drop for CResult_HtlcKeyDecodeErrorZ {
27434 fn drop(&mut self) {
27435 if self.result_ok {
27436 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27437 let _ = unsafe { Box::from_raw(self.contents.result) };
27440 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27441 let _ = unsafe { Box::from_raw(self.contents.err) };
27446 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcKeyDecodeErrorZ {
27447 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27448 let contents = if o.result_ok {
27449 let result = unsafe { o.contents.result };
27450 unsafe { o.contents.result = core::ptr::null_mut() };
27451 CResult_HtlcKeyDecodeErrorZPtr { result }
27453 let err = unsafe { o.contents.err };
27454 unsafe { o.contents.err = core::ptr::null_mut(); }
27455 CResult_HtlcKeyDecodeErrorZPtr { err }
27459 result_ok: o.result_ok,
27463 impl Clone for CResult_HtlcKeyDecodeErrorZ {
27464 fn clone(&self) -> Self {
27465 if self.result_ok {
27466 Self { result_ok: true, contents: CResult_HtlcKeyDecodeErrorZPtr {
27467 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcKey>::clone(unsafe { &*self.contents.result })))
27470 Self { result_ok: false, contents: CResult_HtlcKeyDecodeErrorZPtr {
27471 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27477 /// Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig`
27478 /// but with all dynamically-allocated buffers duplicated in new buffers.
27479 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_clone(orig: &CResult_HtlcKeyDecodeErrorZ) -> CResult_HtlcKeyDecodeErrorZ { Clone::clone(&orig) }
27481 /// The contents of CResult_RevocationBasepointDecodeErrorZ
27482 pub union CResult_RevocationBasepointDecodeErrorZPtr {
27483 /// A pointer to the contents in the success state.
27484 /// Reading from this pointer when `result_ok` is not set is undefined.
27485 pub result: *mut crate::lightning::ln::channel_keys::RevocationBasepoint,
27486 /// A pointer to the contents in the error state.
27487 /// Reading from this pointer when `result_ok` is set is undefined.
27488 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27491 /// A CResult_RevocationBasepointDecodeErrorZ represents the result of a fallible operation,
27492 /// containing a crate::lightning::ln::channel_keys::RevocationBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27493 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27494 pub struct CResult_RevocationBasepointDecodeErrorZ {
27495 /// The contents of this CResult_RevocationBasepointDecodeErrorZ, accessible via either
27496 /// `err` or `result` depending on the state of `result_ok`.
27497 pub contents: CResult_RevocationBasepointDecodeErrorZPtr,
27498 /// Whether this CResult_RevocationBasepointDecodeErrorZ represents a success state.
27499 pub result_ok: bool,
27502 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state.
27503 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationBasepoint) -> CResult_RevocationBasepointDecodeErrorZ {
27504 CResult_RevocationBasepointDecodeErrorZ {
27505 contents: CResult_RevocationBasepointDecodeErrorZPtr {
27506 result: Box::into_raw(Box::new(o)),
27512 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state.
27513 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationBasepointDecodeErrorZ {
27514 CResult_RevocationBasepointDecodeErrorZ {
27515 contents: CResult_RevocationBasepointDecodeErrorZPtr {
27516 err: Box::into_raw(Box::new(e)),
27521 /// Checks if the given object is currently in the success state
27523 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_is_ok(o: &CResult_RevocationBasepointDecodeErrorZ) -> bool {
27527 /// Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ.
27528 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_free(_res: CResult_RevocationBasepointDecodeErrorZ) { }
27529 impl Drop for CResult_RevocationBasepointDecodeErrorZ {
27530 fn drop(&mut self) {
27531 if self.result_ok {
27532 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27533 let _ = unsafe { Box::from_raw(self.contents.result) };
27536 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27537 let _ = unsafe { Box::from_raw(self.contents.err) };
27542 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationBasepointDecodeErrorZ {
27543 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27544 let contents = if o.result_ok {
27545 let result = unsafe { o.contents.result };
27546 unsafe { o.contents.result = core::ptr::null_mut() };
27547 CResult_RevocationBasepointDecodeErrorZPtr { result }
27549 let err = unsafe { o.contents.err };
27550 unsafe { o.contents.err = core::ptr::null_mut(); }
27551 CResult_RevocationBasepointDecodeErrorZPtr { err }
27555 result_ok: o.result_ok,
27559 impl Clone for CResult_RevocationBasepointDecodeErrorZ {
27560 fn clone(&self) -> Self {
27561 if self.result_ok {
27562 Self { result_ok: true, contents: CResult_RevocationBasepointDecodeErrorZPtr {
27563 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationBasepoint>::clone(unsafe { &*self.contents.result })))
27566 Self { result_ok: false, contents: CResult_RevocationBasepointDecodeErrorZPtr {
27567 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27573 /// Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig`
27574 /// but with all dynamically-allocated buffers duplicated in new buffers.
27575 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_clone(orig: &CResult_RevocationBasepointDecodeErrorZ) -> CResult_RevocationBasepointDecodeErrorZ { Clone::clone(&orig) }
27577 /// The contents of CResult_RevocationKeyDecodeErrorZ
27578 pub union CResult_RevocationKeyDecodeErrorZPtr {
27579 /// A pointer to the contents in the success state.
27580 /// Reading from this pointer when `result_ok` is not set is undefined.
27581 pub result: *mut crate::lightning::ln::channel_keys::RevocationKey,
27582 /// A pointer to the contents in the error state.
27583 /// Reading from this pointer when `result_ok` is set is undefined.
27584 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27587 /// A CResult_RevocationKeyDecodeErrorZ represents the result of a fallible operation,
27588 /// containing a crate::lightning::ln::channel_keys::RevocationKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27589 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27590 pub struct CResult_RevocationKeyDecodeErrorZ {
27591 /// The contents of this CResult_RevocationKeyDecodeErrorZ, accessible via either
27592 /// `err` or `result` depending on the state of `result_ok`.
27593 pub contents: CResult_RevocationKeyDecodeErrorZPtr,
27594 /// Whether this CResult_RevocationKeyDecodeErrorZ represents a success state.
27595 pub result_ok: bool,
27598 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the success state.
27599 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationKey) -> CResult_RevocationKeyDecodeErrorZ {
27600 CResult_RevocationKeyDecodeErrorZ {
27601 contents: CResult_RevocationKeyDecodeErrorZPtr {
27602 result: Box::into_raw(Box::new(o)),
27608 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the error state.
27609 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationKeyDecodeErrorZ {
27610 CResult_RevocationKeyDecodeErrorZ {
27611 contents: CResult_RevocationKeyDecodeErrorZPtr {
27612 err: Box::into_raw(Box::new(e)),
27617 /// Checks if the given object is currently in the success state
27619 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_is_ok(o: &CResult_RevocationKeyDecodeErrorZ) -> bool {
27623 /// Frees any resources used by the CResult_RevocationKeyDecodeErrorZ.
27624 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_free(_res: CResult_RevocationKeyDecodeErrorZ) { }
27625 impl Drop for CResult_RevocationKeyDecodeErrorZ {
27626 fn drop(&mut self) {
27627 if self.result_ok {
27628 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27629 let _ = unsafe { Box::from_raw(self.contents.result) };
27632 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27633 let _ = unsafe { Box::from_raw(self.contents.err) };
27638 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationKeyDecodeErrorZ {
27639 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27640 let contents = if o.result_ok {
27641 let result = unsafe { o.contents.result };
27642 unsafe { o.contents.result = core::ptr::null_mut() };
27643 CResult_RevocationKeyDecodeErrorZPtr { result }
27645 let err = unsafe { o.contents.err };
27646 unsafe { o.contents.err = core::ptr::null_mut(); }
27647 CResult_RevocationKeyDecodeErrorZPtr { err }
27651 result_ok: o.result_ok,
27655 impl Clone for CResult_RevocationKeyDecodeErrorZ {
27656 fn clone(&self) -> Self {
27657 if self.result_ok {
27658 Self { result_ok: true, contents: CResult_RevocationKeyDecodeErrorZPtr {
27659 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationKey>::clone(unsafe { &*self.contents.result })))
27662 Self { result_ok: false, contents: CResult_RevocationKeyDecodeErrorZPtr {
27663 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27669 /// Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig`
27670 /// but with all dynamically-allocated buffers duplicated in new buffers.
27671 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_clone(orig: &CResult_RevocationKeyDecodeErrorZ) -> CResult_RevocationKeyDecodeErrorZ { Clone::clone(&orig) }
27673 /// The contents of CResult_LockedChannelMonitorNoneZ
27674 pub union CResult_LockedChannelMonitorNoneZPtr {
27675 /// A pointer to the contents in the success state.
27676 /// Reading from this pointer when `result_ok` is not set is undefined.
27677 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
27678 /// Note that this value is always NULL, as there are no contents in the Err variant
27679 pub err: *mut core::ffi::c_void,
27682 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
27683 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
27684 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27685 pub struct CResult_LockedChannelMonitorNoneZ {
27686 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
27687 /// `err` or `result` depending on the state of `result_ok`.
27688 pub contents: CResult_LockedChannelMonitorNoneZPtr,
27689 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
27690 pub result_ok: bool,
27693 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
27694 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
27695 CResult_LockedChannelMonitorNoneZ {
27696 contents: CResult_LockedChannelMonitorNoneZPtr {
27697 result: Box::into_raw(Box::new(o)),
27703 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
27704 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
27705 CResult_LockedChannelMonitorNoneZ {
27706 contents: CResult_LockedChannelMonitorNoneZPtr {
27707 err: core::ptr::null_mut(),
27712 /// Checks if the given object is currently in the success state
27714 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
27718 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
27719 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
27720 impl Drop for CResult_LockedChannelMonitorNoneZ {
27721 fn drop(&mut self) {
27722 if self.result_ok {
27723 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27724 let _ = unsafe { Box::from_raw(self.contents.result) };
27730 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
27731 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
27732 let contents = if o.result_ok {
27733 let result = unsafe { o.contents.result };
27734 unsafe { o.contents.result = core::ptr::null_mut() };
27735 CResult_LockedChannelMonitorNoneZPtr { result }
27737 let _ = unsafe { Box::from_raw(o.contents.err) };
27738 o.contents.err = core::ptr::null_mut();
27739 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
27743 result_ok: o.result_ok,
27748 /// A tuple of 2 elements. See the individual fields for the types contained.
27749 pub struct C2Tuple_OutPointChannelIdZ {
27750 /// The element at position 0
27751 pub a: crate::lightning::chain::transaction::OutPoint,
27752 /// The element at position 1
27753 pub b: crate::lightning::ln::types::ChannelId,
27755 impl From<(crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)> for C2Tuple_OutPointChannelIdZ {
27756 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)) -> Self {
27763 impl C2Tuple_OutPointChannelIdZ {
27764 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId) {
27768 impl Clone for C2Tuple_OutPointChannelIdZ {
27769 fn clone(&self) -> Self {
27771 a: Clone::clone(&self.a),
27772 b: Clone::clone(&self.b),
27777 /// Creates a new tuple which has the same data as `orig`
27778 /// but with all dynamically-allocated buffers duplicated in new buffers.
27779 pub extern "C" fn C2Tuple_OutPointChannelIdZ_clone(orig: &C2Tuple_OutPointChannelIdZ) -> C2Tuple_OutPointChannelIdZ { Clone::clone(&orig) }
27780 /// Creates a new C2Tuple_OutPointChannelIdZ from the contained elements.
27782 pub extern "C" fn C2Tuple_OutPointChannelIdZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId) -> C2Tuple_OutPointChannelIdZ {
27783 C2Tuple_OutPointChannelIdZ { a, b, }
27787 /// Frees any resources used by the C2Tuple_OutPointChannelIdZ.
27788 pub extern "C" fn C2Tuple_OutPointChannelIdZ_free(_res: C2Tuple_OutPointChannelIdZ) { }
27790 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointChannelIdZs of arbitrary size.
27791 /// This corresponds to std::vector in C++
27792 pub struct CVec_C2Tuple_OutPointChannelIdZZ {
27793 /// The elements in the array.
27794 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27795 pub data: *mut crate::c_types::derived::C2Tuple_OutPointChannelIdZ,
27796 /// The number of elements pointed to by `data`.
27799 impl CVec_C2Tuple_OutPointChannelIdZZ {
27800 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ> {
27801 if self.datalen == 0 { return Vec::new(); }
27802 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27803 self.data = core::ptr::null_mut();
27807 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointChannelIdZ] {
27808 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27811 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>> for CVec_C2Tuple_OutPointChannelIdZZ {
27812 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>) -> Self {
27813 let datalen = v.len();
27814 let data = Box::into_raw(v.into_boxed_slice());
27815 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27819 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27820 pub extern "C" fn CVec_C2Tuple_OutPointChannelIdZZ_free(_res: CVec_C2Tuple_OutPointChannelIdZZ) { }
27821 impl Drop for CVec_C2Tuple_OutPointChannelIdZZ {
27822 fn drop(&mut self) {
27823 if self.datalen == 0 { return; }
27824 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27827 impl Clone for CVec_C2Tuple_OutPointChannelIdZZ {
27828 fn clone(&self) -> Self {
27829 let mut res = Vec::new();
27830 if self.datalen == 0 { return Self::from(res); }
27831 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
27836 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
27837 /// This corresponds to std::vector in C++
27838 pub struct CVec_MonitorUpdateIdZ {
27839 /// The elements in the array.
27840 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27841 pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
27842 /// The number of elements pointed to by `data`.
27845 impl CVec_MonitorUpdateIdZ {
27846 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
27847 if self.datalen == 0 { return Vec::new(); }
27848 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27849 self.data = core::ptr::null_mut();
27853 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
27854 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27857 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
27858 fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
27859 let datalen = v.len();
27860 let data = Box::into_raw(v.into_boxed_slice());
27861 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27865 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27866 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
27867 impl Drop for CVec_MonitorUpdateIdZ {
27868 fn drop(&mut self) {
27869 if self.datalen == 0 { return; }
27870 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27873 impl Clone for CVec_MonitorUpdateIdZ {
27874 fn clone(&self) -> Self {
27875 let mut res = Vec::new();
27876 if self.datalen == 0 { return Self::from(res); }
27877 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
27882 /// A tuple of 2 elements. See the individual fields for the types contained.
27883 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
27884 /// The element at position 0
27885 pub a: crate::lightning::chain::transaction::OutPoint,
27886 /// The element at position 1
27887 pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
27889 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
27890 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
27897 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
27898 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
27902 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
27903 fn clone(&self) -> Self {
27905 a: Clone::clone(&self.a),
27906 b: Clone::clone(&self.b),
27911 /// Creates a new tuple which has the same data as `orig`
27912 /// but with all dynamically-allocated buffers duplicated in new buffers.
27913 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
27914 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
27916 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
27917 C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
27921 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
27922 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
27924 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
27925 /// This corresponds to std::vector in C++
27926 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
27927 /// The elements in the array.
27928 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27929 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
27930 /// The number of elements pointed to by `data`.
27933 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
27934 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
27935 if self.datalen == 0 { return Vec::new(); }
27936 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27937 self.data = core::ptr::null_mut();
27941 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
27942 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27945 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
27946 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
27947 let datalen = v.len();
27948 let data = Box::into_raw(v.into_boxed_slice());
27949 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27953 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27954 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
27955 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
27956 fn drop(&mut self) {
27957 if self.datalen == 0 { return; }
27958 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27961 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
27962 fn clone(&self) -> Self {
27963 let mut res = Vec::new();
27964 if self.datalen == 0 { return Self::from(res); }
27965 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });