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,
136 impl Clone for CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
137 fn clone(&self) -> Self {
139 Self { result_ok: true, contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
140 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder>::clone(unsafe { &*self.contents.result })))
143 Self { result_ok: false, contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
144 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
150 /// Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig`
151 /// but with all dynamically-allocated buffers duplicated in new buffers.
152 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig: &CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { Clone::clone(&orig) }
154 /// The contents of CResult_RefundBolt12SemanticErrorZ
155 pub union CResult_RefundBolt12SemanticErrorZPtr {
156 /// A pointer to the contents in the success state.
157 /// Reading from this pointer when `result_ok` is not set is undefined.
158 pub result: *mut crate::lightning::offers::refund::Refund,
159 /// A pointer to the contents in the error state.
160 /// Reading from this pointer when `result_ok` is set is undefined.
161 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
164 /// A CResult_RefundBolt12SemanticErrorZ represents the result of a fallible operation,
165 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
166 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
167 pub struct CResult_RefundBolt12SemanticErrorZ {
168 /// The contents of this CResult_RefundBolt12SemanticErrorZ, accessible via either
169 /// `err` or `result` depending on the state of `result_ok`.
170 pub contents: CResult_RefundBolt12SemanticErrorZPtr,
171 /// Whether this CResult_RefundBolt12SemanticErrorZ represents a success state.
175 /// Creates a new CResult_RefundBolt12SemanticErrorZ in the success state.
176 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12SemanticErrorZ {
177 CResult_RefundBolt12SemanticErrorZ {
178 contents: CResult_RefundBolt12SemanticErrorZPtr {
179 result: Box::into_raw(Box::new(o)),
185 /// Creates a new CResult_RefundBolt12SemanticErrorZ in the error state.
186 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_RefundBolt12SemanticErrorZ {
187 CResult_RefundBolt12SemanticErrorZ {
188 contents: CResult_RefundBolt12SemanticErrorZPtr {
189 err: Box::into_raw(Box::new(e)),
194 /// Checks if the given object is currently in the success state
196 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_is_ok(o: &CResult_RefundBolt12SemanticErrorZ) -> bool {
200 /// Frees any resources used by the CResult_RefundBolt12SemanticErrorZ.
201 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_free(_res: CResult_RefundBolt12SemanticErrorZ) { }
202 impl Drop for CResult_RefundBolt12SemanticErrorZ {
205 if unsafe { !(self.contents.result as *mut ()).is_null() } {
206 let _ = unsafe { Box::from_raw(self.contents.result) };
209 if unsafe { !(self.contents.err as *mut ()).is_null() } {
210 let _ = unsafe { Box::from_raw(self.contents.err) };
215 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_RefundBolt12SemanticErrorZ {
216 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
217 let contents = if o.result_ok {
218 let result = unsafe { o.contents.result };
219 unsafe { o.contents.result = core::ptr::null_mut() };
220 CResult_RefundBolt12SemanticErrorZPtr { result }
222 let err = unsafe { o.contents.err };
223 unsafe { o.contents.err = core::ptr::null_mut(); }
224 CResult_RefundBolt12SemanticErrorZPtr { err }
228 result_ok: o.result_ok,
232 impl Clone for CResult_RefundBolt12SemanticErrorZ {
233 fn clone(&self) -> Self {
235 Self { result_ok: true, contents: CResult_RefundBolt12SemanticErrorZPtr {
236 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
239 Self { result_ok: false, contents: CResult_RefundBolt12SemanticErrorZPtr {
240 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
246 /// Creates a new CResult_RefundBolt12SemanticErrorZ which has the same data as `orig`
247 /// but with all dynamically-allocated buffers duplicated in new buffers.
248 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_clone(orig: &CResult_RefundBolt12SemanticErrorZ) -> CResult_RefundBolt12SemanticErrorZ { Clone::clone(&orig) }
251 /// An enum which can either contain a u64 or not
252 pub enum COption_u64Z {
253 /// When we're in this state, this COption_u64Z contains a u64
255 /// When we're in this state, this COption_u64Z contains nothing
259 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
260 if let Self::None = self { false } else { true }
262 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
265 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
266 if let Self::Some(v) = self { v } else { unreachable!() }
270 /// Constructs a new COption_u64Z containing a u64
271 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
272 COption_u64Z::Some(o)
275 /// Constructs a new COption_u64Z containing nothing
276 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
280 /// Frees any resources associated with the u64, if we are in the Some state
281 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
283 /// Creates a new COption_u64Z which has the same data as `orig`
284 /// but with all dynamically-allocated buffers duplicated in new buffers.
285 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
287 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
288 /// This corresponds to std::vector in C++
289 pub struct CVec_BlindedPathZ {
290 /// The elements in the array.
291 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
292 pub data: *mut crate::lightning::blinded_path::BlindedPath,
293 /// The number of elements pointed to by `data`.
296 impl CVec_BlindedPathZ {
297 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedPath> {
298 if self.datalen == 0 { return Vec::new(); }
299 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
300 self.data = core::ptr::null_mut();
304 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedPath] {
305 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
308 impl From<Vec<crate::lightning::blinded_path::BlindedPath>> for CVec_BlindedPathZ {
309 fn from(v: Vec<crate::lightning::blinded_path::BlindedPath>) -> Self {
310 let datalen = v.len();
311 let data = Box::into_raw(v.into_boxed_slice());
312 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
316 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
317 pub extern "C" fn CVec_BlindedPathZ_free(_res: CVec_BlindedPathZ) { }
318 impl Drop for CVec_BlindedPathZ {
320 if self.datalen == 0 { return; }
321 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
324 impl Clone for CVec_BlindedPathZ {
325 fn clone(&self) -> Self {
326 let mut res = Vec::new();
327 if self.datalen == 0 { return Self::from(res); }
328 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
333 /// The contents of CResult_RefundBolt12ParseErrorZ
334 pub union CResult_RefundBolt12ParseErrorZPtr {
335 /// A pointer to the contents in the success state.
336 /// Reading from this pointer when `result_ok` is not set is undefined.
337 pub result: *mut crate::lightning::offers::refund::Refund,
338 /// A pointer to the contents in the error state.
339 /// Reading from this pointer when `result_ok` is set is undefined.
340 pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
343 /// A CResult_RefundBolt12ParseErrorZ represents the result of a fallible operation,
344 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
346 pub struct CResult_RefundBolt12ParseErrorZ {
347 /// The contents of this CResult_RefundBolt12ParseErrorZ, accessible via either
348 /// `err` or `result` depending on the state of `result_ok`.
349 pub contents: CResult_RefundBolt12ParseErrorZPtr,
350 /// Whether this CResult_RefundBolt12ParseErrorZ represents a success state.
354 /// Creates a new CResult_RefundBolt12ParseErrorZ in the success state.
355 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12ParseErrorZ {
356 CResult_RefundBolt12ParseErrorZ {
357 contents: CResult_RefundBolt12ParseErrorZPtr {
358 result: Box::into_raw(Box::new(o)),
364 /// Creates a new CResult_RefundBolt12ParseErrorZ in the error state.
365 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_RefundBolt12ParseErrorZ {
366 CResult_RefundBolt12ParseErrorZ {
367 contents: CResult_RefundBolt12ParseErrorZPtr {
368 err: Box::into_raw(Box::new(e)),
373 /// Checks if the given object is currently in the success state
375 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_is_ok(o: &CResult_RefundBolt12ParseErrorZ) -> bool {
379 /// Frees any resources used by the CResult_RefundBolt12ParseErrorZ.
380 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_free(_res: CResult_RefundBolt12ParseErrorZ) { }
381 impl Drop for CResult_RefundBolt12ParseErrorZ {
384 if unsafe { !(self.contents.result as *mut ()).is_null() } {
385 let _ = unsafe { Box::from_raw(self.contents.result) };
388 if unsafe { !(self.contents.err as *mut ()).is_null() } {
389 let _ = unsafe { Box::from_raw(self.contents.err) };
394 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_RefundBolt12ParseErrorZ {
395 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
396 let contents = if o.result_ok {
397 let result = unsafe { o.contents.result };
398 unsafe { o.contents.result = core::ptr::null_mut() };
399 CResult_RefundBolt12ParseErrorZPtr { result }
401 let err = unsafe { o.contents.err };
402 unsafe { o.contents.err = core::ptr::null_mut(); }
403 CResult_RefundBolt12ParseErrorZPtr { err }
407 result_ok: o.result_ok,
411 impl Clone for CResult_RefundBolt12ParseErrorZ {
412 fn clone(&self) -> Self {
414 Self { result_ok: true, contents: CResult_RefundBolt12ParseErrorZPtr {
415 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
418 Self { result_ok: false, contents: CResult_RefundBolt12ParseErrorZPtr {
419 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
425 /// Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig`
426 /// but with all dynamically-allocated buffers duplicated in new buffers.
427 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_clone(orig: &CResult_RefundBolt12ParseErrorZ) -> CResult_RefundBolt12ParseErrorZ { Clone::clone(&orig) }
429 /// The contents of CResult_RetryDecodeErrorZ
430 pub union CResult_RetryDecodeErrorZPtr {
431 /// A pointer to the contents in the success state.
432 /// Reading from this pointer when `result_ok` is not set is undefined.
433 pub result: *mut crate::lightning::ln::outbound_payment::Retry,
434 /// A pointer to the contents in the error state.
435 /// Reading from this pointer when `result_ok` is set is undefined.
436 pub err: *mut crate::lightning::ln::msgs::DecodeError,
439 /// A CResult_RetryDecodeErrorZ represents the result of a fallible operation,
440 /// containing a crate::lightning::ln::outbound_payment::Retry on success and a crate::lightning::ln::msgs::DecodeError on failure.
441 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
442 pub struct CResult_RetryDecodeErrorZ {
443 /// The contents of this CResult_RetryDecodeErrorZ, accessible via either
444 /// `err` or `result` depending on the state of `result_ok`.
445 pub contents: CResult_RetryDecodeErrorZPtr,
446 /// Whether this CResult_RetryDecodeErrorZ represents a success state.
450 /// Creates a new CResult_RetryDecodeErrorZ in the success state.
451 pub extern "C" fn CResult_RetryDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::Retry) -> CResult_RetryDecodeErrorZ {
452 CResult_RetryDecodeErrorZ {
453 contents: CResult_RetryDecodeErrorZPtr {
454 result: Box::into_raw(Box::new(o)),
460 /// Creates a new CResult_RetryDecodeErrorZ in the error state.
461 pub extern "C" fn CResult_RetryDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RetryDecodeErrorZ {
462 CResult_RetryDecodeErrorZ {
463 contents: CResult_RetryDecodeErrorZPtr {
464 err: Box::into_raw(Box::new(e)),
469 /// Checks if the given object is currently in the success state
471 pub extern "C" fn CResult_RetryDecodeErrorZ_is_ok(o: &CResult_RetryDecodeErrorZ) -> bool {
475 /// Frees any resources used by the CResult_RetryDecodeErrorZ.
476 pub extern "C" fn CResult_RetryDecodeErrorZ_free(_res: CResult_RetryDecodeErrorZ) { }
477 impl Drop for CResult_RetryDecodeErrorZ {
480 if unsafe { !(self.contents.result as *mut ()).is_null() } {
481 let _ = unsafe { Box::from_raw(self.contents.result) };
484 if unsafe { !(self.contents.err as *mut ()).is_null() } {
485 let _ = unsafe { Box::from_raw(self.contents.err) };
490 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>> for CResult_RetryDecodeErrorZ {
491 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>) -> Self {
492 let contents = if o.result_ok {
493 let result = unsafe { o.contents.result };
494 unsafe { o.contents.result = core::ptr::null_mut() };
495 CResult_RetryDecodeErrorZPtr { result }
497 let err = unsafe { o.contents.err };
498 unsafe { o.contents.err = core::ptr::null_mut(); }
499 CResult_RetryDecodeErrorZPtr { err }
503 result_ok: o.result_ok,
507 impl Clone for CResult_RetryDecodeErrorZ {
508 fn clone(&self) -> Self {
510 Self { result_ok: true, contents: CResult_RetryDecodeErrorZPtr {
511 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::Retry>::clone(unsafe { &*self.contents.result })))
514 Self { result_ok: false, contents: CResult_RetryDecodeErrorZPtr {
515 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
521 /// Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig`
522 /// but with all dynamically-allocated buffers duplicated in new buffers.
523 pub extern "C" fn CResult_RetryDecodeErrorZ_clone(orig: &CResult_RetryDecodeErrorZ) -> CResult_RetryDecodeErrorZ { Clone::clone(&orig) }
525 /// The contents of CResult_NoneAPIErrorZ
526 pub union CResult_NoneAPIErrorZPtr {
527 /// Note that this value is always NULL, as there are no contents in the OK variant
528 pub result: *mut core::ffi::c_void,
529 /// A pointer to the contents in the error state.
530 /// Reading from this pointer when `result_ok` is set is undefined.
531 pub err: *mut crate::lightning::util::errors::APIError,
534 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
535 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
537 pub struct CResult_NoneAPIErrorZ {
538 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
539 /// `err` or `result` depending on the state of `result_ok`.
540 pub contents: CResult_NoneAPIErrorZPtr,
541 /// Whether this CResult_NoneAPIErrorZ represents a success state.
545 /// Creates a new CResult_NoneAPIErrorZ in the success state.
546 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
547 CResult_NoneAPIErrorZ {
548 contents: CResult_NoneAPIErrorZPtr {
549 result: core::ptr::null_mut(),
555 /// Creates a new CResult_NoneAPIErrorZ in the error state.
556 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
557 CResult_NoneAPIErrorZ {
558 contents: CResult_NoneAPIErrorZPtr {
559 err: Box::into_raw(Box::new(e)),
564 /// Checks if the given object is currently in the success state
566 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
570 /// Frees any resources used by the CResult_NoneAPIErrorZ.
571 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
572 impl Drop for CResult_NoneAPIErrorZ {
576 if unsafe { !(self.contents.err as *mut ()).is_null() } {
577 let _ = unsafe { Box::from_raw(self.contents.err) };
582 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
583 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
584 let contents = if o.result_ok {
585 let _ = unsafe { Box::from_raw(o.contents.result) };
586 o.contents.result = core::ptr::null_mut();
587 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
589 let err = unsafe { o.contents.err };
590 unsafe { o.contents.err = core::ptr::null_mut(); }
591 CResult_NoneAPIErrorZPtr { err }
595 result_ok: o.result_ok,
599 impl Clone for CResult_NoneAPIErrorZ {
600 fn clone(&self) -> Self {
602 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
603 result: core::ptr::null_mut()
606 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
607 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
613 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
614 /// but with all dynamically-allocated buffers duplicated in new buffers.
615 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
617 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
618 /// This corresponds to std::vector in C++
619 pub struct CVec_CResult_NoneAPIErrorZZ {
620 /// The elements in the array.
621 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
622 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
623 /// The number of elements pointed to by `data`.
626 impl CVec_CResult_NoneAPIErrorZZ {
627 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
628 if self.datalen == 0 { return Vec::new(); }
629 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
630 self.data = core::ptr::null_mut();
634 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
635 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
638 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
639 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
640 let datalen = v.len();
641 let data = Box::into_raw(v.into_boxed_slice());
642 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
646 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
647 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
648 impl Drop for CVec_CResult_NoneAPIErrorZZ {
650 if self.datalen == 0 { return; }
651 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
654 impl Clone for CVec_CResult_NoneAPIErrorZZ {
655 fn clone(&self) -> Self {
656 let mut res = Vec::new();
657 if self.datalen == 0 { return Self::from(res); }
658 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
663 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
664 /// This corresponds to std::vector in C++
665 pub struct CVec_APIErrorZ {
666 /// The elements in the array.
667 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
668 pub data: *mut crate::lightning::util::errors::APIError,
669 /// The number of elements pointed to by `data`.
672 impl CVec_APIErrorZ {
673 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
674 if self.datalen == 0 { return Vec::new(); }
675 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
676 self.data = core::ptr::null_mut();
680 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
681 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
684 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
685 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
686 let datalen = v.len();
687 let data = Box::into_raw(v.into_boxed_slice());
688 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
692 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
693 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
694 impl Drop for CVec_APIErrorZ {
696 if self.datalen == 0 { return; }
697 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
700 impl Clone for CVec_APIErrorZ {
701 fn clone(&self) -> Self {
702 let mut res = Vec::new();
703 if self.datalen == 0 { return Self::from(res); }
704 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
710 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
711 pub enum COption_ThirtyTwoBytesZ {
712 /// When we're in this state, this COption_ThirtyTwoBytesZ contains a crate::c_types::ThirtyTwoBytes
713 Some(crate::c_types::ThirtyTwoBytes),
714 /// When we're in this state, this COption_ThirtyTwoBytesZ contains nothing
717 impl COption_ThirtyTwoBytesZ {
718 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
719 if let Self::None = self { false } else { true }
721 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
724 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
725 if let Self::Some(v) = self { v } else { unreachable!() }
729 /// Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes
730 pub extern "C" fn COption_ThirtyTwoBytesZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_ThirtyTwoBytesZ {
731 COption_ThirtyTwoBytesZ::Some(o)
734 /// Constructs a new COption_ThirtyTwoBytesZ containing nothing
735 pub extern "C" fn COption_ThirtyTwoBytesZ_none() -> COption_ThirtyTwoBytesZ {
736 COption_ThirtyTwoBytesZ::None
739 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
740 pub extern "C" fn COption_ThirtyTwoBytesZ_free(_res: COption_ThirtyTwoBytesZ) { }
742 /// Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig`
743 /// but with all dynamically-allocated buffers duplicated in new buffers.
744 pub extern "C" fn COption_ThirtyTwoBytesZ_clone(orig: &COption_ThirtyTwoBytesZ) -> COption_ThirtyTwoBytesZ { Clone::clone(&orig) }
747 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
748 pub enum COption_CVec_u8ZZ {
749 /// When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
750 Some(crate::c_types::derived::CVec_u8Z),
751 /// When we're in this state, this COption_CVec_u8ZZ contains nothing
754 impl COption_CVec_u8ZZ {
755 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
756 if let Self::None = self { false } else { true }
758 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
761 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
762 if let Self::Some(v) = self { v } else { unreachable!() }
766 /// Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
767 pub extern "C" fn COption_CVec_u8ZZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_CVec_u8ZZ {
768 COption_CVec_u8ZZ::Some(o)
771 /// Constructs a new COption_CVec_u8ZZ containing nothing
772 pub extern "C" fn COption_CVec_u8ZZ_none() -> COption_CVec_u8ZZ {
773 COption_CVec_u8ZZ::None
776 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
777 pub extern "C" fn COption_CVec_u8ZZ_free(_res: COption_CVec_u8ZZ) { }
779 /// Creates a new COption_CVec_u8ZZ which has the same data as `orig`
780 /// but with all dynamically-allocated buffers duplicated in new buffers.
781 pub extern "C" fn COption_CVec_u8ZZ_clone(orig: &COption_CVec_u8ZZ) -> COption_CVec_u8ZZ { Clone::clone(&orig) }
783 /// The contents of CResult_RecipientOnionFieldsDecodeErrorZ
784 pub union CResult_RecipientOnionFieldsDecodeErrorZPtr {
785 /// A pointer to the contents in the success state.
786 /// Reading from this pointer when `result_ok` is not set is undefined.
787 pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
788 /// A pointer to the contents in the error state.
789 /// Reading from this pointer when `result_ok` is set is undefined.
790 pub err: *mut crate::lightning::ln::msgs::DecodeError,
793 /// A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
794 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
795 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
796 pub struct CResult_RecipientOnionFieldsDecodeErrorZ {
797 /// The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
798 /// `err` or `result` depending on the state of `result_ok`.
799 pub contents: CResult_RecipientOnionFieldsDecodeErrorZPtr,
800 /// Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
804 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
805 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsDecodeErrorZ {
806 CResult_RecipientOnionFieldsDecodeErrorZ {
807 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
808 result: Box::into_raw(Box::new(o)),
814 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
815 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RecipientOnionFieldsDecodeErrorZ {
816 CResult_RecipientOnionFieldsDecodeErrorZ {
817 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
818 err: Box::into_raw(Box::new(e)),
823 /// Checks if the given object is currently in the success state
825 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o: &CResult_RecipientOnionFieldsDecodeErrorZ) -> bool {
829 /// Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
830 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_free(_res: CResult_RecipientOnionFieldsDecodeErrorZ) { }
831 impl Drop for CResult_RecipientOnionFieldsDecodeErrorZ {
834 if unsafe { !(self.contents.result as *mut ()).is_null() } {
835 let _ = unsafe { Box::from_raw(self.contents.result) };
838 if unsafe { !(self.contents.err as *mut ()).is_null() } {
839 let _ = unsafe { Box::from_raw(self.contents.err) };
844 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>> for CResult_RecipientOnionFieldsDecodeErrorZ {
845 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
846 let contents = if o.result_ok {
847 let result = unsafe { o.contents.result };
848 unsafe { o.contents.result = core::ptr::null_mut() };
849 CResult_RecipientOnionFieldsDecodeErrorZPtr { result }
851 let err = unsafe { o.contents.err };
852 unsafe { o.contents.err = core::ptr::null_mut(); }
853 CResult_RecipientOnionFieldsDecodeErrorZPtr { err }
857 result_ok: o.result_ok,
861 impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ {
862 fn clone(&self) -> Self {
864 Self { result_ok: true, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
865 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
868 Self { result_ok: false, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
869 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
875 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
876 /// but with all dynamically-allocated buffers duplicated in new buffers.
877 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) }
879 /// A tuple of 2 elements. See the individual fields for the types contained.
880 pub struct C2Tuple_u64CVec_u8ZZ {
881 /// The element at position 0
883 /// The element at position 1
884 pub b: crate::c_types::derived::CVec_u8Z,
886 impl From<(u64, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u64CVec_u8ZZ {
887 fn from (tup: (u64, crate::c_types::derived::CVec_u8Z)) -> Self {
894 impl C2Tuple_u64CVec_u8ZZ {
895 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, crate::c_types::derived::CVec_u8Z) {
899 impl Clone for C2Tuple_u64CVec_u8ZZ {
900 fn clone(&self) -> Self {
902 a: Clone::clone(&self.a),
903 b: Clone::clone(&self.b),
908 /// Creates a new tuple which has the same data as `orig`
909 /// but with all dynamically-allocated buffers duplicated in new buffers.
910 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_clone(orig: &C2Tuple_u64CVec_u8ZZ) -> C2Tuple_u64CVec_u8ZZ { Clone::clone(&orig) }
911 /// Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements.
913 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_new(a: u64, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u64CVec_u8ZZ {
914 C2Tuple_u64CVec_u8ZZ { a, b, }
918 /// Frees any resources used by the C2Tuple_u64CVec_u8ZZ.
919 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_free(_res: C2Tuple_u64CVec_u8ZZ) { }
921 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64CVec_u8ZZs of arbitrary size.
922 /// This corresponds to std::vector in C++
923 pub struct CVec_C2Tuple_u64CVec_u8ZZZ {
924 /// The elements in the array.
925 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
926 pub data: *mut crate::c_types::derived::C2Tuple_u64CVec_u8ZZ,
927 /// The number of elements pointed to by `data`.
930 impl CVec_C2Tuple_u64CVec_u8ZZZ {
931 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ> {
932 if self.datalen == 0 { return Vec::new(); }
933 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
934 self.data = core::ptr::null_mut();
938 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u64CVec_u8ZZ] {
939 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
942 impl From<Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>> for CVec_C2Tuple_u64CVec_u8ZZZ {
943 fn from(v: Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>) -> Self {
944 let datalen = v.len();
945 let data = Box::into_raw(v.into_boxed_slice());
946 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
950 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
951 pub extern "C" fn CVec_C2Tuple_u64CVec_u8ZZZ_free(_res: CVec_C2Tuple_u64CVec_u8ZZZ) { }
952 impl Drop for CVec_C2Tuple_u64CVec_u8ZZZ {
954 if self.datalen == 0 { return; }
955 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
958 impl Clone for CVec_C2Tuple_u64CVec_u8ZZZ {
959 fn clone(&self) -> Self {
960 let mut res = Vec::new();
961 if self.datalen == 0 { return Self::from(res); }
962 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
967 /// The contents of CResult_RecipientOnionFieldsNoneZ
968 pub union CResult_RecipientOnionFieldsNoneZPtr {
969 /// A pointer to the contents in the success state.
970 /// Reading from this pointer when `result_ok` is not set is undefined.
971 pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
972 /// Note that this value is always NULL, as there are no contents in the Err variant
973 pub err: *mut core::ffi::c_void,
976 /// A CResult_RecipientOnionFieldsNoneZ represents the result of a fallible operation,
977 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a () on failure.
978 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
979 pub struct CResult_RecipientOnionFieldsNoneZ {
980 /// The contents of this CResult_RecipientOnionFieldsNoneZ, accessible via either
981 /// `err` or `result` depending on the state of `result_ok`.
982 pub contents: CResult_RecipientOnionFieldsNoneZPtr,
983 /// Whether this CResult_RecipientOnionFieldsNoneZ represents a success state.
987 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the success state.
988 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsNoneZ {
989 CResult_RecipientOnionFieldsNoneZ {
990 contents: CResult_RecipientOnionFieldsNoneZPtr {
991 result: Box::into_raw(Box::new(o)),
997 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the error state.
998 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_err() -> CResult_RecipientOnionFieldsNoneZ {
999 CResult_RecipientOnionFieldsNoneZ {
1000 contents: CResult_RecipientOnionFieldsNoneZPtr {
1001 err: core::ptr::null_mut(),
1006 /// Checks if the given object is currently in the success state
1008 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_is_ok(o: &CResult_RecipientOnionFieldsNoneZ) -> bool {
1012 /// Frees any resources used by the CResult_RecipientOnionFieldsNoneZ.
1013 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_free(_res: CResult_RecipientOnionFieldsNoneZ) { }
1014 impl Drop for CResult_RecipientOnionFieldsNoneZ {
1015 fn drop(&mut self) {
1017 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1018 let _ = unsafe { Box::from_raw(self.contents.result) };
1024 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, ()>> for CResult_RecipientOnionFieldsNoneZ {
1025 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, ()>) -> Self {
1026 let contents = if o.result_ok {
1027 let result = unsafe { o.contents.result };
1028 unsafe { o.contents.result = core::ptr::null_mut() };
1029 CResult_RecipientOnionFieldsNoneZPtr { result }
1031 let _ = unsafe { Box::from_raw(o.contents.err) };
1032 o.contents.err = core::ptr::null_mut();
1033 CResult_RecipientOnionFieldsNoneZPtr { err: core::ptr::null_mut() }
1037 result_ok: o.result_ok,
1041 impl Clone for CResult_RecipientOnionFieldsNoneZ {
1042 fn clone(&self) -> Self {
1044 Self { result_ok: true, contents: CResult_RecipientOnionFieldsNoneZPtr {
1045 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
1048 Self { result_ok: false, contents: CResult_RecipientOnionFieldsNoneZPtr {
1049 err: core::ptr::null_mut()
1055 /// Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig`
1056 /// but with all dynamically-allocated buffers duplicated in new buffers.
1057 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_clone(orig: &CResult_RecipientOnionFieldsNoneZ) -> CResult_RecipientOnionFieldsNoneZ { Clone::clone(&orig) }
1059 /// The contents of CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ
1060 pub union CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1061 /// A pointer to the contents in the success state.
1062 /// Reading from this pointer when `result_ok` is not set is undefined.
1063 pub result: *mut crate::lightning::offers::invoice::UnsignedBolt12Invoice,
1064 /// A pointer to the contents in the error state.
1065 /// Reading from this pointer when `result_ok` is set is undefined.
1066 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
1069 /// A CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation,
1070 /// containing a crate::lightning::offers::invoice::UnsignedBolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
1071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1072 pub struct CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1073 /// The contents of this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ, accessible via either
1074 /// `err` or `result` depending on the state of `result_ok`.
1075 pub contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr,
1076 /// Whether this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents a success state.
1077 pub result_ok: bool,
1080 /// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the success state.
1081 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1082 CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1083 contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1084 result: Box::into_raw(Box::new(o)),
1090 /// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the error state.
1091 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1092 CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1093 contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1094 err: Box::into_raw(Box::new(e)),
1099 /// Checks if the given object is currently in the success state
1101 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) -> bool {
1105 /// Frees any resources used by the CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ.
1106 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) { }
1107 impl Drop for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1108 fn drop(&mut self) {
1110 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1111 let _ = unsafe { Box::from_raw(self.contents.result) };
1114 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1115 let _ = unsafe { Box::from_raw(self.contents.err) };
1120 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::UnsignedBolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1121 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::UnsignedBolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
1122 let contents = if o.result_ok {
1123 let result = unsafe { o.contents.result };
1124 unsafe { o.contents.result = core::ptr::null_mut() };
1125 CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { result }
1127 let err = unsafe { o.contents.err };
1128 unsafe { o.contents.err = core::ptr::null_mut(); }
1129 CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { err }
1133 result_ok: o.result_ok,
1137 impl Clone for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1138 fn clone(&self) -> Self {
1140 Self { result_ok: true, contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1141 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::UnsignedBolt12Invoice>::clone(unsafe { &*self.contents.result })))
1144 Self { result_ok: false, contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1145 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
1151 /// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig`
1152 /// but with all dynamically-allocated buffers duplicated in new buffers.
1153 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig: &CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { Clone::clone(&orig) }
1155 /// The contents of CResult_Bolt12InvoiceBolt12SemanticErrorZ
1156 pub union CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1157 /// A pointer to the contents in the success state.
1158 /// Reading from this pointer when `result_ok` is not set is undefined.
1159 pub result: *mut crate::lightning::offers::invoice::Bolt12Invoice,
1160 /// A pointer to the contents in the error state.
1161 /// Reading from this pointer when `result_ok` is set is undefined.
1162 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
1165 /// A CResult_Bolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation,
1166 /// containing a crate::lightning::offers::invoice::Bolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
1167 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1168 pub struct CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1169 /// The contents of this CResult_Bolt12InvoiceBolt12SemanticErrorZ, accessible via either
1170 /// `err` or `result` depending on the state of `result_ok`.
1171 pub contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr,
1172 /// Whether this CResult_Bolt12InvoiceBolt12SemanticErrorZ represents a success state.
1173 pub result_ok: bool,
1176 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the success state.
1177 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::Bolt12Invoice) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1178 CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1179 contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1180 result: Box::into_raw(Box::new(o)),
1186 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the error state.
1187 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1188 CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1189 contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1190 err: Box::into_raw(Box::new(e)),
1195 /// Checks if the given object is currently in the success state
1197 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> bool {
1201 /// Frees any resources used by the CResult_Bolt12InvoiceBolt12SemanticErrorZ.
1202 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_Bolt12InvoiceBolt12SemanticErrorZ) { }
1203 impl Drop for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1204 fn drop(&mut self) {
1206 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1207 let _ = unsafe { Box::from_raw(self.contents.result) };
1210 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1211 let _ = unsafe { Box::from_raw(self.contents.err) };
1216 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::Bolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1217 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::Bolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
1218 let contents = if o.result_ok {
1219 let result = unsafe { o.contents.result };
1220 unsafe { o.contents.result = core::ptr::null_mut() };
1221 CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { result }
1223 let err = unsafe { o.contents.err };
1224 unsafe { o.contents.err = core::ptr::null_mut(); }
1225 CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { err }
1229 result_ok: o.result_ok,
1233 impl Clone for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1234 fn clone(&self) -> Self {
1236 Self { result_ok: true, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1237 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::Bolt12Invoice>::clone(unsafe { &*self.contents.result })))
1240 Self { result_ok: false, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1241 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
1247 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig`
1248 /// but with all dynamically-allocated buffers duplicated in new buffers.
1249 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ { Clone::clone(&orig) }
1251 /// The contents of CResult_SchnorrSignatureNoneZ
1252 pub union CResult_SchnorrSignatureNoneZPtr {
1253 /// A pointer to the contents in the success state.
1254 /// Reading from this pointer when `result_ok` is not set is undefined.
1255 pub result: *mut crate::c_types::SchnorrSignature,
1256 /// Note that this value is always NULL, as there are no contents in the Err variant
1257 pub err: *mut core::ffi::c_void,
1260 /// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation,
1261 /// containing a crate::c_types::SchnorrSignature on success and a () on failure.
1262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1263 pub struct CResult_SchnorrSignatureNoneZ {
1264 /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either
1265 /// `err` or `result` depending on the state of `result_ok`.
1266 pub contents: CResult_SchnorrSignatureNoneZPtr,
1267 /// Whether this CResult_SchnorrSignatureNoneZ represents a success state.
1268 pub result_ok: bool,
1271 /// Creates a new CResult_SchnorrSignatureNoneZ in the success state.
1272 pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ {
1273 CResult_SchnorrSignatureNoneZ {
1274 contents: CResult_SchnorrSignatureNoneZPtr {
1275 result: Box::into_raw(Box::new(o)),
1281 /// Creates a new CResult_SchnorrSignatureNoneZ in the error state.
1282 pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ {
1283 CResult_SchnorrSignatureNoneZ {
1284 contents: CResult_SchnorrSignatureNoneZPtr {
1285 err: core::ptr::null_mut(),
1290 /// Checks if the given object is currently in the success state
1292 pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool {
1296 /// Frees any resources used by the CResult_SchnorrSignatureNoneZ.
1297 pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { }
1298 impl Drop for CResult_SchnorrSignatureNoneZ {
1299 fn drop(&mut self) {
1301 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1302 let _ = unsafe { Box::from_raw(self.contents.result) };
1308 impl From<crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>> for CResult_SchnorrSignatureNoneZ {
1309 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>) -> Self {
1310 let contents = if o.result_ok {
1311 let result = unsafe { o.contents.result };
1312 unsafe { o.contents.result = core::ptr::null_mut() };
1313 CResult_SchnorrSignatureNoneZPtr { result }
1315 let _ = unsafe { Box::from_raw(o.contents.err) };
1316 o.contents.err = core::ptr::null_mut();
1317 CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() }
1321 result_ok: o.result_ok,
1325 impl Clone for CResult_SchnorrSignatureNoneZ {
1326 fn clone(&self) -> Self {
1328 Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr {
1329 result: Box::into_raw(Box::new(<crate::c_types::SchnorrSignature>::clone(unsafe { &*self.contents.result })))
1332 Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr {
1333 err: core::ptr::null_mut()
1339 /// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig`
1340 /// but with all dynamically-allocated buffers duplicated in new buffers.
1341 pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) }
1343 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1344 /// This corresponds to std::vector in C++
1345 pub struct CVec_ThirtyTwoBytesZ {
1346 /// The elements in the array.
1347 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1348 pub data: *mut crate::c_types::ThirtyTwoBytes,
1349 /// The number of elements pointed to by `data`.
1352 impl CVec_ThirtyTwoBytesZ {
1353 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
1354 if self.datalen == 0 { return Vec::new(); }
1355 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1356 self.data = core::ptr::null_mut();
1360 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
1361 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1364 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
1365 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
1366 let datalen = v.len();
1367 let data = Box::into_raw(v.into_boxed_slice());
1368 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1372 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1373 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
1374 impl Drop for CVec_ThirtyTwoBytesZ {
1375 fn drop(&mut self) {
1376 if self.datalen == 0 { return; }
1377 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1380 impl Clone for CVec_ThirtyTwoBytesZ {
1381 fn clone(&self) -> Self {
1382 let mut res = Vec::new();
1383 if self.datalen == 0 { return Self::from(res); }
1384 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1390 /// An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not
1391 pub enum COption_CVec_ThirtyTwoBytesZZ {
1392 /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ
1393 Some(crate::c_types::derived::CVec_ThirtyTwoBytesZ),
1394 /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing
1397 impl COption_CVec_ThirtyTwoBytesZZ {
1398 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1399 if let Self::None = self { false } else { true }
1401 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1404 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
1405 if let Self::Some(v) = self { v } else { unreachable!() }
1409 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ
1410 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_some(o: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> COption_CVec_ThirtyTwoBytesZZ {
1411 COption_CVec_ThirtyTwoBytesZZ::Some(o)
1414 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing
1415 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_none() -> COption_CVec_ThirtyTwoBytesZZ {
1416 COption_CVec_ThirtyTwoBytesZZ::None
1419 /// Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state
1420 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_free(_res: COption_CVec_ThirtyTwoBytesZZ) { }
1422 /// Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig`
1423 /// but with all dynamically-allocated buffers duplicated in new buffers.
1424 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_clone(orig: &COption_CVec_ThirtyTwoBytesZZ) -> COption_CVec_ThirtyTwoBytesZZ { Clone::clone(&orig) }
1427 /// An enum which can either contain a crate::lightning::offers::offer::Amount or not
1428 pub enum COption_AmountZ {
1429 /// When we're in this state, this COption_AmountZ contains a crate::lightning::offers::offer::Amount
1430 Some(crate::lightning::offers::offer::Amount),
1431 /// When we're in this state, this COption_AmountZ contains nothing
1434 impl COption_AmountZ {
1435 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1436 if let Self::None = self { false } else { true }
1438 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1441 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::offers::offer::Amount {
1442 if let Self::Some(v) = self { v } else { unreachable!() }
1446 /// Constructs a new COption_AmountZ containing a crate::lightning::offers::offer::Amount
1447 pub extern "C" fn COption_AmountZ_some(o: crate::lightning::offers::offer::Amount) -> COption_AmountZ {
1448 COption_AmountZ::Some(o)
1451 /// Constructs a new COption_AmountZ containing nothing
1452 pub extern "C" fn COption_AmountZ_none() -> COption_AmountZ {
1453 COption_AmountZ::None
1456 /// Frees any resources associated with the crate::lightning::offers::offer::Amount, if we are in the Some state
1457 pub extern "C" fn COption_AmountZ_free(_res: COption_AmountZ) { }
1459 /// Creates a new COption_AmountZ which has the same data as `orig`
1460 /// but with all dynamically-allocated buffers duplicated in new buffers.
1461 pub extern "C" fn COption_AmountZ_clone(orig: &COption_AmountZ) -> COption_AmountZ { Clone::clone(&orig) }
1464 /// An enum which can either contain a crate::lightning::offers::offer::Quantity or not
1465 pub enum COption_QuantityZ {
1466 /// When we're in this state, this COption_QuantityZ contains a crate::lightning::offers::offer::Quantity
1467 Some(crate::lightning::offers::offer::Quantity),
1468 /// When we're in this state, this COption_QuantityZ contains nothing
1471 impl COption_QuantityZ {
1472 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1473 if let Self::None = self { false } else { true }
1475 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1478 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::offers::offer::Quantity {
1479 if let Self::Some(v) = self { v } else { unreachable!() }
1483 /// Constructs a new COption_QuantityZ containing a crate::lightning::offers::offer::Quantity
1484 pub extern "C" fn COption_QuantityZ_some(o: crate::lightning::offers::offer::Quantity) -> COption_QuantityZ {
1485 COption_QuantityZ::Some(o)
1488 /// Constructs a new COption_QuantityZ containing nothing
1489 pub extern "C" fn COption_QuantityZ_none() -> COption_QuantityZ {
1490 COption_QuantityZ::None
1493 /// Frees any resources associated with the crate::lightning::offers::offer::Quantity, if we are in the Some state
1494 pub extern "C" fn COption_QuantityZ_free(_res: COption_QuantityZ) { }
1496 /// Creates a new COption_QuantityZ which has the same data as `orig`
1497 /// but with all dynamically-allocated buffers duplicated in new buffers.
1498 pub extern "C" fn COption_QuantityZ_clone(orig: &COption_QuantityZ) -> COption_QuantityZ { Clone::clone(&orig) }
1500 /// The contents of CResult_ThirtyTwoBytesNoneZ
1501 pub union CResult_ThirtyTwoBytesNoneZPtr {
1502 /// A pointer to the contents in the success state.
1503 /// Reading from this pointer when `result_ok` is not set is undefined.
1504 pub result: *mut crate::c_types::ThirtyTwoBytes,
1505 /// Note that this value is always NULL, as there are no contents in the Err variant
1506 pub err: *mut core::ffi::c_void,
1509 /// A CResult_ThirtyTwoBytesNoneZ represents the result of a fallible operation,
1510 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
1511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1512 pub struct CResult_ThirtyTwoBytesNoneZ {
1513 /// The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either
1514 /// `err` or `result` depending on the state of `result_ok`.
1515 pub contents: CResult_ThirtyTwoBytesNoneZPtr,
1516 /// Whether this CResult_ThirtyTwoBytesNoneZ represents a success state.
1517 pub result_ok: bool,
1520 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the success state.
1521 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesNoneZ {
1522 CResult_ThirtyTwoBytesNoneZ {
1523 contents: CResult_ThirtyTwoBytesNoneZPtr {
1524 result: Box::into_raw(Box::new(o)),
1530 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the error state.
1531 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_err() -> CResult_ThirtyTwoBytesNoneZ {
1532 CResult_ThirtyTwoBytesNoneZ {
1533 contents: CResult_ThirtyTwoBytesNoneZPtr {
1534 err: core::ptr::null_mut(),
1539 /// Checks if the given object is currently in the success state
1541 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_is_ok(o: &CResult_ThirtyTwoBytesNoneZ) -> bool {
1545 /// Frees any resources used by the CResult_ThirtyTwoBytesNoneZ.
1546 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_free(_res: CResult_ThirtyTwoBytesNoneZ) { }
1547 impl Drop for CResult_ThirtyTwoBytesNoneZ {
1548 fn drop(&mut self) {
1550 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1551 let _ = unsafe { Box::from_raw(self.contents.result) };
1557 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_ThirtyTwoBytesNoneZ {
1558 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
1559 let contents = if o.result_ok {
1560 let result = unsafe { o.contents.result };
1561 unsafe { o.contents.result = core::ptr::null_mut() };
1562 CResult_ThirtyTwoBytesNoneZPtr { result }
1564 let _ = unsafe { Box::from_raw(o.contents.err) };
1565 o.contents.err = core::ptr::null_mut();
1566 CResult_ThirtyTwoBytesNoneZPtr { err: core::ptr::null_mut() }
1570 result_ok: o.result_ok,
1574 impl Clone for CResult_ThirtyTwoBytesNoneZ {
1575 fn clone(&self) -> Self {
1577 Self { result_ok: true, contents: CResult_ThirtyTwoBytesNoneZPtr {
1578 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
1581 Self { result_ok: false, contents: CResult_ThirtyTwoBytesNoneZPtr {
1582 err: core::ptr::null_mut()
1588 /// Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig`
1589 /// but with all dynamically-allocated buffers duplicated in new buffers.
1590 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_clone(orig: &CResult_ThirtyTwoBytesNoneZ) -> CResult_ThirtyTwoBytesNoneZ { Clone::clone(&orig) }
1592 /// The contents of CResult_BlindedPayInfoDecodeErrorZ
1593 pub union CResult_BlindedPayInfoDecodeErrorZPtr {
1594 /// A pointer to the contents in the success state.
1595 /// Reading from this pointer when `result_ok` is not set is undefined.
1596 pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo,
1597 /// A pointer to the contents in the error state.
1598 /// Reading from this pointer when `result_ok` is set is undefined.
1599 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1602 /// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
1603 /// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
1604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1605 pub struct CResult_BlindedPayInfoDecodeErrorZ {
1606 /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
1607 /// `err` or `result` depending on the state of `result_ok`.
1608 pub contents: CResult_BlindedPayInfoDecodeErrorZPtr,
1609 /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
1610 pub result_ok: bool,
1613 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
1614 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ {
1615 CResult_BlindedPayInfoDecodeErrorZ {
1616 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1617 result: Box::into_raw(Box::new(o)),
1623 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
1624 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ {
1625 CResult_BlindedPayInfoDecodeErrorZ {
1626 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1627 err: Box::into_raw(Box::new(e)),
1632 /// Checks if the given object is currently in the success state
1634 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool {
1638 /// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
1639 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { }
1640 impl Drop for CResult_BlindedPayInfoDecodeErrorZ {
1641 fn drop(&mut self) {
1643 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1644 let _ = unsafe { Box::from_raw(self.contents.result) };
1647 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1648 let _ = unsafe { Box::from_raw(self.contents.err) };
1653 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPayInfoDecodeErrorZ {
1654 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
1655 let contents = if o.result_ok {
1656 let result = unsafe { o.contents.result };
1657 unsafe { o.contents.result = core::ptr::null_mut() };
1658 CResult_BlindedPayInfoDecodeErrorZPtr { result }
1660 let err = unsafe { o.contents.err };
1661 unsafe { o.contents.err = core::ptr::null_mut(); }
1662 CResult_BlindedPayInfoDecodeErrorZPtr { err }
1666 result_ok: o.result_ok,
1670 impl Clone for CResult_BlindedPayInfoDecodeErrorZ {
1671 fn clone(&self) -> Self {
1673 Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1674 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::BlindedPayInfo>::clone(unsafe { &*self.contents.result })))
1677 Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1678 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1684 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
1685 /// but with all dynamically-allocated buffers duplicated in new buffers.
1686 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) }
1688 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
1689 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1690 /// A pointer to the contents in the success state.
1691 /// Reading from this pointer when `result_ok` is not set is undefined.
1692 pub result: *mut crate::lightning::sign::DelayedPaymentOutputDescriptor,
1693 /// A pointer to the contents in the error state.
1694 /// Reading from this pointer when `result_ok` is set is undefined.
1695 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1698 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1699 /// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1701 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1702 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
1703 /// `err` or `result` depending on the state of `result_ok`.
1704 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
1705 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
1706 pub result_ok: bool,
1709 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
1710 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1711 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1712 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1713 result: Box::into_raw(Box::new(o)),
1719 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
1720 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1721 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1722 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1723 err: Box::into_raw(Box::new(e)),
1728 /// Checks if the given object is currently in the success state
1730 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
1734 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
1735 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
1736 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1737 fn drop(&mut self) {
1739 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1740 let _ = unsafe { Box::from_raw(self.contents.result) };
1743 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1744 let _ = unsafe { Box::from_raw(self.contents.err) };
1749 impl From<crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1750 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1751 let contents = if o.result_ok {
1752 let result = unsafe { o.contents.result };
1753 unsafe { o.contents.result = core::ptr::null_mut() };
1754 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
1756 let err = unsafe { o.contents.err };
1757 unsafe { o.contents.err = core::ptr::null_mut(); }
1758 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
1762 result_ok: o.result_ok,
1766 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1767 fn clone(&self) -> Self {
1769 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1770 result: Box::into_raw(Box::new(<crate::lightning::sign::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1773 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1774 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1780 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1781 /// but with all dynamically-allocated buffers duplicated in new buffers.
1782 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1784 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
1785 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1786 /// A pointer to the contents in the success state.
1787 /// Reading from this pointer when `result_ok` is not set is undefined.
1788 pub result: *mut crate::lightning::sign::StaticPaymentOutputDescriptor,
1789 /// A pointer to the contents in the error state.
1790 /// Reading from this pointer when `result_ok` is set is undefined.
1791 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1794 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1795 /// containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1796 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1797 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1798 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
1799 /// `err` or `result` depending on the state of `result_ok`.
1800 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
1801 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
1802 pub result_ok: bool,
1805 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
1806 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1807 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1808 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1809 result: Box::into_raw(Box::new(o)),
1815 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
1816 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1817 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1818 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1819 err: Box::into_raw(Box::new(e)),
1824 /// Checks if the given object is currently in the success state
1826 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
1830 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
1831 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
1832 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1833 fn drop(&mut self) {
1835 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1836 let _ = unsafe { Box::from_raw(self.contents.result) };
1839 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1840 let _ = unsafe { Box::from_raw(self.contents.err) };
1845 impl From<crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1846 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1847 let contents = if o.result_ok {
1848 let result = unsafe { o.contents.result };
1849 unsafe { o.contents.result = core::ptr::null_mut() };
1850 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
1852 let err = unsafe { o.contents.err };
1853 unsafe { o.contents.err = core::ptr::null_mut(); }
1854 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
1858 result_ok: o.result_ok,
1862 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1863 fn clone(&self) -> Self {
1865 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1866 result: Box::into_raw(Box::new(<crate::lightning::sign::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1869 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1870 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1876 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1877 /// but with all dynamically-allocated buffers duplicated in new buffers.
1878 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1880 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
1881 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1882 /// A pointer to the contents in the success state.
1883 /// Reading from this pointer when `result_ok` is not set is undefined.
1884 pub result: *mut crate::lightning::sign::SpendableOutputDescriptor,
1885 /// A pointer to the contents in the error state.
1886 /// Reading from this pointer when `result_ok` is set is undefined.
1887 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1890 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1891 /// containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1892 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1893 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
1894 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
1895 /// `err` or `result` depending on the state of `result_ok`.
1896 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
1897 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
1898 pub result_ok: bool,
1901 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
1902 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1903 CResult_SpendableOutputDescriptorDecodeErrorZ {
1904 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1905 result: Box::into_raw(Box::new(o)),
1911 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
1912 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1913 CResult_SpendableOutputDescriptorDecodeErrorZ {
1914 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1915 err: Box::into_raw(Box::new(e)),
1920 /// Checks if the given object is currently in the success state
1922 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
1926 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
1927 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
1928 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
1929 fn drop(&mut self) {
1931 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1932 let _ = unsafe { Box::from_raw(self.contents.result) };
1935 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1936 let _ = unsafe { Box::from_raw(self.contents.err) };
1941 impl From<crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
1942 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1943 let contents = if o.result_ok {
1944 let result = unsafe { o.contents.result };
1945 unsafe { o.contents.result = core::ptr::null_mut() };
1946 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
1948 let err = unsafe { o.contents.err };
1949 unsafe { o.contents.err = core::ptr::null_mut(); }
1950 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
1954 result_ok: o.result_ok,
1958 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
1959 fn clone(&self) -> Self {
1961 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1962 result: Box::into_raw(Box::new(<crate::lightning::sign::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1965 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1966 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1972 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
1973 /// but with all dynamically-allocated buffers duplicated in new buffers.
1974 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1976 /// A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size.
1977 /// This corresponds to std::vector in C++
1978 pub struct CVec_SpendableOutputDescriptorZ {
1979 /// The elements in the array.
1980 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1981 pub data: *mut crate::lightning::sign::SpendableOutputDescriptor,
1982 /// The number of elements pointed to by `data`.
1985 impl CVec_SpendableOutputDescriptorZ {
1986 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::SpendableOutputDescriptor> {
1987 if self.datalen == 0 { return Vec::new(); }
1988 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1989 self.data = core::ptr::null_mut();
1993 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::SpendableOutputDescriptor] {
1994 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1997 impl From<Vec<crate::lightning::sign::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
1998 fn from(v: Vec<crate::lightning::sign::SpendableOutputDescriptor>) -> Self {
1999 let datalen = v.len();
2000 let data = Box::into_raw(v.into_boxed_slice());
2001 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2005 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2006 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2007 impl Drop for CVec_SpendableOutputDescriptorZ {
2008 fn drop(&mut self) {
2009 if self.datalen == 0 { return; }
2010 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2013 impl Clone for CVec_SpendableOutputDescriptorZ {
2014 fn clone(&self) -> Self {
2015 let mut res = Vec::new();
2016 if self.datalen == 0 { return Self::from(res); }
2017 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2022 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
2023 /// This corresponds to std::vector in C++
2024 pub struct CVec_TxOutZ {
2025 /// The elements in the array.
2026 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2027 pub data: *mut crate::c_types::TxOut,
2028 /// The number of elements pointed to by `data`.
2032 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
2033 if self.datalen == 0 { return Vec::new(); }
2034 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2035 self.data = core::ptr::null_mut();
2039 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
2040 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2043 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
2044 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
2045 let datalen = v.len();
2046 let data = Box::into_raw(v.into_boxed_slice());
2047 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2051 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2052 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
2053 impl Drop for CVec_TxOutZ {
2054 fn drop(&mut self) {
2055 if self.datalen == 0 { return; }
2056 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2059 impl Clone for CVec_TxOutZ {
2060 fn clone(&self) -> Self {
2061 let mut res = Vec::new();
2062 if self.datalen == 0 { return Self::from(res); }
2063 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2069 /// An enum which can either contain a u32 or not
2070 pub enum COption_u32Z {
2071 /// When we're in this state, this COption_u32Z contains a u32
2073 /// When we're in this state, this COption_u32Z contains nothing
2077 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2078 if let Self::None = self { false } else { true }
2080 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2083 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
2084 if let Self::Some(v) = self { v } else { unreachable!() }
2088 /// Constructs a new COption_u32Z containing a u32
2089 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
2090 COption_u32Z::Some(o)
2093 /// Constructs a new COption_u32Z containing nothing
2094 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
2098 /// Frees any resources associated with the u32, if we are in the Some state
2099 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
2101 /// Creates a new COption_u32Z which has the same data as `orig`
2102 /// but with all dynamically-allocated buffers duplicated in new buffers.
2103 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
2105 /// A tuple of 2 elements. See the individual fields for the types contained.
2106 pub struct C2Tuple_CVec_u8Zu64Z {
2107 /// The element at position 0
2108 pub a: crate::c_types::derived::CVec_u8Z,
2109 /// The element at position 1
2112 impl From<(crate::c_types::derived::CVec_u8Z, u64)> for C2Tuple_CVec_u8Zu64Z {
2113 fn from (tup: (crate::c_types::derived::CVec_u8Z, u64)) -> Self {
2120 impl C2Tuple_CVec_u8Zu64Z {
2121 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, u64) {
2125 impl Clone for C2Tuple_CVec_u8Zu64Z {
2126 fn clone(&self) -> Self {
2128 a: Clone::clone(&self.a),
2129 b: Clone::clone(&self.b),
2134 /// Creates a new tuple which has the same data as `orig`
2135 /// but with all dynamically-allocated buffers duplicated in new buffers.
2136 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_clone(orig: &C2Tuple_CVec_u8Zu64Z) -> C2Tuple_CVec_u8Zu64Z { Clone::clone(&orig) }
2137 /// Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements.
2139 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_new(a: crate::c_types::derived::CVec_u8Z, b: u64) -> C2Tuple_CVec_u8Zu64Z {
2140 C2Tuple_CVec_u8Zu64Z { a, b, }
2144 /// Frees any resources used by the C2Tuple_CVec_u8Zu64Z.
2145 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_free(_res: C2Tuple_CVec_u8Zu64Z) { }
2147 /// The contents of CResult_C2Tuple_CVec_u8Zu64ZNoneZ
2148 pub union CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2149 /// A pointer to the contents in the success state.
2150 /// Reading from this pointer when `result_ok` is not set is undefined.
2151 pub result: *mut crate::c_types::derived::C2Tuple_CVec_u8Zu64Z,
2152 /// Note that this value is always NULL, as there are no contents in the Err variant
2153 pub err: *mut core::ffi::c_void,
2156 /// A CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents the result of a fallible operation,
2157 /// containing a crate::c_types::derived::C2Tuple_CVec_u8Zu64Z on success and a () on failure.
2158 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2159 pub struct CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2160 /// The contents of this CResult_C2Tuple_CVec_u8Zu64ZNoneZ, accessible via either
2161 /// `err` or `result` depending on the state of `result_ok`.
2162 pub contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr,
2163 /// Whether this CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents a success state.
2164 pub result_ok: bool,
2167 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state.
2168 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8Zu64Z) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2169 CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2170 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2171 result: Box::into_raw(Box::new(o)),
2177 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state.
2178 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2179 CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2180 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2181 err: core::ptr::null_mut(),
2186 /// Checks if the given object is currently in the success state
2188 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> bool {
2192 /// Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ.
2193 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res: CResult_C2Tuple_CVec_u8Zu64ZNoneZ) { }
2194 impl Drop for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2195 fn drop(&mut self) {
2197 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2198 let _ = unsafe { Box::from_raw(self.contents.result) };
2204 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, ()>> for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2205 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, ()>) -> Self {
2206 let contents = if o.result_ok {
2207 let result = unsafe { o.contents.result };
2208 unsafe { o.contents.result = core::ptr::null_mut() };
2209 CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { result }
2211 let _ = unsafe { Box::from_raw(o.contents.err) };
2212 o.contents.err = core::ptr::null_mut();
2213 CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { err: core::ptr::null_mut() }
2217 result_ok: o.result_ok,
2221 impl Clone for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2222 fn clone(&self) -> Self {
2224 Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2225 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z>::clone(unsafe { &*self.contents.result })))
2228 Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2229 err: core::ptr::null_mut()
2235 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig`
2236 /// but with all dynamically-allocated buffers duplicated in new buffers.
2237 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { Clone::clone(&orig) }
2239 /// The contents of CResult_ChannelDerivationParametersDecodeErrorZ
2240 pub union CResult_ChannelDerivationParametersDecodeErrorZPtr {
2241 /// A pointer to the contents in the success state.
2242 /// Reading from this pointer when `result_ok` is not set is undefined.
2243 pub result: *mut crate::lightning::sign::ChannelDerivationParameters,
2244 /// A pointer to the contents in the error state.
2245 /// Reading from this pointer when `result_ok` is set is undefined.
2246 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2249 /// A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
2250 /// containing a crate::lightning::sign::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2252 pub struct CResult_ChannelDerivationParametersDecodeErrorZ {
2253 /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
2254 /// `err` or `result` depending on the state of `result_ok`.
2255 pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr,
2256 /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
2257 pub result_ok: bool,
2260 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
2261 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::sign::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ {
2262 CResult_ChannelDerivationParametersDecodeErrorZ {
2263 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2264 result: Box::into_raw(Box::new(o)),
2270 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
2271 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ {
2272 CResult_ChannelDerivationParametersDecodeErrorZ {
2273 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2274 err: Box::into_raw(Box::new(e)),
2279 /// Checks if the given object is currently in the success state
2281 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool {
2285 /// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
2286 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { }
2287 impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ {
2288 fn drop(&mut self) {
2290 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2291 let _ = unsafe { Box::from_raw(self.contents.result) };
2294 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2295 let _ = unsafe { Box::from_raw(self.contents.err) };
2300 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDerivationParametersDecodeErrorZ {
2301 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2302 let contents = if o.result_ok {
2303 let result = unsafe { o.contents.result };
2304 unsafe { o.contents.result = core::ptr::null_mut() };
2305 CResult_ChannelDerivationParametersDecodeErrorZPtr { result }
2307 let err = unsafe { o.contents.err };
2308 unsafe { o.contents.err = core::ptr::null_mut(); }
2309 CResult_ChannelDerivationParametersDecodeErrorZPtr { err }
2313 result_ok: o.result_ok,
2317 impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ {
2318 fn clone(&self) -> Self {
2320 Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2321 result: Box::into_raw(Box::new(<crate::lightning::sign::ChannelDerivationParameters>::clone(unsafe { &*self.contents.result })))
2324 Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2325 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2331 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
2332 /// but with all dynamically-allocated buffers duplicated in new buffers.
2333 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) }
2335 /// The contents of CResult_HTLCDescriptorDecodeErrorZ
2336 pub union CResult_HTLCDescriptorDecodeErrorZPtr {
2337 /// A pointer to the contents in the success state.
2338 /// Reading from this pointer when `result_ok` is not set is undefined.
2339 pub result: *mut crate::lightning::sign::HTLCDescriptor,
2340 /// A pointer to the contents in the error state.
2341 /// Reading from this pointer when `result_ok` is set is undefined.
2342 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2345 /// A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
2346 /// containing a crate::lightning::sign::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2348 pub struct CResult_HTLCDescriptorDecodeErrorZ {
2349 /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
2350 /// `err` or `result` depending on the state of `result_ok`.
2351 pub contents: CResult_HTLCDescriptorDecodeErrorZPtr,
2352 /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
2353 pub result_ok: bool,
2356 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
2357 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ {
2358 CResult_HTLCDescriptorDecodeErrorZ {
2359 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2360 result: Box::into_raw(Box::new(o)),
2366 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
2367 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ {
2368 CResult_HTLCDescriptorDecodeErrorZ {
2369 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2370 err: Box::into_raw(Box::new(e)),
2375 /// Checks if the given object is currently in the success state
2377 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool {
2381 /// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
2382 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { }
2383 impl Drop for CResult_HTLCDescriptorDecodeErrorZ {
2384 fn drop(&mut self) {
2386 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2387 let _ = unsafe { Box::from_raw(self.contents.result) };
2390 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2391 let _ = unsafe { Box::from_raw(self.contents.err) };
2396 impl From<crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCDescriptorDecodeErrorZ {
2397 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2398 let contents = if o.result_ok {
2399 let result = unsafe { o.contents.result };
2400 unsafe { o.contents.result = core::ptr::null_mut() };
2401 CResult_HTLCDescriptorDecodeErrorZPtr { result }
2403 let err = unsafe { o.contents.err };
2404 unsafe { o.contents.err = core::ptr::null_mut(); }
2405 CResult_HTLCDescriptorDecodeErrorZPtr { err }
2409 result_ok: o.result_ok,
2413 impl Clone for CResult_HTLCDescriptorDecodeErrorZ {
2414 fn clone(&self) -> Self {
2416 Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2417 result: Box::into_raw(Box::new(<crate::lightning::sign::HTLCDescriptor>::clone(unsafe { &*self.contents.result })))
2420 Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2421 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2427 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
2428 /// but with all dynamically-allocated buffers duplicated in new buffers.
2429 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) }
2431 /// The contents of CResult_NoneNoneZ
2432 pub union CResult_NoneNoneZPtr {
2433 /// Note that this value is always NULL, as there are no contents in the OK variant
2434 pub result: *mut core::ffi::c_void,
2435 /// Note that this value is always NULL, as there are no contents in the Err variant
2436 pub err: *mut core::ffi::c_void,
2439 /// A CResult_NoneNoneZ represents the result of a fallible operation,
2440 /// containing a () on success and a () on failure.
2441 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2442 pub struct CResult_NoneNoneZ {
2443 /// The contents of this CResult_NoneNoneZ, accessible via either
2444 /// `err` or `result` depending on the state of `result_ok`.
2445 pub contents: CResult_NoneNoneZPtr,
2446 /// Whether this CResult_NoneNoneZ represents a success state.
2447 pub result_ok: bool,
2450 /// Creates a new CResult_NoneNoneZ in the success state.
2451 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
2453 contents: CResult_NoneNoneZPtr {
2454 result: core::ptr::null_mut(),
2460 /// Creates a new CResult_NoneNoneZ in the error state.
2461 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
2463 contents: CResult_NoneNoneZPtr {
2464 err: core::ptr::null_mut(),
2469 /// Checks if the given object is currently in the success state
2471 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
2475 /// Frees any resources used by the CResult_NoneNoneZ.
2476 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
2477 impl Drop for CResult_NoneNoneZ {
2478 fn drop(&mut self) {
2484 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
2485 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
2486 let contents = if o.result_ok {
2487 let _ = unsafe { Box::from_raw(o.contents.result) };
2488 o.contents.result = core::ptr::null_mut();
2489 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
2491 let _ = unsafe { Box::from_raw(o.contents.err) };
2492 o.contents.err = core::ptr::null_mut();
2493 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
2497 result_ok: o.result_ok,
2501 impl Clone for CResult_NoneNoneZ {
2502 fn clone(&self) -> Self {
2504 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
2505 result: core::ptr::null_mut()
2508 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
2509 err: core::ptr::null_mut()
2515 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
2516 /// but with all dynamically-allocated buffers duplicated in new buffers.
2517 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
2519 /// The contents of CResult_PublicKeyNoneZ
2520 pub union CResult_PublicKeyNoneZPtr {
2521 /// A pointer to the contents in the success state.
2522 /// Reading from this pointer when `result_ok` is not set is undefined.
2523 pub result: *mut crate::c_types::PublicKey,
2524 /// Note that this value is always NULL, as there are no contents in the Err variant
2525 pub err: *mut core::ffi::c_void,
2528 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
2529 /// containing a crate::c_types::PublicKey on success and a () on failure.
2530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2531 pub struct CResult_PublicKeyNoneZ {
2532 /// The contents of this CResult_PublicKeyNoneZ, accessible via either
2533 /// `err` or `result` depending on the state of `result_ok`.
2534 pub contents: CResult_PublicKeyNoneZPtr,
2535 /// Whether this CResult_PublicKeyNoneZ represents a success state.
2536 pub result_ok: bool,
2539 /// Creates a new CResult_PublicKeyNoneZ in the success state.
2540 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
2541 CResult_PublicKeyNoneZ {
2542 contents: CResult_PublicKeyNoneZPtr {
2543 result: Box::into_raw(Box::new(o)),
2549 /// Creates a new CResult_PublicKeyNoneZ in the error state.
2550 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
2551 CResult_PublicKeyNoneZ {
2552 contents: CResult_PublicKeyNoneZPtr {
2553 err: core::ptr::null_mut(),
2558 /// Checks if the given object is currently in the success state
2560 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
2564 /// Frees any resources used by the CResult_PublicKeyNoneZ.
2565 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
2566 impl Drop for CResult_PublicKeyNoneZ {
2567 fn drop(&mut self) {
2569 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2570 let _ = unsafe { Box::from_raw(self.contents.result) };
2576 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
2577 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
2578 let contents = if o.result_ok {
2579 let result = unsafe { o.contents.result };
2580 unsafe { o.contents.result = core::ptr::null_mut() };
2581 CResult_PublicKeyNoneZPtr { result }
2583 let _ = unsafe { Box::from_raw(o.contents.err) };
2584 o.contents.err = core::ptr::null_mut();
2585 CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
2589 result_ok: o.result_ok,
2593 impl Clone for CResult_PublicKeyNoneZ {
2594 fn clone(&self) -> Self {
2596 Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
2597 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
2600 Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
2601 err: core::ptr::null_mut()
2607 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
2608 /// but with all dynamically-allocated buffers duplicated in new buffers.
2609 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
2612 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
2613 pub enum COption_BigEndianScalarZ {
2614 /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar
2615 Some(crate::c_types::BigEndianScalar),
2616 /// When we're in this state, this COption_BigEndianScalarZ contains nothing
2619 impl COption_BigEndianScalarZ {
2620 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2621 if let Self::None = self { false } else { true }
2623 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2626 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
2627 if let Self::Some(v) = self { v } else { unreachable!() }
2631 /// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar
2632 pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ {
2633 COption_BigEndianScalarZ::Some(o)
2636 /// Constructs a new COption_BigEndianScalarZ containing nothing
2637 pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ {
2638 COption_BigEndianScalarZ::None
2641 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
2642 pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { }
2644 /// Creates a new COption_BigEndianScalarZ which has the same data as `orig`
2645 /// but with all dynamically-allocated buffers duplicated in new buffers.
2646 pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) }
2648 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2649 /// This corresponds to std::vector in C++
2650 pub struct CVec_U5Z {
2651 /// The elements in the array.
2652 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2653 pub data: *mut crate::c_types::U5,
2654 /// The number of elements pointed to by `data`.
2658 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
2659 if self.datalen == 0 { return Vec::new(); }
2660 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2661 self.data = core::ptr::null_mut();
2665 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
2666 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2669 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
2670 fn from(v: Vec<crate::c_types::U5>) -> Self {
2671 let datalen = v.len();
2672 let data = Box::into_raw(v.into_boxed_slice());
2673 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2677 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2678 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
2679 impl Drop for CVec_U5Z {
2680 fn drop(&mut self) {
2681 if self.datalen == 0 { return; }
2682 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2685 impl Clone for CVec_U5Z {
2686 fn clone(&self) -> Self {
2687 let mut res = Vec::new();
2688 if self.datalen == 0 { return Self::from(res); }
2689 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2694 /// The contents of CResult_RecoverableSignatureNoneZ
2695 pub union CResult_RecoverableSignatureNoneZPtr {
2696 /// A pointer to the contents in the success state.
2697 /// Reading from this pointer when `result_ok` is not set is undefined.
2698 pub result: *mut crate::c_types::RecoverableSignature,
2699 /// Note that this value is always NULL, as there are no contents in the Err variant
2700 pub err: *mut core::ffi::c_void,
2703 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2704 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
2705 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2706 pub struct CResult_RecoverableSignatureNoneZ {
2707 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2708 /// `err` or `result` depending on the state of `result_ok`.
2709 pub contents: CResult_RecoverableSignatureNoneZPtr,
2710 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
2711 pub result_ok: bool,
2714 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
2715 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
2716 CResult_RecoverableSignatureNoneZ {
2717 contents: CResult_RecoverableSignatureNoneZPtr {
2718 result: Box::into_raw(Box::new(o)),
2724 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
2725 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
2726 CResult_RecoverableSignatureNoneZ {
2727 contents: CResult_RecoverableSignatureNoneZPtr {
2728 err: core::ptr::null_mut(),
2733 /// Checks if the given object is currently in the success state
2735 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
2739 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
2740 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
2741 impl Drop for CResult_RecoverableSignatureNoneZ {
2742 fn drop(&mut self) {
2744 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2745 let _ = unsafe { Box::from_raw(self.contents.result) };
2751 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2752 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2753 let contents = if o.result_ok {
2754 let result = unsafe { o.contents.result };
2755 unsafe { o.contents.result = core::ptr::null_mut() };
2756 CResult_RecoverableSignatureNoneZPtr { result }
2758 let _ = unsafe { Box::from_raw(o.contents.err) };
2759 o.contents.err = core::ptr::null_mut();
2760 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2764 result_ok: o.result_ok,
2768 impl Clone for CResult_RecoverableSignatureNoneZ {
2769 fn clone(&self) -> Self {
2771 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2772 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2775 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2776 err: core::ptr::null_mut()
2782 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2783 /// but with all dynamically-allocated buffers duplicated in new buffers.
2784 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2786 /// The contents of CResult_ECDSASignatureNoneZ
2787 pub union CResult_ECDSASignatureNoneZPtr {
2788 /// A pointer to the contents in the success state.
2789 /// Reading from this pointer when `result_ok` is not set is undefined.
2790 pub result: *mut crate::c_types::ECDSASignature,
2791 /// Note that this value is always NULL, as there are no contents in the Err variant
2792 pub err: *mut core::ffi::c_void,
2795 /// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation,
2796 /// containing a crate::c_types::ECDSASignature on success and a () on failure.
2797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2798 pub struct CResult_ECDSASignatureNoneZ {
2799 /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either
2800 /// `err` or `result` depending on the state of `result_ok`.
2801 pub contents: CResult_ECDSASignatureNoneZPtr,
2802 /// Whether this CResult_ECDSASignatureNoneZ represents a success state.
2803 pub result_ok: bool,
2806 /// Creates a new CResult_ECDSASignatureNoneZ in the success state.
2807 pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ {
2808 CResult_ECDSASignatureNoneZ {
2809 contents: CResult_ECDSASignatureNoneZPtr {
2810 result: Box::into_raw(Box::new(o)),
2816 /// Creates a new CResult_ECDSASignatureNoneZ in the error state.
2817 pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ {
2818 CResult_ECDSASignatureNoneZ {
2819 contents: CResult_ECDSASignatureNoneZPtr {
2820 err: core::ptr::null_mut(),
2825 /// Checks if the given object is currently in the success state
2827 pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool {
2831 /// Frees any resources used by the CResult_ECDSASignatureNoneZ.
2832 pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { }
2833 impl Drop for CResult_ECDSASignatureNoneZ {
2834 fn drop(&mut self) {
2836 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2837 let _ = unsafe { Box::from_raw(self.contents.result) };
2843 impl From<crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>> for CResult_ECDSASignatureNoneZ {
2844 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>) -> Self {
2845 let contents = if o.result_ok {
2846 let result = unsafe { o.contents.result };
2847 unsafe { o.contents.result = core::ptr::null_mut() };
2848 CResult_ECDSASignatureNoneZPtr { result }
2850 let _ = unsafe { Box::from_raw(o.contents.err) };
2851 o.contents.err = core::ptr::null_mut();
2852 CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() }
2856 result_ok: o.result_ok,
2860 impl Clone for CResult_ECDSASignatureNoneZ {
2861 fn clone(&self) -> Self {
2863 Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr {
2864 result: Box::into_raw(Box::new(<crate::c_types::ECDSASignature>::clone(unsafe { &*self.contents.result })))
2867 Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr {
2868 err: core::ptr::null_mut()
2874 /// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig`
2875 /// but with all dynamically-allocated buffers duplicated in new buffers.
2876 pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) }
2878 /// The contents of CResult_TransactionNoneZ
2879 pub union CResult_TransactionNoneZPtr {
2880 /// A pointer to the contents in the success state.
2881 /// Reading from this pointer when `result_ok` is not set is undefined.
2882 pub result: *mut crate::c_types::Transaction,
2883 /// Note that this value is always NULL, as there are no contents in the Err variant
2884 pub err: *mut core::ffi::c_void,
2887 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
2888 /// containing a crate::c_types::Transaction on success and a () on failure.
2889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2890 pub struct CResult_TransactionNoneZ {
2891 /// The contents of this CResult_TransactionNoneZ, accessible via either
2892 /// `err` or `result` depending on the state of `result_ok`.
2893 pub contents: CResult_TransactionNoneZPtr,
2894 /// Whether this CResult_TransactionNoneZ represents a success state.
2895 pub result_ok: bool,
2898 /// Creates a new CResult_TransactionNoneZ in the success state.
2899 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
2900 CResult_TransactionNoneZ {
2901 contents: CResult_TransactionNoneZPtr {
2902 result: Box::into_raw(Box::new(o)),
2908 /// Creates a new CResult_TransactionNoneZ in the error state.
2909 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
2910 CResult_TransactionNoneZ {
2911 contents: CResult_TransactionNoneZPtr {
2912 err: core::ptr::null_mut(),
2917 /// Checks if the given object is currently in the success state
2919 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
2923 /// Frees any resources used by the CResult_TransactionNoneZ.
2924 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
2925 impl Drop for CResult_TransactionNoneZ {
2926 fn drop(&mut self) {
2928 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2929 let _ = unsafe { Box::from_raw(self.contents.result) };
2935 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
2936 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
2937 let contents = if o.result_ok {
2938 let result = unsafe { o.contents.result };
2939 unsafe { o.contents.result = core::ptr::null_mut() };
2940 CResult_TransactionNoneZPtr { result }
2942 let _ = unsafe { Box::from_raw(o.contents.err) };
2943 o.contents.err = core::ptr::null_mut();
2944 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
2948 result_ok: o.result_ok,
2952 impl Clone for CResult_TransactionNoneZ {
2953 fn clone(&self) -> Self {
2955 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
2956 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
2959 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
2960 err: core::ptr::null_mut()
2966 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
2967 /// but with all dynamically-allocated buffers duplicated in new buffers.
2968 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
2970 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2971 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2972 /// A pointer to the contents in the success state.
2973 /// Reading from this pointer when `result_ok` is not set is undefined.
2974 pub result: *mut crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner,
2975 /// A pointer to the contents in the error state.
2976 /// Reading from this pointer when `result_ok` is set is undefined.
2977 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2980 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2981 /// containing a crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2982 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2983 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2984 /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2985 /// `err` or `result` depending on the state of `result_ok`.
2986 pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2987 /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2988 pub result_ok: bool,
2991 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2992 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2993 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2994 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2995 result: Box::into_raw(Box::new(o)),
3001 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
3002 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3003 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3004 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
3005 err: Box::into_raw(Box::new(e)),
3010 /// Checks if the given object is currently in the success state
3012 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
3016 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
3017 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
3018 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3019 fn drop(&mut self) {
3021 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3022 let _ = unsafe { Box::from_raw(self.contents.result) };
3025 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3026 let _ = unsafe { Box::from_raw(self.contents.err) };
3031 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3032 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3033 let contents = if o.result_ok {
3034 let result = unsafe { o.contents.result };
3035 unsafe { o.contents.result = core::ptr::null_mut() };
3036 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
3038 let err = unsafe { o.contents.err };
3039 unsafe { o.contents.err = core::ptr::null_mut(); }
3040 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
3044 result_ok: o.result_ok,
3048 impl Clone for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3049 fn clone(&self) -> Self {
3051 Self { result_ok: true, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
3052 result: Box::into_raw(Box::new(<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner>::clone(unsafe { &*self.contents.result })))
3055 Self { result_ok: false, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
3056 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3062 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig`
3063 /// but with all dynamically-allocated buffers duplicated in new buffers.
3064 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) }
3066 /// The contents of CResult_CVec_u8ZNoneZ
3067 pub union CResult_CVec_u8ZNoneZPtr {
3068 /// A pointer to the contents in the success state.
3069 /// Reading from this pointer when `result_ok` is not set is undefined.
3070 pub result: *mut crate::c_types::derived::CVec_u8Z,
3071 /// Note that this value is always NULL, as there are no contents in the Err variant
3072 pub err: *mut core::ffi::c_void,
3075 /// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation,
3076 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
3077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3078 pub struct CResult_CVec_u8ZNoneZ {
3079 /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either
3080 /// `err` or `result` depending on the state of `result_ok`.
3081 pub contents: CResult_CVec_u8ZNoneZPtr,
3082 /// Whether this CResult_CVec_u8ZNoneZ represents a success state.
3083 pub result_ok: bool,
3086 /// Creates a new CResult_CVec_u8ZNoneZ in the success state.
3087 pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ {
3088 CResult_CVec_u8ZNoneZ {
3089 contents: CResult_CVec_u8ZNoneZPtr {
3090 result: Box::into_raw(Box::new(o)),
3096 /// Creates a new CResult_CVec_u8ZNoneZ in the error state.
3097 pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ {
3098 CResult_CVec_u8ZNoneZ {
3099 contents: CResult_CVec_u8ZNoneZPtr {
3100 err: core::ptr::null_mut(),
3105 /// Checks if the given object is currently in the success state
3107 pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool {
3111 /// Frees any resources used by the CResult_CVec_u8ZNoneZ.
3112 pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { }
3113 impl Drop for CResult_CVec_u8ZNoneZ {
3114 fn drop(&mut self) {
3116 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3117 let _ = unsafe { Box::from_raw(self.contents.result) };
3123 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_CVec_u8ZNoneZ {
3124 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
3125 let contents = if o.result_ok {
3126 let result = unsafe { o.contents.result };
3127 unsafe { o.contents.result = core::ptr::null_mut() };
3128 CResult_CVec_u8ZNoneZPtr { result }
3130 let _ = unsafe { Box::from_raw(o.contents.err) };
3131 o.contents.err = core::ptr::null_mut();
3132 CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() }
3136 result_ok: o.result_ok,
3140 impl Clone for CResult_CVec_u8ZNoneZ {
3141 fn clone(&self) -> Self {
3143 Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr {
3144 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
3147 Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr {
3148 err: core::ptr::null_mut()
3154 /// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig`
3155 /// but with all dynamically-allocated buffers duplicated in new buffers.
3156 pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) }
3158 /// The contents of CResult_ShutdownScriptNoneZ
3159 pub union CResult_ShutdownScriptNoneZPtr {
3160 /// A pointer to the contents in the success state.
3161 /// Reading from this pointer when `result_ok` is not set is undefined.
3162 pub result: *mut crate::lightning::ln::script::ShutdownScript,
3163 /// Note that this value is always NULL, as there are no contents in the Err variant
3164 pub err: *mut core::ffi::c_void,
3167 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
3168 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
3169 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3170 pub struct CResult_ShutdownScriptNoneZ {
3171 /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
3172 /// `err` or `result` depending on the state of `result_ok`.
3173 pub contents: CResult_ShutdownScriptNoneZPtr,
3174 /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
3175 pub result_ok: bool,
3178 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
3179 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
3180 CResult_ShutdownScriptNoneZ {
3181 contents: CResult_ShutdownScriptNoneZPtr {
3182 result: Box::into_raw(Box::new(o)),
3188 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
3189 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
3190 CResult_ShutdownScriptNoneZ {
3191 contents: CResult_ShutdownScriptNoneZPtr {
3192 err: core::ptr::null_mut(),
3197 /// Checks if the given object is currently in the success state
3199 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
3203 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
3204 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
3205 impl Drop for CResult_ShutdownScriptNoneZ {
3206 fn drop(&mut self) {
3208 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3209 let _ = unsafe { Box::from_raw(self.contents.result) };
3215 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
3216 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
3217 let contents = if o.result_ok {
3218 let result = unsafe { o.contents.result };
3219 unsafe { o.contents.result = core::ptr::null_mut() };
3220 CResult_ShutdownScriptNoneZPtr { result }
3222 let _ = unsafe { Box::from_raw(o.contents.err) };
3223 o.contents.err = core::ptr::null_mut();
3224 CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
3228 result_ok: o.result_ok,
3232 impl Clone for CResult_ShutdownScriptNoneZ {
3233 fn clone(&self) -> Self {
3235 Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
3236 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
3239 Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
3240 err: core::ptr::null_mut()
3246 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
3247 /// but with all dynamically-allocated buffers duplicated in new buffers.
3248 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
3251 /// An enum which can either contain a u16 or not
3252 pub enum COption_u16Z {
3253 /// When we're in this state, this COption_u16Z contains a u16
3255 /// When we're in this state, this COption_u16Z contains nothing
3259 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3260 if let Self::None = self { false } else { true }
3262 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3265 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
3266 if let Self::Some(v) = self { v } else { unreachable!() }
3270 /// Constructs a new COption_u16Z containing a u16
3271 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
3272 COption_u16Z::Some(o)
3275 /// Constructs a new COption_u16Z containing nothing
3276 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
3280 /// Frees any resources associated with the u16, if we are in the Some state
3281 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
3283 /// Creates a new COption_u16Z which has the same data as `orig`
3284 /// but with all dynamically-allocated buffers duplicated in new buffers.
3285 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
3288 /// An enum which can either contain a bool or not
3289 pub enum COption_boolZ {
3290 /// When we're in this state, this COption_boolZ contains a bool
3292 /// When we're in this state, this COption_boolZ contains nothing
3295 impl COption_boolZ {
3296 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3297 if let Self::None = self { false } else { true }
3299 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3302 #[allow(unused)] pub(crate) fn take(mut self) -> bool {
3303 if let Self::Some(v) = self { v } else { unreachable!() }
3307 /// Constructs a new COption_boolZ containing a bool
3308 pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ {
3309 COption_boolZ::Some(o)
3312 /// Constructs a new COption_boolZ containing nothing
3313 pub extern "C" fn COption_boolZ_none() -> COption_boolZ {
3317 /// Frees any resources associated with the bool, if we are in the Some state
3318 pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { }
3320 /// Creates a new COption_boolZ which has the same data as `orig`
3321 /// but with all dynamically-allocated buffers duplicated in new buffers.
3322 pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) }
3324 /// The contents of CResult_WitnessNoneZ
3325 pub union CResult_WitnessNoneZPtr {
3326 /// A pointer to the contents in the success state.
3327 /// Reading from this pointer when `result_ok` is not set is undefined.
3328 pub result: *mut crate::c_types::Witness,
3329 /// Note that this value is always NULL, as there are no contents in the Err variant
3330 pub err: *mut core::ffi::c_void,
3333 /// A CResult_WitnessNoneZ represents the result of a fallible operation,
3334 /// containing a crate::c_types::Witness on success and a () on failure.
3335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3336 pub struct CResult_WitnessNoneZ {
3337 /// The contents of this CResult_WitnessNoneZ, accessible via either
3338 /// `err` or `result` depending on the state of `result_ok`.
3339 pub contents: CResult_WitnessNoneZPtr,
3340 /// Whether this CResult_WitnessNoneZ represents a success state.
3341 pub result_ok: bool,
3344 /// Creates a new CResult_WitnessNoneZ in the success state.
3345 pub extern "C" fn CResult_WitnessNoneZ_ok(o: crate::c_types::Witness) -> CResult_WitnessNoneZ {
3346 CResult_WitnessNoneZ {
3347 contents: CResult_WitnessNoneZPtr {
3348 result: Box::into_raw(Box::new(o)),
3354 /// Creates a new CResult_WitnessNoneZ in the error state.
3355 pub extern "C" fn CResult_WitnessNoneZ_err() -> CResult_WitnessNoneZ {
3356 CResult_WitnessNoneZ {
3357 contents: CResult_WitnessNoneZPtr {
3358 err: core::ptr::null_mut(),
3363 /// Checks if the given object is currently in the success state
3365 pub extern "C" fn CResult_WitnessNoneZ_is_ok(o: &CResult_WitnessNoneZ) -> bool {
3369 /// Frees any resources used by the CResult_WitnessNoneZ.
3370 pub extern "C" fn CResult_WitnessNoneZ_free(_res: CResult_WitnessNoneZ) { }
3371 impl Drop for CResult_WitnessNoneZ {
3372 fn drop(&mut self) {
3374 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3375 let _ = unsafe { Box::from_raw(self.contents.result) };
3381 impl From<crate::c_types::CResultTempl<crate::c_types::Witness, ()>> for CResult_WitnessNoneZ {
3382 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Witness, ()>) -> Self {
3383 let contents = if o.result_ok {
3384 let result = unsafe { o.contents.result };
3385 unsafe { o.contents.result = core::ptr::null_mut() };
3386 CResult_WitnessNoneZPtr { result }
3388 let _ = unsafe { Box::from_raw(o.contents.err) };
3389 o.contents.err = core::ptr::null_mut();
3390 CResult_WitnessNoneZPtr { err: core::ptr::null_mut() }
3394 result_ok: o.result_ok,
3398 impl Clone for CResult_WitnessNoneZ {
3399 fn clone(&self) -> Self {
3401 Self { result_ok: true, contents: CResult_WitnessNoneZPtr {
3402 result: Box::into_raw(Box::new(<crate::c_types::Witness>::clone(unsafe { &*self.contents.result })))
3405 Self { result_ok: false, contents: CResult_WitnessNoneZPtr {
3406 err: core::ptr::null_mut()
3412 /// Creates a new CResult_WitnessNoneZ which has the same data as `orig`
3413 /// but with all dynamically-allocated buffers duplicated in new buffers.
3414 pub extern "C" fn CResult_WitnessNoneZ_clone(orig: &CResult_WitnessNoneZ) -> CResult_WitnessNoneZ { Clone::clone(&orig) }
3416 /// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size.
3417 /// This corresponds to std::vector in C++
3418 pub struct CVec_ECDSASignatureZ {
3419 /// The elements in the array.
3420 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3421 pub data: *mut crate::c_types::ECDSASignature,
3422 /// The number of elements pointed to by `data`.
3425 impl CVec_ECDSASignatureZ {
3426 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ECDSASignature> {
3427 if self.datalen == 0 { return Vec::new(); }
3428 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3429 self.data = core::ptr::null_mut();
3433 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] {
3434 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3437 impl From<Vec<crate::c_types::ECDSASignature>> for CVec_ECDSASignatureZ {
3438 fn from(v: Vec<crate::c_types::ECDSASignature>) -> Self {
3439 let datalen = v.len();
3440 let data = Box::into_raw(v.into_boxed_slice());
3441 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3445 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3446 pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { }
3447 impl Drop for CVec_ECDSASignatureZ {
3448 fn drop(&mut self) {
3449 if self.datalen == 0 { return; }
3450 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3453 impl Clone for CVec_ECDSASignatureZ {
3454 fn clone(&self) -> Self {
3455 let mut res = Vec::new();
3456 if self.datalen == 0 { return Self::from(res); }
3457 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3462 /// A tuple of 2 elements. See the individual fields for the types contained.
3463 pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3464 /// The element at position 0
3465 pub a: crate::c_types::ECDSASignature,
3466 /// The element at position 1
3467 pub b: crate::c_types::derived::CVec_ECDSASignatureZ,
3469 impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3470 fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self {
3477 impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3478 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) {
3482 impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3483 fn clone(&self) -> Self {
3485 a: Clone::clone(&self.a),
3486 b: Clone::clone(&self.b),
3491 /// Creates a new tuple which has the same data as `orig`
3492 /// but with all dynamically-allocated buffers duplicated in new buffers.
3493 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) }
3494 /// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements.
3496 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3497 C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, }
3501 /// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ.
3502 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { }
3504 /// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ
3505 pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3506 /// A pointer to the contents in the success state.
3507 /// Reading from this pointer when `result_ok` is not set is undefined.
3508 pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ,
3509 /// Note that this value is always NULL, as there are no contents in the Err variant
3510 pub err: *mut core::ffi::c_void,
3513 /// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation,
3514 /// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure.
3515 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3516 pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3517 /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either
3518 /// `err` or `result` depending on the state of `result_ok`.
3519 pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr,
3520 /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state.
3521 pub result_ok: bool,
3524 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state.
3525 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3526 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3527 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3528 result: Box::into_raw(Box::new(o)),
3534 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state.
3535 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3536 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3537 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3538 err: core::ptr::null_mut(),
3543 /// Checks if the given object is currently in the success state
3545 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool {
3549 /// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.
3550 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { }
3551 impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3552 fn drop(&mut self) {
3554 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3555 let _ = unsafe { Box::from_raw(self.contents.result) };
3561 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3562 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>) -> Self {
3563 let contents = if o.result_ok {
3564 let result = unsafe { o.contents.result };
3565 unsafe { o.contents.result = core::ptr::null_mut() };
3566 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result }
3568 let _ = unsafe { Box::from_raw(o.contents.err) };
3569 o.contents.err = core::ptr::null_mut();
3570 CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() }
3574 result_ok: o.result_ok,
3578 impl Clone for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3579 fn clone(&self) -> Self {
3581 Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3582 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ>::clone(unsafe { &*self.contents.result })))
3585 Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3586 err: core::ptr::null_mut()
3592 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig`
3593 /// but with all dynamically-allocated buffers duplicated in new buffers.
3594 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) }
3596 /// The contents of CResult_InMemorySignerDecodeErrorZ
3597 pub union CResult_InMemorySignerDecodeErrorZPtr {
3598 /// A pointer to the contents in the success state.
3599 /// Reading from this pointer when `result_ok` is not set is undefined.
3600 pub result: *mut crate::lightning::sign::InMemorySigner,
3601 /// A pointer to the contents in the error state.
3602 /// Reading from this pointer when `result_ok` is set is undefined.
3603 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3606 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3607 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3608 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3609 pub struct CResult_InMemorySignerDecodeErrorZ {
3610 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3611 /// `err` or `result` depending on the state of `result_ok`.
3612 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3613 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3614 pub result_ok: bool,
3617 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3618 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3619 CResult_InMemorySignerDecodeErrorZ {
3620 contents: CResult_InMemorySignerDecodeErrorZPtr {
3621 result: Box::into_raw(Box::new(o)),
3627 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3628 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3629 CResult_InMemorySignerDecodeErrorZ {
3630 contents: CResult_InMemorySignerDecodeErrorZPtr {
3631 err: Box::into_raw(Box::new(e)),
3636 /// Checks if the given object is currently in the success state
3638 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
3642 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3643 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3644 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3645 fn drop(&mut self) {
3647 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3648 let _ = unsafe { Box::from_raw(self.contents.result) };
3651 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3652 let _ = unsafe { Box::from_raw(self.contents.err) };
3657 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3658 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3659 let contents = if o.result_ok {
3660 let result = unsafe { o.contents.result };
3661 unsafe { o.contents.result = core::ptr::null_mut() };
3662 CResult_InMemorySignerDecodeErrorZPtr { result }
3664 let err = unsafe { o.contents.err };
3665 unsafe { o.contents.err = core::ptr::null_mut(); }
3666 CResult_InMemorySignerDecodeErrorZPtr { err }
3670 result_ok: o.result_ok,
3674 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3675 fn clone(&self) -> Self {
3677 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3678 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3681 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3682 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3688 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3689 /// but with all dynamically-allocated buffers duplicated in new buffers.
3690 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
3692 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
3693 pub enum COption_WriteableScoreZ {
3694 /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
3695 Some(crate::lightning::routing::scoring::WriteableScore),
3696 /// When we're in this state, this COption_WriteableScoreZ contains nothing
3699 impl COption_WriteableScoreZ {
3700 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3701 if let Self::None = self { false } else { true }
3703 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3706 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
3707 if let Self::Some(v) = self { v } else { unreachable!() }
3711 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
3712 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
3713 COption_WriteableScoreZ::Some(o)
3716 /// Constructs a new COption_WriteableScoreZ containing nothing
3717 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
3718 COption_WriteableScoreZ::None
3721 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
3722 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
3724 /// The contents of CResult_NoneIOErrorZ
3725 pub union CResult_NoneIOErrorZPtr {
3726 /// Note that this value is always NULL, as there are no contents in the OK variant
3727 pub result: *mut core::ffi::c_void,
3728 /// A pointer to the contents in the error state.
3729 /// Reading from this pointer when `result_ok` is set is undefined.
3730 pub err: *mut crate::c_types::IOError,
3733 /// A CResult_NoneIOErrorZ represents the result of a fallible operation,
3734 /// containing a () on success and a crate::c_types::IOError on failure.
3735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3736 pub struct CResult_NoneIOErrorZ {
3737 /// The contents of this CResult_NoneIOErrorZ, accessible via either
3738 /// `err` or `result` depending on the state of `result_ok`.
3739 pub contents: CResult_NoneIOErrorZPtr,
3740 /// Whether this CResult_NoneIOErrorZ represents a success state.
3741 pub result_ok: bool,
3744 /// Creates a new CResult_NoneIOErrorZ in the success state.
3745 pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ {
3746 CResult_NoneIOErrorZ {
3747 contents: CResult_NoneIOErrorZPtr {
3748 result: core::ptr::null_mut(),
3754 /// Creates a new CResult_NoneIOErrorZ in the error state.
3755 pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ {
3756 CResult_NoneIOErrorZ {
3757 contents: CResult_NoneIOErrorZPtr {
3758 err: Box::into_raw(Box::new(e)),
3763 /// Checks if the given object is currently in the success state
3765 pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool {
3769 /// Frees any resources used by the CResult_NoneIOErrorZ.
3770 pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { }
3771 impl Drop for CResult_NoneIOErrorZ {
3772 fn drop(&mut self) {
3775 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3776 let _ = unsafe { Box::from_raw(self.contents.err) };
3781 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneIOErrorZ {
3782 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
3783 let contents = if o.result_ok {
3784 let _ = unsafe { Box::from_raw(o.contents.result) };
3785 o.contents.result = core::ptr::null_mut();
3786 CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() }
3788 let err = unsafe { o.contents.err };
3789 unsafe { o.contents.err = core::ptr::null_mut(); }
3790 CResult_NoneIOErrorZPtr { err }
3794 result_ok: o.result_ok,
3798 impl Clone for CResult_NoneIOErrorZ {
3799 fn clone(&self) -> Self {
3801 Self { result_ok: true, contents: CResult_NoneIOErrorZPtr {
3802 result: core::ptr::null_mut()
3805 Self { result_ok: false, contents: CResult_NoneIOErrorZPtr {
3806 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
3812 /// Creates a new CResult_NoneIOErrorZ which has the same data as `orig`
3813 /// but with all dynamically-allocated buffers duplicated in new buffers.
3814 pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) }
3816 /// A dynamically-allocated array of crate::lightning::ln::channel_state::ChannelDetailss of arbitrary size.
3817 /// This corresponds to std::vector in C++
3818 pub struct CVec_ChannelDetailsZ {
3819 /// The elements in the array.
3820 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3821 pub data: *mut crate::lightning::ln::channel_state::ChannelDetails,
3822 /// The number of elements pointed to by `data`.
3825 impl CVec_ChannelDetailsZ {
3826 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channel_state::ChannelDetails> {
3827 if self.datalen == 0 { return Vec::new(); }
3828 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3829 self.data = core::ptr::null_mut();
3833 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channel_state::ChannelDetails] {
3834 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3837 impl From<Vec<crate::lightning::ln::channel_state::ChannelDetails>> for CVec_ChannelDetailsZ {
3838 fn from(v: Vec<crate::lightning::ln::channel_state::ChannelDetails>) -> Self {
3839 let datalen = v.len();
3840 let data = Box::into_raw(v.into_boxed_slice());
3841 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3845 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3846 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3847 impl Drop for CVec_ChannelDetailsZ {
3848 fn drop(&mut self) {
3849 if self.datalen == 0 { return; }
3850 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3853 impl Clone for CVec_ChannelDetailsZ {
3854 fn clone(&self) -> Self {
3855 let mut res = Vec::new();
3856 if self.datalen == 0 { return Self::from(res); }
3857 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3862 /// The contents of CResult_RouteLightningErrorZ
3863 pub union CResult_RouteLightningErrorZPtr {
3864 /// A pointer to the contents in the success state.
3865 /// Reading from this pointer when `result_ok` is not set is undefined.
3866 pub result: *mut crate::lightning::routing::router::Route,
3867 /// A pointer to the contents in the error state.
3868 /// Reading from this pointer when `result_ok` is set is undefined.
3869 pub err: *mut crate::lightning::ln::msgs::LightningError,
3872 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3873 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3875 pub struct CResult_RouteLightningErrorZ {
3876 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3877 /// `err` or `result` depending on the state of `result_ok`.
3878 pub contents: CResult_RouteLightningErrorZPtr,
3879 /// Whether this CResult_RouteLightningErrorZ represents a success state.
3880 pub result_ok: bool,
3883 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3884 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3885 CResult_RouteLightningErrorZ {
3886 contents: CResult_RouteLightningErrorZPtr {
3887 result: Box::into_raw(Box::new(o)),
3893 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3894 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3895 CResult_RouteLightningErrorZ {
3896 contents: CResult_RouteLightningErrorZPtr {
3897 err: Box::into_raw(Box::new(e)),
3902 /// Checks if the given object is currently in the success state
3904 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3908 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3909 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3910 impl Drop for CResult_RouteLightningErrorZ {
3911 fn drop(&mut self) {
3913 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3914 let _ = unsafe { Box::from_raw(self.contents.result) };
3917 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3918 let _ = unsafe { Box::from_raw(self.contents.err) };
3923 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3924 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3925 let contents = if o.result_ok {
3926 let result = unsafe { o.contents.result };
3927 unsafe { o.contents.result = core::ptr::null_mut() };
3928 CResult_RouteLightningErrorZPtr { result }
3930 let err = unsafe { o.contents.err };
3931 unsafe { o.contents.err = core::ptr::null_mut(); }
3932 CResult_RouteLightningErrorZPtr { err }
3936 result_ok: o.result_ok,
3940 impl Clone for CResult_RouteLightningErrorZ {
3941 fn clone(&self) -> Self {
3943 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3944 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3947 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3948 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3954 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3955 /// but with all dynamically-allocated buffers duplicated in new buffers.
3956 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3958 /// A tuple of 2 elements. See the individual fields for the types contained.
3959 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
3960 /// The element at position 0
3961 pub a: crate::lightning::offers::invoice::BlindedPayInfo,
3962 /// The element at position 1
3963 pub b: crate::lightning::blinded_path::BlindedPath,
3965 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
3966 fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
3973 impl C2Tuple_BlindedPayInfoBlindedPathZ {
3974 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
3978 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
3979 fn clone(&self) -> Self {
3981 a: Clone::clone(&self.a),
3982 b: Clone::clone(&self.b),
3987 /// Creates a new tuple which has the same data as `orig`
3988 /// but with all dynamically-allocated buffers duplicated in new buffers.
3989 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
3990 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
3992 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
3993 C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
3997 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
3998 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
4000 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
4001 /// This corresponds to std::vector in C++
4002 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4003 /// The elements in the array.
4004 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4005 pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
4006 /// The number of elements pointed to by `data`.
4009 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4010 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
4011 if self.datalen == 0 { return Vec::new(); }
4012 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4013 self.data = core::ptr::null_mut();
4017 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
4018 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4021 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4022 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
4023 let datalen = v.len();
4024 let data = Box::into_raw(v.into_boxed_slice());
4025 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4029 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4030 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
4031 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4032 fn drop(&mut self) {
4033 if self.datalen == 0 { return; }
4034 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4037 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4038 fn clone(&self) -> Self {
4039 let mut res = Vec::new();
4040 if self.datalen == 0 { return Self::from(res); }
4041 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4046 /// The contents of CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ
4047 pub union CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4048 /// A pointer to the contents in the success state.
4049 /// Reading from this pointer when `result_ok` is not set is undefined.
4050 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ,
4051 /// Note that this value is always NULL, as there are no contents in the Err variant
4052 pub err: *mut core::ffi::c_void,
4055 /// A CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents the result of a fallible operation,
4056 /// containing a crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ on success and a () on failure.
4057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4058 pub struct CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4059 /// The contents of this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ, accessible via either
4060 /// `err` or `result` depending on the state of `result_ok`.
4061 pub contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr,
4062 /// Whether this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents a success state.
4063 pub result_ok: bool,
4066 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the success state.
4067 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4068 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4069 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4070 result: Box::into_raw(Box::new(o)),
4076 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the error state.
4077 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4078 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4079 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4080 err: core::ptr::null_mut(),
4085 /// Checks if the given object is currently in the success state
4087 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> bool {
4091 /// Frees any resources used by the CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ.
4092 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) { }
4093 impl Drop for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4094 fn drop(&mut self) {
4096 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4097 let _ = unsafe { Box::from_raw(self.contents.result) };
4103 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>> for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4104 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>) -> Self {
4105 let contents = if o.result_ok {
4106 let result = unsafe { o.contents.result };
4107 unsafe { o.contents.result = core::ptr::null_mut() };
4108 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { result }
4110 let _ = unsafe { Box::from_raw(o.contents.err) };
4111 o.contents.err = core::ptr::null_mut();
4112 CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { err: core::ptr::null_mut() }
4116 result_ok: o.result_ok,
4120 impl Clone for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4121 fn clone(&self) -> Self {
4123 Self { result_ok: true, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4124 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ>::clone(unsafe { &*self.contents.result })))
4127 Self { result_ok: false, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4128 err: core::ptr::null_mut()
4134 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ which has the same data as `orig`
4135 /// but with all dynamically-allocated buffers duplicated in new buffers.
4136 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ { Clone::clone(&orig) }
4138 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4139 /// This corresponds to std::vector in C++
4140 pub struct CVec_PublicKeyZ {
4141 /// The elements in the array.
4142 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4143 pub data: *mut crate::c_types::PublicKey,
4144 /// The number of elements pointed to by `data`.
4147 impl CVec_PublicKeyZ {
4148 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4149 if self.datalen == 0 { return Vec::new(); }
4150 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4151 self.data = core::ptr::null_mut();
4155 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4156 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4159 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4160 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4161 let datalen = v.len();
4162 let data = Box::into_raw(v.into_boxed_slice());
4163 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4167 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4168 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4169 impl Drop for CVec_PublicKeyZ {
4170 fn drop(&mut self) {
4171 if self.datalen == 0 { return; }
4172 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4175 impl Clone for CVec_PublicKeyZ {
4176 fn clone(&self) -> Self {
4177 let mut res = Vec::new();
4178 if self.datalen == 0 { return Self::from(res); }
4179 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4184 /// The contents of CResult_OnionMessagePathNoneZ
4185 pub union CResult_OnionMessagePathNoneZPtr {
4186 /// A pointer to the contents in the success state.
4187 /// Reading from this pointer when `result_ok` is not set is undefined.
4188 pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
4189 /// Note that this value is always NULL, as there are no contents in the Err variant
4190 pub err: *mut core::ffi::c_void,
4193 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
4194 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
4195 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4196 pub struct CResult_OnionMessagePathNoneZ {
4197 /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
4198 /// `err` or `result` depending on the state of `result_ok`.
4199 pub contents: CResult_OnionMessagePathNoneZPtr,
4200 /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
4201 pub result_ok: bool,
4204 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
4205 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
4206 CResult_OnionMessagePathNoneZ {
4207 contents: CResult_OnionMessagePathNoneZPtr {
4208 result: Box::into_raw(Box::new(o)),
4214 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
4215 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
4216 CResult_OnionMessagePathNoneZ {
4217 contents: CResult_OnionMessagePathNoneZPtr {
4218 err: core::ptr::null_mut(),
4223 /// Checks if the given object is currently in the success state
4225 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
4229 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
4230 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
4231 impl Drop for CResult_OnionMessagePathNoneZ {
4232 fn drop(&mut self) {
4234 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4235 let _ = unsafe { Box::from_raw(self.contents.result) };
4241 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
4242 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
4243 let contents = if o.result_ok {
4244 let result = unsafe { o.contents.result };
4245 unsafe { o.contents.result = core::ptr::null_mut() };
4246 CResult_OnionMessagePathNoneZPtr { result }
4248 let _ = unsafe { Box::from_raw(o.contents.err) };
4249 o.contents.err = core::ptr::null_mut();
4250 CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
4254 result_ok: o.result_ok,
4258 impl Clone for CResult_OnionMessagePathNoneZ {
4259 fn clone(&self) -> Self {
4261 Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
4262 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
4265 Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
4266 err: core::ptr::null_mut()
4272 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
4273 /// but with all dynamically-allocated buffers duplicated in new buffers.
4274 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
4276 /// The contents of CResult_CVec_BlindedPathZNoneZ
4277 pub union CResult_CVec_BlindedPathZNoneZPtr {
4278 /// A pointer to the contents in the success state.
4279 /// Reading from this pointer when `result_ok` is not set is undefined.
4280 pub result: *mut crate::c_types::derived::CVec_BlindedPathZ,
4281 /// Note that this value is always NULL, as there are no contents in the Err variant
4282 pub err: *mut core::ffi::c_void,
4285 /// A CResult_CVec_BlindedPathZNoneZ represents the result of a fallible operation,
4286 /// containing a crate::c_types::derived::CVec_BlindedPathZ on success and a () on failure.
4287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4288 pub struct CResult_CVec_BlindedPathZNoneZ {
4289 /// The contents of this CResult_CVec_BlindedPathZNoneZ, accessible via either
4290 /// `err` or `result` depending on the state of `result_ok`.
4291 pub contents: CResult_CVec_BlindedPathZNoneZPtr,
4292 /// Whether this CResult_CVec_BlindedPathZNoneZ represents a success state.
4293 pub result_ok: bool,
4296 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the success state.
4297 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedPathZ) -> CResult_CVec_BlindedPathZNoneZ {
4298 CResult_CVec_BlindedPathZNoneZ {
4299 contents: CResult_CVec_BlindedPathZNoneZPtr {
4300 result: Box::into_raw(Box::new(o)),
4306 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the error state.
4307 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_err() -> CResult_CVec_BlindedPathZNoneZ {
4308 CResult_CVec_BlindedPathZNoneZ {
4309 contents: CResult_CVec_BlindedPathZNoneZPtr {
4310 err: core::ptr::null_mut(),
4315 /// Checks if the given object is currently in the success state
4317 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_is_ok(o: &CResult_CVec_BlindedPathZNoneZ) -> bool {
4321 /// Frees any resources used by the CResult_CVec_BlindedPathZNoneZ.
4322 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_free(_res: CResult_CVec_BlindedPathZNoneZ) { }
4323 impl Drop for CResult_CVec_BlindedPathZNoneZ {
4324 fn drop(&mut self) {
4326 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4327 let _ = unsafe { Box::from_raw(self.contents.result) };
4333 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>> for CResult_CVec_BlindedPathZNoneZ {
4334 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>) -> Self {
4335 let contents = if o.result_ok {
4336 let result = unsafe { o.contents.result };
4337 unsafe { o.contents.result = core::ptr::null_mut() };
4338 CResult_CVec_BlindedPathZNoneZPtr { result }
4340 let _ = unsafe { Box::from_raw(o.contents.err) };
4341 o.contents.err = core::ptr::null_mut();
4342 CResult_CVec_BlindedPathZNoneZPtr { err: core::ptr::null_mut() }
4346 result_ok: o.result_ok,
4350 impl Clone for CResult_CVec_BlindedPathZNoneZ {
4351 fn clone(&self) -> Self {
4353 Self { result_ok: true, contents: CResult_CVec_BlindedPathZNoneZPtr {
4354 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_BlindedPathZ>::clone(unsafe { &*self.contents.result })))
4357 Self { result_ok: false, contents: CResult_CVec_BlindedPathZNoneZPtr {
4358 err: core::ptr::null_mut()
4364 /// Creates a new CResult_CVec_BlindedPathZNoneZ which has the same data as `orig`
4365 /// but with all dynamically-allocated buffers duplicated in new buffers.
4366 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_clone(orig: &CResult_CVec_BlindedPathZNoneZ) -> CResult_CVec_BlindedPathZNoneZ { Clone::clone(&orig) }
4368 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
4369 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
4370 /// A pointer to the contents in the success state.
4371 /// Reading from this pointer when `result_ok` is not set is undefined.
4372 pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
4373 /// A pointer to the contents in the error state.
4374 /// Reading from this pointer when `result_ok` is set is undefined.
4375 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4378 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
4379 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
4380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4381 pub struct CResult_InFlightHtlcsDecodeErrorZ {
4382 /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
4383 /// `err` or `result` depending on the state of `result_ok`.
4384 pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
4385 /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
4386 pub result_ok: bool,
4389 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
4390 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
4391 CResult_InFlightHtlcsDecodeErrorZ {
4392 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4393 result: Box::into_raw(Box::new(o)),
4399 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
4400 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
4401 CResult_InFlightHtlcsDecodeErrorZ {
4402 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4403 err: Box::into_raw(Box::new(e)),
4408 /// Checks if the given object is currently in the success state
4410 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
4414 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
4415 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
4416 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
4417 fn drop(&mut self) {
4419 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4420 let _ = unsafe { Box::from_raw(self.contents.result) };
4423 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4424 let _ = unsafe { Box::from_raw(self.contents.err) };
4429 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
4430 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
4431 let contents = if o.result_ok {
4432 let result = unsafe { o.contents.result };
4433 unsafe { o.contents.result = core::ptr::null_mut() };
4434 CResult_InFlightHtlcsDecodeErrorZPtr { result }
4436 let err = unsafe { o.contents.err };
4437 unsafe { o.contents.err = core::ptr::null_mut(); }
4438 CResult_InFlightHtlcsDecodeErrorZPtr { err }
4442 result_ok: o.result_ok,
4446 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
4447 fn clone(&self) -> Self {
4449 Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4450 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
4453 Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4454 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4460 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
4461 /// but with all dynamically-allocated buffers duplicated in new buffers.
4462 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
4464 /// The contents of CResult_RouteHopDecodeErrorZ
4465 pub union CResult_RouteHopDecodeErrorZPtr {
4466 /// A pointer to the contents in the success state.
4467 /// Reading from this pointer when `result_ok` is not set is undefined.
4468 pub result: *mut crate::lightning::routing::router::RouteHop,
4469 /// A pointer to the contents in the error state.
4470 /// Reading from this pointer when `result_ok` is set is undefined.
4471 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4474 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
4475 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4476 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4477 pub struct CResult_RouteHopDecodeErrorZ {
4478 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
4479 /// `err` or `result` depending on the state of `result_ok`.
4480 pub contents: CResult_RouteHopDecodeErrorZPtr,
4481 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
4482 pub result_ok: bool,
4485 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
4486 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
4487 CResult_RouteHopDecodeErrorZ {
4488 contents: CResult_RouteHopDecodeErrorZPtr {
4489 result: Box::into_raw(Box::new(o)),
4495 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
4496 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
4497 CResult_RouteHopDecodeErrorZ {
4498 contents: CResult_RouteHopDecodeErrorZPtr {
4499 err: Box::into_raw(Box::new(e)),
4504 /// Checks if the given object is currently in the success state
4506 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
4510 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
4511 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
4512 impl Drop for CResult_RouteHopDecodeErrorZ {
4513 fn drop(&mut self) {
4515 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4516 let _ = unsafe { Box::from_raw(self.contents.result) };
4519 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4520 let _ = unsafe { Box::from_raw(self.contents.err) };
4525 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
4526 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4527 let contents = if o.result_ok {
4528 let result = unsafe { o.contents.result };
4529 unsafe { o.contents.result = core::ptr::null_mut() };
4530 CResult_RouteHopDecodeErrorZPtr { result }
4532 let err = unsafe { o.contents.err };
4533 unsafe { o.contents.err = core::ptr::null_mut(); }
4534 CResult_RouteHopDecodeErrorZPtr { err }
4538 result_ok: o.result_ok,
4542 impl Clone for CResult_RouteHopDecodeErrorZ {
4543 fn clone(&self) -> Self {
4545 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
4546 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
4549 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
4550 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4556 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
4557 /// but with all dynamically-allocated buffers duplicated in new buffers.
4558 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
4560 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
4561 /// This corresponds to std::vector in C++
4562 pub struct CVec_BlindedHopZ {
4563 /// The elements in the array.
4564 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4565 pub data: *mut crate::lightning::blinded_path::BlindedHop,
4566 /// The number of elements pointed to by `data`.
4569 impl CVec_BlindedHopZ {
4570 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
4571 if self.datalen == 0 { return Vec::new(); }
4572 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4573 self.data = core::ptr::null_mut();
4577 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
4578 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4581 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
4582 fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
4583 let datalen = v.len();
4584 let data = Box::into_raw(v.into_boxed_slice());
4585 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4589 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4590 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
4591 impl Drop for CVec_BlindedHopZ {
4592 fn drop(&mut self) {
4593 if self.datalen == 0 { return; }
4594 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4597 impl Clone for CVec_BlindedHopZ {
4598 fn clone(&self) -> Self {
4599 let mut res = Vec::new();
4600 if self.datalen == 0 { return Self::from(res); }
4601 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4606 /// The contents of CResult_BlindedTailDecodeErrorZ
4607 pub union CResult_BlindedTailDecodeErrorZPtr {
4608 /// A pointer to the contents in the success state.
4609 /// Reading from this pointer when `result_ok` is not set is undefined.
4610 pub result: *mut crate::lightning::routing::router::BlindedTail,
4611 /// A pointer to the contents in the error state.
4612 /// Reading from this pointer when `result_ok` is set is undefined.
4613 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4616 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
4617 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
4618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4619 pub struct CResult_BlindedTailDecodeErrorZ {
4620 /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
4621 /// `err` or `result` depending on the state of `result_ok`.
4622 pub contents: CResult_BlindedTailDecodeErrorZPtr,
4623 /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
4624 pub result_ok: bool,
4627 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
4628 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
4629 CResult_BlindedTailDecodeErrorZ {
4630 contents: CResult_BlindedTailDecodeErrorZPtr {
4631 result: Box::into_raw(Box::new(o)),
4637 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
4638 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
4639 CResult_BlindedTailDecodeErrorZ {
4640 contents: CResult_BlindedTailDecodeErrorZPtr {
4641 err: Box::into_raw(Box::new(e)),
4646 /// Checks if the given object is currently in the success state
4648 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
4652 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
4653 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
4654 impl Drop for CResult_BlindedTailDecodeErrorZ {
4655 fn drop(&mut self) {
4657 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4658 let _ = unsafe { Box::from_raw(self.contents.result) };
4661 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4662 let _ = unsafe { Box::from_raw(self.contents.err) };
4667 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
4668 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
4669 let contents = if o.result_ok {
4670 let result = unsafe { o.contents.result };
4671 unsafe { o.contents.result = core::ptr::null_mut() };
4672 CResult_BlindedTailDecodeErrorZPtr { result }
4674 let err = unsafe { o.contents.err };
4675 unsafe { o.contents.err = core::ptr::null_mut(); }
4676 CResult_BlindedTailDecodeErrorZPtr { err }
4680 result_ok: o.result_ok,
4684 impl Clone for CResult_BlindedTailDecodeErrorZ {
4685 fn clone(&self) -> Self {
4687 Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
4688 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
4691 Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
4692 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4698 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
4699 /// but with all dynamically-allocated buffers duplicated in new buffers.
4700 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
4702 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
4703 /// This corresponds to std::vector in C++
4704 pub struct CVec_RouteHopZ {
4705 /// The elements in the array.
4706 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4707 pub data: *mut crate::lightning::routing::router::RouteHop,
4708 /// The number of elements pointed to by `data`.
4711 impl CVec_RouteHopZ {
4712 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
4713 if self.datalen == 0 { return Vec::new(); }
4714 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4715 self.data = core::ptr::null_mut();
4719 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
4720 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4723 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
4724 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
4725 let datalen = v.len();
4726 let data = Box::into_raw(v.into_boxed_slice());
4727 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4731 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4732 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
4733 impl Drop for CVec_RouteHopZ {
4734 fn drop(&mut self) {
4735 if self.datalen == 0 { return; }
4736 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4739 impl Clone for CVec_RouteHopZ {
4740 fn clone(&self) -> Self {
4741 let mut res = Vec::new();
4742 if self.datalen == 0 { return Self::from(res); }
4743 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4748 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
4749 /// This corresponds to std::vector in C++
4750 pub struct CVec_PathZ {
4751 /// The elements in the array.
4752 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4753 pub data: *mut crate::lightning::routing::router::Path,
4754 /// The number of elements pointed to by `data`.
4758 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
4759 if self.datalen == 0 { return Vec::new(); }
4760 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4761 self.data = core::ptr::null_mut();
4765 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
4766 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4769 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
4770 fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
4771 let datalen = v.len();
4772 let data = Box::into_raw(v.into_boxed_slice());
4773 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4777 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4778 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
4779 impl Drop for CVec_PathZ {
4780 fn drop(&mut self) {
4781 if self.datalen == 0 { return; }
4782 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4785 impl Clone for CVec_PathZ {
4786 fn clone(&self) -> Self {
4787 let mut res = Vec::new();
4788 if self.datalen == 0 { return Self::from(res); }
4789 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4794 /// The contents of CResult_RouteDecodeErrorZ
4795 pub union CResult_RouteDecodeErrorZPtr {
4796 /// A pointer to the contents in the success state.
4797 /// Reading from this pointer when `result_ok` is not set is undefined.
4798 pub result: *mut crate::lightning::routing::router::Route,
4799 /// A pointer to the contents in the error state.
4800 /// Reading from this pointer when `result_ok` is set is undefined.
4801 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4804 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
4805 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
4806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4807 pub struct CResult_RouteDecodeErrorZ {
4808 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
4809 /// `err` or `result` depending on the state of `result_ok`.
4810 pub contents: CResult_RouteDecodeErrorZPtr,
4811 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
4812 pub result_ok: bool,
4815 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
4816 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
4817 CResult_RouteDecodeErrorZ {
4818 contents: CResult_RouteDecodeErrorZPtr {
4819 result: Box::into_raw(Box::new(o)),
4825 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
4826 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
4827 CResult_RouteDecodeErrorZ {
4828 contents: CResult_RouteDecodeErrorZPtr {
4829 err: Box::into_raw(Box::new(e)),
4834 /// Checks if the given object is currently in the success state
4836 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
4840 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
4841 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
4842 impl Drop for CResult_RouteDecodeErrorZ {
4843 fn drop(&mut self) {
4845 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4846 let _ = unsafe { Box::from_raw(self.contents.result) };
4849 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4850 let _ = unsafe { Box::from_raw(self.contents.err) };
4855 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
4856 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
4857 let contents = if o.result_ok {
4858 let result = unsafe { o.contents.result };
4859 unsafe { o.contents.result = core::ptr::null_mut() };
4860 CResult_RouteDecodeErrorZPtr { result }
4862 let err = unsafe { o.contents.err };
4863 unsafe { o.contents.err = core::ptr::null_mut(); }
4864 CResult_RouteDecodeErrorZPtr { err }
4868 result_ok: o.result_ok,
4872 impl Clone for CResult_RouteDecodeErrorZ {
4873 fn clone(&self) -> Self {
4875 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
4876 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4879 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
4880 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4886 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
4887 /// but with all dynamically-allocated buffers duplicated in new buffers.
4888 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
4890 /// The contents of CResult_RouteParametersDecodeErrorZ
4891 pub union CResult_RouteParametersDecodeErrorZPtr {
4892 /// A pointer to the contents in the success state.
4893 /// Reading from this pointer when `result_ok` is not set is undefined.
4894 pub result: *mut crate::lightning::routing::router::RouteParameters,
4895 /// A pointer to the contents in the error state.
4896 /// Reading from this pointer when `result_ok` is set is undefined.
4897 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4900 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
4901 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4903 pub struct CResult_RouteParametersDecodeErrorZ {
4904 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
4905 /// `err` or `result` depending on the state of `result_ok`.
4906 pub contents: CResult_RouteParametersDecodeErrorZPtr,
4907 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
4908 pub result_ok: bool,
4911 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
4912 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
4913 CResult_RouteParametersDecodeErrorZ {
4914 contents: CResult_RouteParametersDecodeErrorZPtr {
4915 result: Box::into_raw(Box::new(o)),
4921 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
4922 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
4923 CResult_RouteParametersDecodeErrorZ {
4924 contents: CResult_RouteParametersDecodeErrorZPtr {
4925 err: Box::into_raw(Box::new(e)),
4930 /// Checks if the given object is currently in the success state
4932 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
4936 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
4937 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
4938 impl Drop for CResult_RouteParametersDecodeErrorZ {
4939 fn drop(&mut self) {
4941 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4942 let _ = unsafe { Box::from_raw(self.contents.result) };
4945 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4946 let _ = unsafe { Box::from_raw(self.contents.err) };
4951 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
4952 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4953 let contents = if o.result_ok {
4954 let result = unsafe { o.contents.result };
4955 unsafe { o.contents.result = core::ptr::null_mut() };
4956 CResult_RouteParametersDecodeErrorZPtr { result }
4958 let err = unsafe { o.contents.err };
4959 unsafe { o.contents.err = core::ptr::null_mut(); }
4960 CResult_RouteParametersDecodeErrorZPtr { err }
4964 result_ok: o.result_ok,
4968 impl Clone for CResult_RouteParametersDecodeErrorZ {
4969 fn clone(&self) -> Self {
4971 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
4972 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
4975 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
4976 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4982 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
4983 /// but with all dynamically-allocated buffers duplicated in new buffers.
4984 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
4986 /// A dynamically-allocated array of u64s of arbitrary size.
4987 /// This corresponds to std::vector in C++
4988 pub struct CVec_u64Z {
4989 /// The elements in the array.
4990 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4992 /// The number of elements pointed to by `data`.
4996 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4997 if self.datalen == 0 { return Vec::new(); }
4998 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4999 self.data = core::ptr::null_mut();
5003 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
5004 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5007 impl From<Vec<u64>> for CVec_u64Z {
5008 fn from(v: Vec<u64>) -> Self {
5009 let datalen = v.len();
5010 let data = Box::into_raw(v.into_boxed_slice());
5011 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5015 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5016 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5017 impl Drop for CVec_u64Z {
5018 fn drop(&mut self) {
5019 if self.datalen == 0 { return; }
5020 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5023 impl Clone for CVec_u64Z {
5024 fn clone(&self) -> Self {
5025 let mut res = Vec::new();
5026 if self.datalen == 0 { return Self::from(res); }
5027 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5032 /// The contents of CResult_PaymentParametersDecodeErrorZ
5033 pub union CResult_PaymentParametersDecodeErrorZPtr {
5034 /// A pointer to the contents in the success state.
5035 /// Reading from this pointer when `result_ok` is not set is undefined.
5036 pub result: *mut crate::lightning::routing::router::PaymentParameters,
5037 /// A pointer to the contents in the error state.
5038 /// Reading from this pointer when `result_ok` is set is undefined.
5039 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5042 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
5043 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
5044 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5045 pub struct CResult_PaymentParametersDecodeErrorZ {
5046 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
5047 /// `err` or `result` depending on the state of `result_ok`.
5048 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
5049 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
5050 pub result_ok: bool,
5053 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
5054 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
5055 CResult_PaymentParametersDecodeErrorZ {
5056 contents: CResult_PaymentParametersDecodeErrorZPtr {
5057 result: Box::into_raw(Box::new(o)),
5063 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
5064 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
5065 CResult_PaymentParametersDecodeErrorZ {
5066 contents: CResult_PaymentParametersDecodeErrorZPtr {
5067 err: Box::into_raw(Box::new(e)),
5072 /// Checks if the given object is currently in the success state
5074 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
5078 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
5079 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
5080 impl Drop for CResult_PaymentParametersDecodeErrorZ {
5081 fn drop(&mut self) {
5083 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5084 let _ = unsafe { Box::from_raw(self.contents.result) };
5087 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5088 let _ = unsafe { Box::from_raw(self.contents.err) };
5093 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
5094 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
5095 let contents = if o.result_ok {
5096 let result = unsafe { o.contents.result };
5097 unsafe { o.contents.result = core::ptr::null_mut() };
5098 CResult_PaymentParametersDecodeErrorZPtr { result }
5100 let err = unsafe { o.contents.err };
5101 unsafe { o.contents.err = core::ptr::null_mut(); }
5102 CResult_PaymentParametersDecodeErrorZPtr { err }
5106 result_ok: o.result_ok,
5110 impl Clone for CResult_PaymentParametersDecodeErrorZ {
5111 fn clone(&self) -> Self {
5113 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
5114 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
5117 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
5118 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5124 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
5125 /// but with all dynamically-allocated buffers duplicated in new buffers.
5126 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
5128 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
5129 /// This corresponds to std::vector in C++
5130 pub struct CVec_RouteHintZ {
5131 /// The elements in the array.
5132 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5133 pub data: *mut crate::lightning::routing::router::RouteHint,
5134 /// The number of elements pointed to by `data`.
5137 impl CVec_RouteHintZ {
5138 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
5139 if self.datalen == 0 { return Vec::new(); }
5140 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5141 self.data = core::ptr::null_mut();
5145 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
5146 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5149 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
5150 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
5151 let datalen = v.len();
5152 let data = Box::into_raw(v.into_boxed_slice());
5153 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5157 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5158 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
5159 impl Drop for CVec_RouteHintZ {
5160 fn drop(&mut self) {
5161 if self.datalen == 0 { return; }
5162 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5165 impl Clone for CVec_RouteHintZ {
5166 fn clone(&self) -> Self {
5167 let mut res = Vec::new();
5168 if self.datalen == 0 { return Self::from(res); }
5169 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5174 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
5175 /// This corresponds to std::vector in C++
5176 pub struct CVec_RouteHintHopZ {
5177 /// The elements in the array.
5178 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5179 pub data: *mut crate::lightning::routing::router::RouteHintHop,
5180 /// The number of elements pointed to by `data`.
5183 impl CVec_RouteHintHopZ {
5184 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
5185 if self.datalen == 0 { return Vec::new(); }
5186 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5187 self.data = core::ptr::null_mut();
5191 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
5192 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5195 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
5196 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
5197 let datalen = v.len();
5198 let data = Box::into_raw(v.into_boxed_slice());
5199 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5203 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5204 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
5205 impl Drop for CVec_RouteHintHopZ {
5206 fn drop(&mut self) {
5207 if self.datalen == 0 { return; }
5208 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5211 impl Clone for CVec_RouteHintHopZ {
5212 fn clone(&self) -> Self {
5213 let mut res = Vec::new();
5214 if self.datalen == 0 { return Self::from(res); }
5215 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5220 /// The contents of CResult_RouteHintDecodeErrorZ
5221 pub union CResult_RouteHintDecodeErrorZPtr {
5222 /// A pointer to the contents in the success state.
5223 /// Reading from this pointer when `result_ok` is not set is undefined.
5224 pub result: *mut crate::lightning::routing::router::RouteHint,
5225 /// A pointer to the contents in the error state.
5226 /// Reading from this pointer when `result_ok` is set is undefined.
5227 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5230 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
5231 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5233 pub struct CResult_RouteHintDecodeErrorZ {
5234 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
5235 /// `err` or `result` depending on the state of `result_ok`.
5236 pub contents: CResult_RouteHintDecodeErrorZPtr,
5237 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
5238 pub result_ok: bool,
5241 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
5242 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
5243 CResult_RouteHintDecodeErrorZ {
5244 contents: CResult_RouteHintDecodeErrorZPtr {
5245 result: Box::into_raw(Box::new(o)),
5251 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
5252 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
5253 CResult_RouteHintDecodeErrorZ {
5254 contents: CResult_RouteHintDecodeErrorZPtr {
5255 err: Box::into_raw(Box::new(e)),
5260 /// Checks if the given object is currently in the success state
5262 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
5266 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
5267 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
5268 impl Drop for CResult_RouteHintDecodeErrorZ {
5269 fn drop(&mut self) {
5271 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5272 let _ = unsafe { Box::from_raw(self.contents.result) };
5275 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5276 let _ = unsafe { Box::from_raw(self.contents.err) };
5281 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
5282 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5283 let contents = if o.result_ok {
5284 let result = unsafe { o.contents.result };
5285 unsafe { o.contents.result = core::ptr::null_mut() };
5286 CResult_RouteHintDecodeErrorZPtr { result }
5288 let err = unsafe { o.contents.err };
5289 unsafe { o.contents.err = core::ptr::null_mut(); }
5290 CResult_RouteHintDecodeErrorZPtr { err }
5294 result_ok: o.result_ok,
5298 impl Clone for CResult_RouteHintDecodeErrorZ {
5299 fn clone(&self) -> Self {
5301 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
5302 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
5305 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
5306 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5312 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
5313 /// but with all dynamically-allocated buffers duplicated in new buffers.
5314 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
5316 /// The contents of CResult_RouteHintHopDecodeErrorZ
5317 pub union CResult_RouteHintHopDecodeErrorZPtr {
5318 /// A pointer to the contents in the success state.
5319 /// Reading from this pointer when `result_ok` is not set is undefined.
5320 pub result: *mut crate::lightning::routing::router::RouteHintHop,
5321 /// A pointer to the contents in the error state.
5322 /// Reading from this pointer when `result_ok` is set is undefined.
5323 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5326 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
5327 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
5328 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5329 pub struct CResult_RouteHintHopDecodeErrorZ {
5330 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
5331 /// `err` or `result` depending on the state of `result_ok`.
5332 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
5333 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
5334 pub result_ok: bool,
5337 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
5338 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
5339 CResult_RouteHintHopDecodeErrorZ {
5340 contents: CResult_RouteHintHopDecodeErrorZPtr {
5341 result: Box::into_raw(Box::new(o)),
5347 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
5348 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
5349 CResult_RouteHintHopDecodeErrorZ {
5350 contents: CResult_RouteHintHopDecodeErrorZPtr {
5351 err: Box::into_raw(Box::new(e)),
5356 /// Checks if the given object is currently in the success state
5358 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
5362 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
5363 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
5364 impl Drop for CResult_RouteHintHopDecodeErrorZ {
5365 fn drop(&mut self) {
5367 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5368 let _ = unsafe { Box::from_raw(self.contents.result) };
5371 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5372 let _ = unsafe { Box::from_raw(self.contents.err) };
5377 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
5378 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
5379 let contents = if o.result_ok {
5380 let result = unsafe { o.contents.result };
5381 unsafe { o.contents.result = core::ptr::null_mut() };
5382 CResult_RouteHintHopDecodeErrorZPtr { result }
5384 let err = unsafe { o.contents.err };
5385 unsafe { o.contents.err = core::ptr::null_mut(); }
5386 CResult_RouteHintHopDecodeErrorZPtr { err }
5390 result_ok: o.result_ok,
5394 impl Clone for CResult_RouteHintHopDecodeErrorZ {
5395 fn clone(&self) -> Self {
5397 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
5398 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
5401 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
5402 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5408 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
5409 /// but with all dynamically-allocated buffers duplicated in new buffers.
5410 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
5412 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
5413 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
5414 /// A pointer to the contents in the success state.
5415 /// Reading from this pointer when `result_ok` is not set is undefined.
5416 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
5417 /// A pointer to the contents in the error state.
5418 /// Reading from this pointer when `result_ok` is set is undefined.
5419 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5422 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
5423 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5424 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5425 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
5426 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
5427 /// `err` or `result` depending on the state of `result_ok`.
5428 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
5429 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
5430 pub result_ok: bool,
5433 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
5434 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
5435 CResult_FixedPenaltyScorerDecodeErrorZ {
5436 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5437 result: Box::into_raw(Box::new(o)),
5443 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
5444 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
5445 CResult_FixedPenaltyScorerDecodeErrorZ {
5446 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5447 err: Box::into_raw(Box::new(e)),
5452 /// Checks if the given object is currently in the success state
5454 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
5458 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
5459 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
5460 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
5461 fn drop(&mut self) {
5463 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5464 let _ = unsafe { Box::from_raw(self.contents.result) };
5467 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5468 let _ = unsafe { Box::from_raw(self.contents.err) };
5473 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
5474 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5475 let contents = if o.result_ok {
5476 let result = unsafe { o.contents.result };
5477 unsafe { o.contents.result = core::ptr::null_mut() };
5478 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
5480 let err = unsafe { o.contents.err };
5481 unsafe { o.contents.err = core::ptr::null_mut(); }
5482 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
5486 result_ok: o.result_ok,
5490 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
5491 fn clone(&self) -> Self {
5493 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5494 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
5497 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5498 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5504 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
5505 /// but with all dynamically-allocated buffers duplicated in new buffers.
5506 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
5508 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
5509 /// This corresponds to std::vector in C++
5510 pub struct CVec_NodeIdZ {
5511 /// The elements in the array.
5512 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5513 pub data: *mut crate::lightning::routing::gossip::NodeId,
5514 /// The number of elements pointed to by `data`.
5518 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
5519 if self.datalen == 0 { return Vec::new(); }
5520 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5521 self.data = core::ptr::null_mut();
5525 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
5526 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5529 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
5530 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
5531 let datalen = v.len();
5532 let data = Box::into_raw(v.into_boxed_slice());
5533 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5537 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5538 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
5539 impl Drop for CVec_NodeIdZ {
5540 fn drop(&mut self) {
5541 if self.datalen == 0 { return; }
5542 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5545 impl Clone for CVec_NodeIdZ {
5546 fn clone(&self) -> Self {
5547 let mut res = Vec::new();
5548 if self.datalen == 0 { return Self::from(res); }
5549 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5554 /// A tuple of 2 elements. See the individual fields for the types contained.
5555 pub struct C2Tuple_u64u64Z {
5556 /// The element at position 0
5558 /// The element at position 1
5561 impl From<(u64, u64)> for C2Tuple_u64u64Z {
5562 fn from (tup: (u64, u64)) -> Self {
5569 impl C2Tuple_u64u64Z {
5570 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
5574 impl Clone for C2Tuple_u64u64Z {
5575 fn clone(&self) -> Self {
5577 a: Clone::clone(&self.a),
5578 b: Clone::clone(&self.b),
5583 /// Creates a new tuple which has the same data as `orig`
5584 /// but with all dynamically-allocated buffers duplicated in new buffers.
5585 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
5586 /// Creates a new C2Tuple_u64u64Z from the contained elements.
5588 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
5589 C2Tuple_u64u64Z { a, b, }
5593 /// Frees any resources used by the C2Tuple_u64u64Z.
5594 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
5597 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
5598 pub enum COption_C2Tuple_u64u64ZZ {
5599 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
5600 Some(crate::c_types::derived::C2Tuple_u64u64Z),
5601 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
5604 impl COption_C2Tuple_u64u64ZZ {
5605 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5606 if let Self::None = self { false } else { true }
5608 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5611 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
5612 if let Self::Some(v) = self { v } else { unreachable!() }
5616 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
5617 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
5618 COption_C2Tuple_u64u64ZZ::Some(o)
5621 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
5622 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
5623 COption_C2Tuple_u64u64ZZ::None
5626 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
5627 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
5629 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
5630 /// but with all dynamically-allocated buffers duplicated in new buffers.
5631 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
5633 /// A tuple of 2 elements. See the individual fields for the types contained.
5634 pub struct C2Tuple_Z {
5635 /// The element at position 0
5636 pub a: crate::c_types::ThirtyTwoU16s,
5637 /// The element at position 1
5638 pub b: crate::c_types::ThirtyTwoU16s,
5640 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z {
5641 fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5649 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5653 /// Creates a new C2Tuple_Z from the contained elements.
5655 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z {
5660 /// Frees any resources used by the C2Tuple_Z.
5661 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
5663 /// A tuple of 2 elements. See the individual fields for the types contained.
5664 pub struct C2Tuple__u1632_u1632Z {
5665 /// The element at position 0
5666 pub a: crate::c_types::ThirtyTwoU16s,
5667 /// The element at position 1
5668 pub b: crate::c_types::ThirtyTwoU16s,
5670 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z {
5671 fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5678 impl C2Tuple__u1632_u1632Z {
5679 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5683 /// Creates a new C2Tuple__u1632_u1632Z from the contained elements.
5685 pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z {
5686 C2Tuple__u1632_u1632Z { a, b, }
5690 /// Frees any resources used by the C2Tuple__u1632_u1632Z.
5691 pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { }
5693 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not
5694 pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5695 /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z
5696 Some(crate::c_types::derived::C2Tuple__u1632_u1632Z),
5697 /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing
5700 impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5701 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5702 if let Self::None = self { false } else { true }
5704 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5707 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z {
5708 if let Self::Some(v) = self { v } else { unreachable!() }
5712 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z
5713 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5714 COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o)
5717 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing
5718 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5719 COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None
5722 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state
5723 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { }
5726 /// An enum which can either contain a f64 or not
5727 pub enum COption_f64Z {
5728 /// When we're in this state, this COption_f64Z contains a f64
5730 /// When we're in this state, this COption_f64Z contains nothing
5734 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5735 if let Self::None = self { false } else { true }
5737 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5740 #[allow(unused)] pub(crate) fn take(mut self) -> f64 {
5741 if let Self::Some(v) = self { v } else { unreachable!() }
5745 /// Constructs a new COption_f64Z containing a f64
5746 pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z {
5747 COption_f64Z::Some(o)
5750 /// Constructs a new COption_f64Z containing nothing
5751 pub extern "C" fn COption_f64Z_none() -> COption_f64Z {
5755 /// Frees any resources associated with the f64, if we are in the Some state
5756 pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { }
5758 /// Creates a new COption_f64Z which has the same data as `orig`
5759 /// but with all dynamically-allocated buffers duplicated in new buffers.
5760 pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) }
5762 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
5763 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
5764 /// A pointer to the contents in the success state.
5765 /// Reading from this pointer when `result_ok` is not set is undefined.
5766 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
5767 /// A pointer to the contents in the error state.
5768 /// Reading from this pointer when `result_ok` is set is undefined.
5769 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5772 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5773 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5775 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
5776 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5777 /// `err` or `result` depending on the state of `result_ok`.
5778 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
5779 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5780 pub result_ok: bool,
5783 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
5784 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
5785 CResult_ProbabilisticScorerDecodeErrorZ {
5786 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5787 result: Box::into_raw(Box::new(o)),
5793 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
5794 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
5795 CResult_ProbabilisticScorerDecodeErrorZ {
5796 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5797 err: Box::into_raw(Box::new(e)),
5802 /// Checks if the given object is currently in the success state
5804 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
5808 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
5809 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
5810 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
5811 fn drop(&mut self) {
5813 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5814 let _ = unsafe { Box::from_raw(self.contents.result) };
5817 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5818 let _ = unsafe { Box::from_raw(self.contents.err) };
5823 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
5824 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5825 let contents = if o.result_ok {
5826 let result = unsafe { o.contents.result };
5827 unsafe { o.contents.result = core::ptr::null_mut() };
5828 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
5830 let err = unsafe { o.contents.err };
5831 unsafe { o.contents.err = core::ptr::null_mut(); }
5832 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
5836 result_ok: o.result_ok,
5841 /// The contents of CResult_BestBlockDecodeErrorZ
5842 pub union CResult_BestBlockDecodeErrorZPtr {
5843 /// A pointer to the contents in the success state.
5844 /// Reading from this pointer when `result_ok` is not set is undefined.
5845 pub result: *mut crate::lightning::chain::BestBlock,
5846 /// A pointer to the contents in the error state.
5847 /// Reading from this pointer when `result_ok` is set is undefined.
5848 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5851 /// A CResult_BestBlockDecodeErrorZ represents the result of a fallible operation,
5852 /// containing a crate::lightning::chain::BestBlock on success and a crate::lightning::ln::msgs::DecodeError on failure.
5853 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5854 pub struct CResult_BestBlockDecodeErrorZ {
5855 /// The contents of this CResult_BestBlockDecodeErrorZ, accessible via either
5856 /// `err` or `result` depending on the state of `result_ok`.
5857 pub contents: CResult_BestBlockDecodeErrorZPtr,
5858 /// Whether this CResult_BestBlockDecodeErrorZ represents a success state.
5859 pub result_ok: bool,
5862 /// Creates a new CResult_BestBlockDecodeErrorZ in the success state.
5863 pub extern "C" fn CResult_BestBlockDecodeErrorZ_ok(o: crate::lightning::chain::BestBlock) -> CResult_BestBlockDecodeErrorZ {
5864 CResult_BestBlockDecodeErrorZ {
5865 contents: CResult_BestBlockDecodeErrorZPtr {
5866 result: Box::into_raw(Box::new(o)),
5872 /// Creates a new CResult_BestBlockDecodeErrorZ in the error state.
5873 pub extern "C" fn CResult_BestBlockDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BestBlockDecodeErrorZ {
5874 CResult_BestBlockDecodeErrorZ {
5875 contents: CResult_BestBlockDecodeErrorZPtr {
5876 err: Box::into_raw(Box::new(e)),
5881 /// Checks if the given object is currently in the success state
5883 pub extern "C" fn CResult_BestBlockDecodeErrorZ_is_ok(o: &CResult_BestBlockDecodeErrorZ) -> bool {
5887 /// Frees any resources used by the CResult_BestBlockDecodeErrorZ.
5888 pub extern "C" fn CResult_BestBlockDecodeErrorZ_free(_res: CResult_BestBlockDecodeErrorZ) { }
5889 impl Drop for CResult_BestBlockDecodeErrorZ {
5890 fn drop(&mut self) {
5892 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5893 let _ = unsafe { Box::from_raw(self.contents.result) };
5896 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5897 let _ = unsafe { Box::from_raw(self.contents.err) };
5902 impl From<crate::c_types::CResultTempl<crate::lightning::chain::BestBlock, crate::lightning::ln::msgs::DecodeError>> for CResult_BestBlockDecodeErrorZ {
5903 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::BestBlock, crate::lightning::ln::msgs::DecodeError>) -> Self {
5904 let contents = if o.result_ok {
5905 let result = unsafe { o.contents.result };
5906 unsafe { o.contents.result = core::ptr::null_mut() };
5907 CResult_BestBlockDecodeErrorZPtr { result }
5909 let err = unsafe { o.contents.err };
5910 unsafe { o.contents.err = core::ptr::null_mut(); }
5911 CResult_BestBlockDecodeErrorZPtr { err }
5915 result_ok: o.result_ok,
5919 impl Clone for CResult_BestBlockDecodeErrorZ {
5920 fn clone(&self) -> Self {
5922 Self { result_ok: true, contents: CResult_BestBlockDecodeErrorZPtr {
5923 result: Box::into_raw(Box::new(<crate::lightning::chain::BestBlock>::clone(unsafe { &*self.contents.result })))
5926 Self { result_ok: false, contents: CResult_BestBlockDecodeErrorZPtr {
5927 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5933 /// Creates a new CResult_BestBlockDecodeErrorZ which has the same data as `orig`
5934 /// but with all dynamically-allocated buffers duplicated in new buffers.
5935 pub extern "C" fn CResult_BestBlockDecodeErrorZ_clone(orig: &CResult_BestBlockDecodeErrorZ) -> CResult_BestBlockDecodeErrorZ { Clone::clone(&orig) }
5937 /// A tuple of 2 elements. See the individual fields for the types contained.
5938 pub struct C2Tuple_usizeTransactionZ {
5939 /// The element at position 0
5941 /// The element at position 1
5942 pub b: crate::c_types::Transaction,
5944 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
5945 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
5952 impl C2Tuple_usizeTransactionZ {
5953 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
5957 impl Clone for C2Tuple_usizeTransactionZ {
5958 fn clone(&self) -> Self {
5960 a: Clone::clone(&self.a),
5961 b: Clone::clone(&self.b),
5966 /// Creates a new tuple which has the same data as `orig`
5967 /// but with all dynamically-allocated buffers duplicated in new buffers.
5968 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
5969 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
5971 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
5972 C2Tuple_usizeTransactionZ { a, b, }
5976 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
5977 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
5979 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5980 /// This corresponds to std::vector in C++
5981 pub struct CVec_C2Tuple_usizeTransactionZZ {
5982 /// The elements in the array.
5983 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5984 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
5985 /// The number of elements pointed to by `data`.
5988 impl CVec_C2Tuple_usizeTransactionZZ {
5989 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
5990 if self.datalen == 0 { return Vec::new(); }
5991 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5992 self.data = core::ptr::null_mut();
5996 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
5997 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6000 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
6001 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
6002 let datalen = v.len();
6003 let data = Box::into_raw(v.into_boxed_slice());
6004 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6008 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6009 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
6010 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
6011 fn drop(&mut self) {
6012 if self.datalen == 0 { return; }
6013 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6016 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
6017 fn clone(&self) -> Self {
6018 let mut res = Vec::new();
6019 if self.datalen == 0 { return Self::from(res); }
6020 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6025 /// A tuple of 3 elements. See the individual fields for the types contained.
6026 pub struct C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6027 /// The element at position 0
6028 pub a: crate::c_types::ThirtyTwoBytes,
6029 /// The element at position 1
6031 /// The element at position 2
6032 pub c: crate::c_types::derived::COption_ThirtyTwoBytesZ,
6034 impl From<(crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6035 fn from (tup: (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self {
6043 impl C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6044 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ) {
6045 (self.a, self.b, self.c)
6048 impl Clone for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6049 fn clone(&self) -> Self {
6051 a: Clone::clone(&self.a),
6052 b: Clone::clone(&self.b),
6053 c: Clone::clone(&self.c),
6058 /// Creates a new tuple which has the same data as `orig`
6059 /// but with all dynamically-allocated buffers duplicated in new buffers.
6060 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig: &C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { Clone::clone(&orig) }
6061 /// Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements.
6063 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 {
6064 C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { a, b, c, }
6068 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ.
6069 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res: C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) { }
6071 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZs of arbitrary size.
6072 /// This corresponds to std::vector in C++
6073 pub struct CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6074 /// The elements in the array.
6075 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6076 pub data: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ,
6077 /// The number of elements pointed to by `data`.
6080 impl CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6081 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ> {
6082 if self.datalen == 0 { return Vec::new(); }
6083 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6084 self.data = core::ptr::null_mut();
6088 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ] {
6089 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6092 impl From<Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>> for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6093 fn from(v: Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>) -> Self {
6094 let datalen = v.len();
6095 let data = Box::into_raw(v.into_boxed_slice());
6096 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6100 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6101 pub extern "C" fn CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res: CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ) { }
6102 impl Drop for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6103 fn drop(&mut self) {
6104 if self.datalen == 0 { return; }
6105 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6108 impl Clone for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6109 fn clone(&self) -> Self {
6110 let mut res = Vec::new();
6111 if self.datalen == 0 { return Self::from(res); }
6112 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6117 /// The contents of CResult_ChannelMonitorUpdateStatusNoneZ
6118 pub union CResult_ChannelMonitorUpdateStatusNoneZPtr {
6119 /// A pointer to the contents in the success state.
6120 /// Reading from this pointer when `result_ok` is not set is undefined.
6121 pub result: *mut crate::lightning::chain::ChannelMonitorUpdateStatus,
6122 /// Note that this value is always NULL, as there are no contents in the Err variant
6123 pub err: *mut core::ffi::c_void,
6126 /// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation,
6127 /// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure.
6128 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6129 pub struct CResult_ChannelMonitorUpdateStatusNoneZ {
6130 /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either
6131 /// `err` or `result` depending on the state of `result_ok`.
6132 pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr,
6133 /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state.
6134 pub result_ok: bool,
6137 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state.
6138 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ {
6139 CResult_ChannelMonitorUpdateStatusNoneZ {
6140 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6141 result: Box::into_raw(Box::new(o)),
6147 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state.
6148 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ {
6149 CResult_ChannelMonitorUpdateStatusNoneZ {
6150 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6151 err: core::ptr::null_mut(),
6156 /// Checks if the given object is currently in the success state
6158 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool {
6162 /// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ.
6163 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { }
6164 impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ {
6165 fn drop(&mut self) {
6167 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6168 let _ = unsafe { Box::from_raw(self.contents.result) };
6174 impl From<crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>> for CResult_ChannelMonitorUpdateStatusNoneZ {
6175 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>) -> Self {
6176 let contents = if o.result_ok {
6177 let result = unsafe { o.contents.result };
6178 unsafe { o.contents.result = core::ptr::null_mut() };
6179 CResult_ChannelMonitorUpdateStatusNoneZPtr { result }
6181 let _ = unsafe { Box::from_raw(o.contents.err) };
6182 o.contents.err = core::ptr::null_mut();
6183 CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() }
6187 result_ok: o.result_ok,
6191 impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ {
6192 fn clone(&self) -> Self {
6194 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6195 result: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateStatus>::clone(unsafe { &*self.contents.result })))
6198 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6199 err: core::ptr::null_mut()
6205 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig`
6206 /// but with all dynamically-allocated buffers duplicated in new buffers.
6207 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) }
6209 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
6210 /// This corresponds to std::vector in C++
6211 pub struct CVec_MonitorEventZ {
6212 /// The elements in the array.
6213 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6214 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
6215 /// The number of elements pointed to by `data`.
6218 impl CVec_MonitorEventZ {
6219 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
6220 if self.datalen == 0 { return Vec::new(); }
6221 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6222 self.data = core::ptr::null_mut();
6226 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
6227 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6230 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
6231 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
6232 let datalen = v.len();
6233 let data = Box::into_raw(v.into_boxed_slice());
6234 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6238 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6239 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
6240 impl Drop for CVec_MonitorEventZ {
6241 fn drop(&mut self) {
6242 if self.datalen == 0 { return; }
6243 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6246 impl Clone for CVec_MonitorEventZ {
6247 fn clone(&self) -> Self {
6248 let mut res = Vec::new();
6249 if self.datalen == 0 { return Self::from(res); }
6250 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6255 /// A tuple of 4 elements. See the individual fields for the types contained.
6256 pub struct C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6257 /// The element at position 0
6258 pub a: crate::lightning::chain::transaction::OutPoint,
6259 /// The element at position 1
6260 pub b: crate::lightning::ln::types::ChannelId,
6261 /// The element at position 2
6262 pub c: crate::c_types::derived::CVec_MonitorEventZ,
6263 /// The element at position 3
6264 pub d: crate::c_types::PublicKey,
6266 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 {
6267 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
6276 impl C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6277 #[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) {
6278 (self.a, self.b, self.c, self.d)
6281 impl Clone for C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6282 fn clone(&self) -> Self {
6284 a: Clone::clone(&self.a),
6285 b: Clone::clone(&self.b),
6286 c: Clone::clone(&self.c),
6287 d: Clone::clone(&self.d),
6292 /// Creates a new tuple which has the same data as `orig`
6293 /// but with all dynamically-allocated buffers duplicated in new buffers.
6294 pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig: &C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) -> C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
6295 /// Creates a new C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ from the contained elements.
6297 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 {
6298 C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { a, b, c, d, }
6302 /// Frees any resources used by the C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ.
6303 pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res: C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) { }
6305 /// A dynamically-allocated array of crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZs of arbitrary size.
6306 /// This corresponds to std::vector in C++
6307 pub struct CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6308 /// The elements in the array.
6309 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6310 pub data: *mut crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ,
6311 /// The number of elements pointed to by `data`.
6314 impl CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6315 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ> {
6316 if self.datalen == 0 { return Vec::new(); }
6317 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6318 self.data = core::ptr::null_mut();
6322 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ] {
6323 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6326 impl From<Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ>> for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6327 fn from(v: Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ>) -> Self {
6328 let datalen = v.len();
6329 let data = Box::into_raw(v.into_boxed_slice());
6330 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6334 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6335 pub extern "C" fn CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ) { }
6336 impl Drop for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6337 fn drop(&mut self) {
6338 if self.datalen == 0 { return; }
6339 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6342 impl Clone for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6343 fn clone(&self) -> Self {
6344 let mut res = Vec::new();
6345 if self.datalen == 0 { return Self::from(res); }
6346 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6351 /// The contents of CResult_InitFeaturesDecodeErrorZ
6352 pub union CResult_InitFeaturesDecodeErrorZPtr {
6353 /// A pointer to the contents in the success state.
6354 /// Reading from this pointer when `result_ok` is not set is undefined.
6355 pub result: *mut crate::lightning::ln::features::InitFeatures,
6356 /// A pointer to the contents in the error state.
6357 /// Reading from this pointer when `result_ok` is set is undefined.
6358 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6361 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
6362 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6364 pub struct CResult_InitFeaturesDecodeErrorZ {
6365 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
6366 /// `err` or `result` depending on the state of `result_ok`.
6367 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
6368 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
6369 pub result_ok: bool,
6372 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
6373 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
6374 CResult_InitFeaturesDecodeErrorZ {
6375 contents: CResult_InitFeaturesDecodeErrorZPtr {
6376 result: Box::into_raw(Box::new(o)),
6382 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
6383 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
6384 CResult_InitFeaturesDecodeErrorZ {
6385 contents: CResult_InitFeaturesDecodeErrorZPtr {
6386 err: Box::into_raw(Box::new(e)),
6391 /// Checks if the given object is currently in the success state
6393 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
6397 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
6398 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
6399 impl Drop for CResult_InitFeaturesDecodeErrorZ {
6400 fn drop(&mut self) {
6402 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6403 let _ = unsafe { Box::from_raw(self.contents.result) };
6406 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6407 let _ = unsafe { Box::from_raw(self.contents.err) };
6412 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
6413 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6414 let contents = if o.result_ok {
6415 let result = unsafe { o.contents.result };
6416 unsafe { o.contents.result = core::ptr::null_mut() };
6417 CResult_InitFeaturesDecodeErrorZPtr { result }
6419 let err = unsafe { o.contents.err };
6420 unsafe { o.contents.err = core::ptr::null_mut(); }
6421 CResult_InitFeaturesDecodeErrorZPtr { err }
6425 result_ok: o.result_ok,
6429 impl Clone for CResult_InitFeaturesDecodeErrorZ {
6430 fn clone(&self) -> Self {
6432 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
6433 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
6436 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
6437 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6443 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
6444 /// but with all dynamically-allocated buffers duplicated in new buffers.
6445 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
6447 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
6448 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
6449 /// A pointer to the contents in the success state.
6450 /// Reading from this pointer when `result_ok` is not set is undefined.
6451 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
6452 /// A pointer to the contents in the error state.
6453 /// Reading from this pointer when `result_ok` is set is undefined.
6454 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6457 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
6458 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6460 pub struct CResult_ChannelFeaturesDecodeErrorZ {
6461 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
6462 /// `err` or `result` depending on the state of `result_ok`.
6463 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
6464 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
6465 pub result_ok: bool,
6468 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
6469 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
6470 CResult_ChannelFeaturesDecodeErrorZ {
6471 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6472 result: Box::into_raw(Box::new(o)),
6478 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
6479 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
6480 CResult_ChannelFeaturesDecodeErrorZ {
6481 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6482 err: Box::into_raw(Box::new(e)),
6487 /// Checks if the given object is currently in the success state
6489 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
6493 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
6494 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
6495 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
6496 fn drop(&mut self) {
6498 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6499 let _ = unsafe { Box::from_raw(self.contents.result) };
6502 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6503 let _ = unsafe { Box::from_raw(self.contents.err) };
6508 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
6509 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6510 let contents = if o.result_ok {
6511 let result = unsafe { o.contents.result };
6512 unsafe { o.contents.result = core::ptr::null_mut() };
6513 CResult_ChannelFeaturesDecodeErrorZPtr { result }
6515 let err = unsafe { o.contents.err };
6516 unsafe { o.contents.err = core::ptr::null_mut(); }
6517 CResult_ChannelFeaturesDecodeErrorZPtr { err }
6521 result_ok: o.result_ok,
6525 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
6526 fn clone(&self) -> Self {
6528 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6529 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
6532 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6533 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6539 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
6540 /// but with all dynamically-allocated buffers duplicated in new buffers.
6541 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
6543 /// The contents of CResult_NodeFeaturesDecodeErrorZ
6544 pub union CResult_NodeFeaturesDecodeErrorZPtr {
6545 /// A pointer to the contents in the success state.
6546 /// Reading from this pointer when `result_ok` is not set is undefined.
6547 pub result: *mut crate::lightning::ln::features::NodeFeatures,
6548 /// A pointer to the contents in the error state.
6549 /// Reading from this pointer when `result_ok` is set is undefined.
6550 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6553 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
6554 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6556 pub struct CResult_NodeFeaturesDecodeErrorZ {
6557 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
6558 /// `err` or `result` depending on the state of `result_ok`.
6559 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
6560 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
6561 pub result_ok: bool,
6564 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
6565 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
6566 CResult_NodeFeaturesDecodeErrorZ {
6567 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6568 result: Box::into_raw(Box::new(o)),
6574 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
6575 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
6576 CResult_NodeFeaturesDecodeErrorZ {
6577 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6578 err: Box::into_raw(Box::new(e)),
6583 /// Checks if the given object is currently in the success state
6585 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
6589 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
6590 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
6591 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
6592 fn drop(&mut self) {
6594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6595 let _ = unsafe { Box::from_raw(self.contents.result) };
6598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6599 let _ = unsafe { Box::from_raw(self.contents.err) };
6604 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
6605 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6606 let contents = if o.result_ok {
6607 let result = unsafe { o.contents.result };
6608 unsafe { o.contents.result = core::ptr::null_mut() };
6609 CResult_NodeFeaturesDecodeErrorZPtr { result }
6611 let err = unsafe { o.contents.err };
6612 unsafe { o.contents.err = core::ptr::null_mut(); }
6613 CResult_NodeFeaturesDecodeErrorZPtr { err }
6617 result_ok: o.result_ok,
6621 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
6622 fn clone(&self) -> Self {
6624 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6625 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
6628 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6629 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6635 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
6636 /// but with all dynamically-allocated buffers duplicated in new buffers.
6637 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6639 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
6640 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6641 /// A pointer to the contents in the success state.
6642 /// Reading from this pointer when `result_ok` is not set is undefined.
6643 pub result: *mut crate::lightning::ln::features::Bolt11InvoiceFeatures,
6644 /// A pointer to the contents in the error state.
6645 /// Reading from this pointer when `result_ok` is set is undefined.
6646 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6649 /// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6650 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6652 pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6653 /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
6654 /// `err` or `result` depending on the state of `result_ok`.
6655 pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
6656 /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
6657 pub result_ok: bool,
6660 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
6661 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6662 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6663 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6664 result: Box::into_raw(Box::new(o)),
6670 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
6671 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6672 CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6673 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6674 err: Box::into_raw(Box::new(e)),
6679 /// Checks if the given object is currently in the success state
6681 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
6685 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
6686 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
6687 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6688 fn drop(&mut self) {
6690 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6691 let _ = unsafe { Box::from_raw(self.contents.result) };
6694 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6695 let _ = unsafe { Box::from_raw(self.contents.err) };
6700 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6701 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6702 let contents = if o.result_ok {
6703 let result = unsafe { o.contents.result };
6704 unsafe { o.contents.result = core::ptr::null_mut() };
6705 CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
6707 let err = unsafe { o.contents.err };
6708 unsafe { o.contents.err = core::ptr::null_mut(); }
6709 CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
6713 result_ok: o.result_ok,
6717 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6718 fn clone(&self) -> Self {
6720 Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6721 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6724 Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6725 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6731 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6732 /// but with all dynamically-allocated buffers duplicated in new buffers.
6733 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6735 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
6736 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6737 /// A pointer to the contents in the success state.
6738 /// Reading from this pointer when `result_ok` is not set is undefined.
6739 pub result: *mut crate::lightning::ln::features::Bolt12InvoiceFeatures,
6740 /// A pointer to the contents in the error state.
6741 /// Reading from this pointer when `result_ok` is set is undefined.
6742 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6745 /// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6746 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6747 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6748 pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6749 /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
6750 /// `err` or `result` depending on the state of `result_ok`.
6751 pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
6752 /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
6753 pub result_ok: bool,
6756 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
6757 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6758 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6759 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6760 result: Box::into_raw(Box::new(o)),
6766 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
6767 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6768 CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6769 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6770 err: Box::into_raw(Box::new(e)),
6775 /// Checks if the given object is currently in the success state
6777 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
6781 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
6782 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
6783 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6784 fn drop(&mut self) {
6786 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6787 let _ = unsafe { Box::from_raw(self.contents.result) };
6790 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6791 let _ = unsafe { Box::from_raw(self.contents.err) };
6796 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6797 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6798 let contents = if o.result_ok {
6799 let result = unsafe { o.contents.result };
6800 unsafe { o.contents.result = core::ptr::null_mut() };
6801 CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
6803 let err = unsafe { o.contents.err };
6804 unsafe { o.contents.err = core::ptr::null_mut(); }
6805 CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
6809 result_ok: o.result_ok,
6813 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6814 fn clone(&self) -> Self {
6816 Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6817 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6820 Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6821 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6827 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6828 /// but with all dynamically-allocated buffers duplicated in new buffers.
6829 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6831 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
6832 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
6833 /// A pointer to the contents in the success state.
6834 /// Reading from this pointer when `result_ok` is not set is undefined.
6835 pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
6836 /// A pointer to the contents in the error state.
6837 /// Reading from this pointer when `result_ok` is set is undefined.
6838 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6841 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
6842 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6843 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6844 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
6845 /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
6846 /// `err` or `result` depending on the state of `result_ok`.
6847 pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
6848 /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
6849 pub result_ok: bool,
6852 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
6853 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6854 CResult_BlindedHopFeaturesDecodeErrorZ {
6855 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6856 result: Box::into_raw(Box::new(o)),
6862 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
6863 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6864 CResult_BlindedHopFeaturesDecodeErrorZ {
6865 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6866 err: Box::into_raw(Box::new(e)),
6871 /// Checks if the given object is currently in the success state
6873 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
6877 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
6878 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
6879 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
6880 fn drop(&mut self) {
6882 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6883 let _ = unsafe { Box::from_raw(self.contents.result) };
6886 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6887 let _ = unsafe { Box::from_raw(self.contents.err) };
6892 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
6893 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6894 let contents = if o.result_ok {
6895 let result = unsafe { o.contents.result };
6896 unsafe { o.contents.result = core::ptr::null_mut() };
6897 CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
6899 let err = unsafe { o.contents.err };
6900 unsafe { o.contents.err = core::ptr::null_mut(); }
6901 CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
6905 result_ok: o.result_ok,
6909 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
6910 fn clone(&self) -> Self {
6912 Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6913 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
6916 Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6917 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6923 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
6924 /// but with all dynamically-allocated buffers duplicated in new buffers.
6925 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
6927 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
6928 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6929 /// A pointer to the contents in the success state.
6930 /// Reading from this pointer when `result_ok` is not set is undefined.
6931 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
6932 /// A pointer to the contents in the error state.
6933 /// Reading from this pointer when `result_ok` is set is undefined.
6934 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6937 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
6938 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6940 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
6941 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
6942 /// `err` or `result` depending on the state of `result_ok`.
6943 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
6944 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
6945 pub result_ok: bool,
6948 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
6949 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6950 CResult_ChannelTypeFeaturesDecodeErrorZ {
6951 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6952 result: Box::into_raw(Box::new(o)),
6958 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
6959 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6960 CResult_ChannelTypeFeaturesDecodeErrorZ {
6961 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6962 err: Box::into_raw(Box::new(e)),
6967 /// Checks if the given object is currently in the success state
6969 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
6973 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
6974 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
6975 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
6976 fn drop(&mut self) {
6978 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6979 let _ = unsafe { Box::from_raw(self.contents.result) };
6982 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6983 let _ = unsafe { Box::from_raw(self.contents.err) };
6988 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
6989 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6990 let contents = if o.result_ok {
6991 let result = unsafe { o.contents.result };
6992 unsafe { o.contents.result = core::ptr::null_mut() };
6993 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
6995 let err = unsafe { o.contents.err };
6996 unsafe { o.contents.err = core::ptr::null_mut(); }
6997 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
7001 result_ok: o.result_ok,
7005 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
7006 fn clone(&self) -> Self {
7008 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
7009 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
7012 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
7013 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7019 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
7020 /// but with all dynamically-allocated buffers duplicated in new buffers.
7021 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
7023 /// The contents of CResult_OfferIdDecodeErrorZ
7024 pub union CResult_OfferIdDecodeErrorZPtr {
7025 /// A pointer to the contents in the success state.
7026 /// Reading from this pointer when `result_ok` is not set is undefined.
7027 pub result: *mut crate::lightning::offers::offer::OfferId,
7028 /// A pointer to the contents in the error state.
7029 /// Reading from this pointer when `result_ok` is set is undefined.
7030 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7033 /// A CResult_OfferIdDecodeErrorZ represents the result of a fallible operation,
7034 /// containing a crate::lightning::offers::offer::OfferId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7035 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7036 pub struct CResult_OfferIdDecodeErrorZ {
7037 /// The contents of this CResult_OfferIdDecodeErrorZ, accessible via either
7038 /// `err` or `result` depending on the state of `result_ok`.
7039 pub contents: CResult_OfferIdDecodeErrorZPtr,
7040 /// Whether this CResult_OfferIdDecodeErrorZ represents a success state.
7041 pub result_ok: bool,
7044 /// Creates a new CResult_OfferIdDecodeErrorZ in the success state.
7045 pub extern "C" fn CResult_OfferIdDecodeErrorZ_ok(o: crate::lightning::offers::offer::OfferId) -> CResult_OfferIdDecodeErrorZ {
7046 CResult_OfferIdDecodeErrorZ {
7047 contents: CResult_OfferIdDecodeErrorZPtr {
7048 result: Box::into_raw(Box::new(o)),
7054 /// Creates a new CResult_OfferIdDecodeErrorZ in the error state.
7055 pub extern "C" fn CResult_OfferIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferIdDecodeErrorZ {
7056 CResult_OfferIdDecodeErrorZ {
7057 contents: CResult_OfferIdDecodeErrorZPtr {
7058 err: Box::into_raw(Box::new(e)),
7063 /// Checks if the given object is currently in the success state
7065 pub extern "C" fn CResult_OfferIdDecodeErrorZ_is_ok(o: &CResult_OfferIdDecodeErrorZ) -> bool {
7069 /// Frees any resources used by the CResult_OfferIdDecodeErrorZ.
7070 pub extern "C" fn CResult_OfferIdDecodeErrorZ_free(_res: CResult_OfferIdDecodeErrorZ) { }
7071 impl Drop for CResult_OfferIdDecodeErrorZ {
7072 fn drop(&mut self) {
7074 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7075 let _ = unsafe { Box::from_raw(self.contents.result) };
7078 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7079 let _ = unsafe { Box::from_raw(self.contents.err) };
7084 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferId, crate::lightning::ln::msgs::DecodeError>> for CResult_OfferIdDecodeErrorZ {
7085 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferId, crate::lightning::ln::msgs::DecodeError>) -> Self {
7086 let contents = if o.result_ok {
7087 let result = unsafe { o.contents.result };
7088 unsafe { o.contents.result = core::ptr::null_mut() };
7089 CResult_OfferIdDecodeErrorZPtr { result }
7091 let err = unsafe { o.contents.err };
7092 unsafe { o.contents.err = core::ptr::null_mut(); }
7093 CResult_OfferIdDecodeErrorZPtr { err }
7097 result_ok: o.result_ok,
7101 impl Clone for CResult_OfferIdDecodeErrorZ {
7102 fn clone(&self) -> Self {
7104 Self { result_ok: true, contents: CResult_OfferIdDecodeErrorZPtr {
7105 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::OfferId>::clone(unsafe { &*self.contents.result })))
7108 Self { result_ok: false, contents: CResult_OfferIdDecodeErrorZPtr {
7109 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7115 /// Creates a new CResult_OfferIdDecodeErrorZ which has the same data as `orig`
7116 /// but with all dynamically-allocated buffers duplicated in new buffers.
7117 pub extern "C" fn CResult_OfferIdDecodeErrorZ_clone(orig: &CResult_OfferIdDecodeErrorZ) -> CResult_OfferIdDecodeErrorZ { Clone::clone(&orig) }
7119 /// The contents of CResult_NoneBolt12SemanticErrorZ
7120 pub union CResult_NoneBolt12SemanticErrorZPtr {
7121 /// Note that this value is always NULL, as there are no contents in the OK variant
7122 pub result: *mut core::ffi::c_void,
7123 /// A pointer to the contents in the error state.
7124 /// Reading from this pointer when `result_ok` is set is undefined.
7125 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7128 /// A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation,
7129 /// containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7130 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7131 pub struct CResult_NoneBolt12SemanticErrorZ {
7132 /// The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either
7133 /// `err` or `result` depending on the state of `result_ok`.
7134 pub contents: CResult_NoneBolt12SemanticErrorZPtr,
7135 /// Whether this CResult_NoneBolt12SemanticErrorZ represents a success state.
7136 pub result_ok: bool,
7139 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the success state.
7140 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_ok() -> CResult_NoneBolt12SemanticErrorZ {
7141 CResult_NoneBolt12SemanticErrorZ {
7142 contents: CResult_NoneBolt12SemanticErrorZPtr {
7143 result: core::ptr::null_mut(),
7149 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the error state.
7150 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_NoneBolt12SemanticErrorZ {
7151 CResult_NoneBolt12SemanticErrorZ {
7152 contents: CResult_NoneBolt12SemanticErrorZPtr {
7153 err: Box::into_raw(Box::new(e)),
7158 /// Checks if the given object is currently in the success state
7160 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_is_ok(o: &CResult_NoneBolt12SemanticErrorZ) -> bool {
7164 /// Frees any resources used by the CResult_NoneBolt12SemanticErrorZ.
7165 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_free(_res: CResult_NoneBolt12SemanticErrorZ) { }
7166 impl Drop for CResult_NoneBolt12SemanticErrorZ {
7167 fn drop(&mut self) {
7170 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7171 let _ = unsafe { Box::from_raw(self.contents.err) };
7176 impl From<crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_NoneBolt12SemanticErrorZ {
7177 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7178 let contents = if o.result_ok {
7179 let _ = unsafe { Box::from_raw(o.contents.result) };
7180 o.contents.result = core::ptr::null_mut();
7181 CResult_NoneBolt12SemanticErrorZPtr { result: core::ptr::null_mut() }
7183 let err = unsafe { o.contents.err };
7184 unsafe { o.contents.err = core::ptr::null_mut(); }
7185 CResult_NoneBolt12SemanticErrorZPtr { err }
7189 result_ok: o.result_ok,
7193 impl Clone for CResult_NoneBolt12SemanticErrorZ {
7194 fn clone(&self) -> Self {
7196 Self { result_ok: true, contents: CResult_NoneBolt12SemanticErrorZPtr {
7197 result: core::ptr::null_mut()
7200 Self { result_ok: false, contents: CResult_NoneBolt12SemanticErrorZPtr {
7201 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
7207 /// Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig`
7208 /// but with all dynamically-allocated buffers duplicated in new buffers.
7209 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_clone(orig: &CResult_NoneBolt12SemanticErrorZ) -> CResult_NoneBolt12SemanticErrorZ { Clone::clone(&orig) }
7211 /// The contents of CResult_OfferBolt12SemanticErrorZ
7212 pub union CResult_OfferBolt12SemanticErrorZPtr {
7213 /// A pointer to the contents in the success state.
7214 /// Reading from this pointer when `result_ok` is not set is undefined.
7215 pub result: *mut crate::lightning::offers::offer::Offer,
7216 /// A pointer to the contents in the error state.
7217 /// Reading from this pointer when `result_ok` is set is undefined.
7218 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7221 /// A CResult_OfferBolt12SemanticErrorZ represents the result of a fallible operation,
7222 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7223 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7224 pub struct CResult_OfferBolt12SemanticErrorZ {
7225 /// The contents of this CResult_OfferBolt12SemanticErrorZ, accessible via either
7226 /// `err` or `result` depending on the state of `result_ok`.
7227 pub contents: CResult_OfferBolt12SemanticErrorZPtr,
7228 /// Whether this CResult_OfferBolt12SemanticErrorZ represents a success state.
7229 pub result_ok: bool,
7232 /// Creates a new CResult_OfferBolt12SemanticErrorZ in the success state.
7233 pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12SemanticErrorZ {
7234 CResult_OfferBolt12SemanticErrorZ {
7235 contents: CResult_OfferBolt12SemanticErrorZPtr {
7236 result: Box::into_raw(Box::new(o)),
7242 /// Creates a new CResult_OfferBolt12SemanticErrorZ in the error state.
7243 pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_OfferBolt12SemanticErrorZ {
7244 CResult_OfferBolt12SemanticErrorZ {
7245 contents: CResult_OfferBolt12SemanticErrorZPtr {
7246 err: Box::into_raw(Box::new(e)),
7251 /// Checks if the given object is currently in the success state
7253 pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_is_ok(o: &CResult_OfferBolt12SemanticErrorZ) -> bool {
7257 /// Frees any resources used by the CResult_OfferBolt12SemanticErrorZ.
7258 pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_free(_res: CResult_OfferBolt12SemanticErrorZ) { }
7259 impl Drop for CResult_OfferBolt12SemanticErrorZ {
7260 fn drop(&mut self) {
7262 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7263 let _ = unsafe { Box::from_raw(self.contents.result) };
7266 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7267 let _ = unsafe { Box::from_raw(self.contents.err) };
7272 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_OfferBolt12SemanticErrorZ {
7273 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7274 let contents = if o.result_ok {
7275 let result = unsafe { o.contents.result };
7276 unsafe { o.contents.result = core::ptr::null_mut() };
7277 CResult_OfferBolt12SemanticErrorZPtr { result }
7279 let err = unsafe { o.contents.err };
7280 unsafe { o.contents.err = core::ptr::null_mut(); }
7281 CResult_OfferBolt12SemanticErrorZPtr { err }
7285 result_ok: o.result_ok,
7289 impl Clone for CResult_OfferBolt12SemanticErrorZ {
7290 fn clone(&self) -> Self {
7292 Self { result_ok: true, contents: CResult_OfferBolt12SemanticErrorZPtr {
7293 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
7296 Self { result_ok: false, contents: CResult_OfferBolt12SemanticErrorZPtr {
7297 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
7303 /// Creates a new CResult_OfferBolt12SemanticErrorZ which has the same data as `orig`
7304 /// but with all dynamically-allocated buffers duplicated in new buffers.
7305 pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_clone(orig: &CResult_OfferBolt12SemanticErrorZ) -> CResult_OfferBolt12SemanticErrorZ { Clone::clone(&orig) }
7307 /// The contents of CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ
7308 pub union CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7309 /// A pointer to the contents in the success state.
7310 /// Reading from this pointer when `result_ok` is not set is undefined.
7311 pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder,
7312 /// A pointer to the contents in the error state.
7313 /// Reading from this pointer when `result_ok` is set is undefined.
7314 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7317 /// A CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
7318 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7319 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7320 pub struct CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7321 /// The contents of this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ, accessible via either
7322 /// `err` or `result` depending on the state of `result_ok`.
7323 pub contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr,
7324 /// Whether this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents a success state.
7325 pub result_ok: bool,
7328 /// Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the success state.
7329 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder) -> CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7330 CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7331 contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7332 result: Box::into_raw(Box::new(o)),
7338 /// Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the error state.
7339 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7340 CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7341 contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7342 err: Box::into_raw(Box::new(e)),
7347 /// Checks if the given object is currently in the success state
7349 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ) -> bool {
7353 /// Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ.
7354 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ) { }
7355 impl Drop for CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7356 fn drop(&mut self) {
7358 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7359 let _ = unsafe { Box::from_raw(self.contents.result) };
7362 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7363 let _ = unsafe { Box::from_raw(self.contents.err) };
7368 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7369 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7370 let contents = if o.result_ok {
7371 let result = unsafe { o.contents.result };
7372 unsafe { o.contents.result = core::ptr::null_mut() };
7373 CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { result }
7375 let err = unsafe { o.contents.err };
7376 unsafe { o.contents.err = core::ptr::null_mut(); }
7377 CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { err }
7381 result_ok: o.result_ok,
7386 /// The contents of CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ
7387 pub union CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7388 /// A pointer to the contents in the success state.
7389 /// Reading from this pointer when `result_ok` is not set is undefined.
7390 pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder,
7391 /// A pointer to the contents in the error state.
7392 /// Reading from this pointer when `result_ok` is set is undefined.
7393 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7396 /// A CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
7397 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7399 pub struct CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7400 /// The contents of this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ, accessible via either
7401 /// `err` or `result` depending on the state of `result_ok`.
7402 pub contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr,
7403 /// Whether this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents a success state.
7404 pub result_ok: bool,
7407 /// Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the success state.
7408 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder) -> CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7409 CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7410 contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7411 result: Box::into_raw(Box::new(o)),
7417 /// Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the error state.
7418 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7419 CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7420 contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7421 err: Box::into_raw(Box::new(e)),
7426 /// Checks if the given object is currently in the success state
7428 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ) -> bool {
7432 /// Frees any resources used by the CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ.
7433 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ) { }
7434 impl Drop for CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7435 fn drop(&mut self) {
7437 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7438 let _ = unsafe { Box::from_raw(self.contents.result) };
7441 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7442 let _ = unsafe { Box::from_raw(self.contents.err) };
7447 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7448 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7449 let contents = if o.result_ok {
7450 let result = unsafe { o.contents.result };
7451 unsafe { o.contents.result = core::ptr::null_mut() };
7452 CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { result }
7454 let err = unsafe { o.contents.err };
7455 unsafe { o.contents.err = core::ptr::null_mut(); }
7456 CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { err }
7460 result_ok: o.result_ok,
7465 /// The contents of CResult_OfferBolt12ParseErrorZ
7466 pub union CResult_OfferBolt12ParseErrorZPtr {
7467 /// A pointer to the contents in the success state.
7468 /// Reading from this pointer when `result_ok` is not set is undefined.
7469 pub result: *mut crate::lightning::offers::offer::Offer,
7470 /// A pointer to the contents in the error state.
7471 /// Reading from this pointer when `result_ok` is set is undefined.
7472 pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
7475 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
7476 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
7477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7478 pub struct CResult_OfferBolt12ParseErrorZ {
7479 /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
7480 /// `err` or `result` depending on the state of `result_ok`.
7481 pub contents: CResult_OfferBolt12ParseErrorZPtr,
7482 /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
7483 pub result_ok: bool,
7486 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
7487 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
7488 CResult_OfferBolt12ParseErrorZ {
7489 contents: CResult_OfferBolt12ParseErrorZPtr {
7490 result: Box::into_raw(Box::new(o)),
7496 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
7497 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
7498 CResult_OfferBolt12ParseErrorZ {
7499 contents: CResult_OfferBolt12ParseErrorZPtr {
7500 err: Box::into_raw(Box::new(e)),
7505 /// Checks if the given object is currently in the success state
7507 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
7511 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
7512 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
7513 impl Drop for CResult_OfferBolt12ParseErrorZ {
7514 fn drop(&mut self) {
7516 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7517 let _ = unsafe { Box::from_raw(self.contents.result) };
7520 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7521 let _ = unsafe { Box::from_raw(self.contents.err) };
7526 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
7527 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
7528 let contents = if o.result_ok {
7529 let result = unsafe { o.contents.result };
7530 unsafe { o.contents.result = core::ptr::null_mut() };
7531 CResult_OfferBolt12ParseErrorZPtr { result }
7533 let err = unsafe { o.contents.err };
7534 unsafe { o.contents.err = core::ptr::null_mut(); }
7535 CResult_OfferBolt12ParseErrorZPtr { err }
7539 result_ok: o.result_ok,
7543 impl Clone for CResult_OfferBolt12ParseErrorZ {
7544 fn clone(&self) -> Self {
7546 Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
7547 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
7550 Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
7551 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
7557 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
7558 /// but with all dynamically-allocated buffers duplicated in new buffers.
7559 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
7561 /// The contents of CResult_NodeIdDecodeErrorZ
7562 pub union CResult_NodeIdDecodeErrorZPtr {
7563 /// A pointer to the contents in the success state.
7564 /// Reading from this pointer when `result_ok` is not set is undefined.
7565 pub result: *mut crate::lightning::routing::gossip::NodeId,
7566 /// A pointer to the contents in the error state.
7567 /// Reading from this pointer when `result_ok` is set is undefined.
7568 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7571 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
7572 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7574 pub struct CResult_NodeIdDecodeErrorZ {
7575 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
7576 /// `err` or `result` depending on the state of `result_ok`.
7577 pub contents: CResult_NodeIdDecodeErrorZPtr,
7578 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
7579 pub result_ok: bool,
7582 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
7583 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
7584 CResult_NodeIdDecodeErrorZ {
7585 contents: CResult_NodeIdDecodeErrorZPtr {
7586 result: Box::into_raw(Box::new(o)),
7592 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
7593 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
7594 CResult_NodeIdDecodeErrorZ {
7595 contents: CResult_NodeIdDecodeErrorZPtr {
7596 err: Box::into_raw(Box::new(e)),
7601 /// Checks if the given object is currently in the success state
7603 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
7607 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
7608 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
7609 impl Drop for CResult_NodeIdDecodeErrorZ {
7610 fn drop(&mut self) {
7612 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7613 let _ = unsafe { Box::from_raw(self.contents.result) };
7616 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7617 let _ = unsafe { Box::from_raw(self.contents.err) };
7622 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
7623 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
7624 let contents = if o.result_ok {
7625 let result = unsafe { o.contents.result };
7626 unsafe { o.contents.result = core::ptr::null_mut() };
7627 CResult_NodeIdDecodeErrorZPtr { result }
7629 let err = unsafe { o.contents.err };
7630 unsafe { o.contents.err = core::ptr::null_mut(); }
7631 CResult_NodeIdDecodeErrorZPtr { err }
7635 result_ok: o.result_ok,
7639 impl Clone for CResult_NodeIdDecodeErrorZ {
7640 fn clone(&self) -> Self {
7642 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
7643 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
7646 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
7647 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7653 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
7654 /// but with all dynamically-allocated buffers duplicated in new buffers.
7655 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
7657 /// The contents of CResult_PublicKeySecp256k1ErrorZ
7658 pub union CResult_PublicKeySecp256k1ErrorZPtr {
7659 /// A pointer to the contents in the success state.
7660 /// Reading from this pointer when `result_ok` is not set is undefined.
7661 pub result: *mut crate::c_types::PublicKey,
7662 /// A pointer to the contents in the error state.
7663 /// Reading from this pointer when `result_ok` is set is undefined.
7664 pub err: *mut crate::c_types::Secp256k1Error,
7667 /// A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation,
7668 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
7669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7670 pub struct CResult_PublicKeySecp256k1ErrorZ {
7671 /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either
7672 /// `err` or `result` depending on the state of `result_ok`.
7673 pub contents: CResult_PublicKeySecp256k1ErrorZPtr,
7674 /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state.
7675 pub result_ok: bool,
7678 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state.
7679 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ {
7680 CResult_PublicKeySecp256k1ErrorZ {
7681 contents: CResult_PublicKeySecp256k1ErrorZPtr {
7682 result: Box::into_raw(Box::new(o)),
7688 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state.
7689 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ {
7690 CResult_PublicKeySecp256k1ErrorZ {
7691 contents: CResult_PublicKeySecp256k1ErrorZPtr {
7692 err: Box::into_raw(Box::new(e)),
7697 /// Checks if the given object is currently in the success state
7699 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool {
7703 /// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ.
7704 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { }
7705 impl Drop for CResult_PublicKeySecp256k1ErrorZ {
7706 fn drop(&mut self) {
7708 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7709 let _ = unsafe { Box::from_raw(self.contents.result) };
7712 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7713 let _ = unsafe { Box::from_raw(self.contents.err) };
7718 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecp256k1ErrorZ {
7719 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
7720 let contents = if o.result_ok {
7721 let result = unsafe { o.contents.result };
7722 unsafe { o.contents.result = core::ptr::null_mut() };
7723 CResult_PublicKeySecp256k1ErrorZPtr { result }
7725 let err = unsafe { o.contents.err };
7726 unsafe { o.contents.err = core::ptr::null_mut(); }
7727 CResult_PublicKeySecp256k1ErrorZPtr { err }
7731 result_ok: o.result_ok,
7735 impl Clone for CResult_PublicKeySecp256k1ErrorZ {
7736 fn clone(&self) -> Self {
7738 Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr {
7739 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7742 Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr {
7743 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
7749 /// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig`
7750 /// but with all dynamically-allocated buffers duplicated in new buffers.
7751 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) }
7754 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
7755 pub enum COption_NetworkUpdateZ {
7756 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
7757 Some(crate::lightning::routing::gossip::NetworkUpdate),
7758 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
7761 impl COption_NetworkUpdateZ {
7762 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7763 if let Self::None = self { false } else { true }
7765 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7768 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
7769 if let Self::Some(v) = self { v } else { unreachable!() }
7773 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
7774 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
7775 COption_NetworkUpdateZ::Some(o)
7778 /// Constructs a new COption_NetworkUpdateZ containing nothing
7779 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
7780 COption_NetworkUpdateZ::None
7783 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
7784 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
7786 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
7787 /// but with all dynamically-allocated buffers duplicated in new buffers.
7788 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
7790 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
7791 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7792 /// A pointer to the contents in the success state.
7793 /// Reading from this pointer when `result_ok` is not set is undefined.
7794 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
7795 /// A pointer to the contents in the error state.
7796 /// Reading from this pointer when `result_ok` is set is undefined.
7797 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7800 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
7801 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7803 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
7804 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
7805 /// `err` or `result` depending on the state of `result_ok`.
7806 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
7807 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
7808 pub result_ok: bool,
7811 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
7812 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
7813 CResult_COption_NetworkUpdateZDecodeErrorZ {
7814 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7815 result: Box::into_raw(Box::new(o)),
7821 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
7822 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
7823 CResult_COption_NetworkUpdateZDecodeErrorZ {
7824 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7825 err: Box::into_raw(Box::new(e)),
7830 /// Checks if the given object is currently in the success state
7832 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
7836 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
7837 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
7838 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
7839 fn drop(&mut self) {
7841 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7842 let _ = unsafe { Box::from_raw(self.contents.result) };
7845 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7846 let _ = unsafe { Box::from_raw(self.contents.err) };
7851 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
7852 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7853 let contents = if o.result_ok {
7854 let result = unsafe { o.contents.result };
7855 unsafe { o.contents.result = core::ptr::null_mut() };
7856 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
7858 let err = unsafe { o.contents.err };
7859 unsafe { o.contents.err = core::ptr::null_mut(); }
7860 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
7864 result_ok: o.result_ok,
7868 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
7869 fn clone(&self) -> Self {
7871 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7872 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
7875 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7876 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7882 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
7883 /// but with all dynamically-allocated buffers duplicated in new buffers.
7884 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
7886 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
7887 pub enum COption_UtxoLookupZ {
7888 /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
7889 Some(crate::lightning::routing::utxo::UtxoLookup),
7890 /// When we're in this state, this COption_UtxoLookupZ contains nothing
7893 impl COption_UtxoLookupZ {
7894 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7895 if let Self::None = self { false } else { true }
7897 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7900 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
7901 if let Self::Some(v) = self { v } else { unreachable!() }
7905 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
7906 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
7907 COption_UtxoLookupZ::Some(o)
7910 /// Constructs a new COption_UtxoLookupZ containing nothing
7911 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
7912 COption_UtxoLookupZ::None
7915 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
7916 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
7918 /// The contents of CResult_NoneLightningErrorZ
7919 pub union CResult_NoneLightningErrorZPtr {
7920 /// Note that this value is always NULL, as there are no contents in the OK variant
7921 pub result: *mut core::ffi::c_void,
7922 /// A pointer to the contents in the error state.
7923 /// Reading from this pointer when `result_ok` is set is undefined.
7924 pub err: *mut crate::lightning::ln::msgs::LightningError,
7927 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7928 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7930 pub struct CResult_NoneLightningErrorZ {
7931 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7932 /// `err` or `result` depending on the state of `result_ok`.
7933 pub contents: CResult_NoneLightningErrorZPtr,
7934 /// Whether this CResult_NoneLightningErrorZ represents a success state.
7935 pub result_ok: bool,
7938 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7939 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7940 CResult_NoneLightningErrorZ {
7941 contents: CResult_NoneLightningErrorZPtr {
7942 result: core::ptr::null_mut(),
7948 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7949 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7950 CResult_NoneLightningErrorZ {
7951 contents: CResult_NoneLightningErrorZPtr {
7952 err: Box::into_raw(Box::new(e)),
7957 /// Checks if the given object is currently in the success state
7959 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
7963 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7964 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7965 impl Drop for CResult_NoneLightningErrorZ {
7966 fn drop(&mut self) {
7969 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7970 let _ = unsafe { Box::from_raw(self.contents.err) };
7975 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7976 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7977 let contents = if o.result_ok {
7978 let _ = unsafe { Box::from_raw(o.contents.result) };
7979 o.contents.result = core::ptr::null_mut();
7980 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
7982 let err = unsafe { o.contents.err };
7983 unsafe { o.contents.err = core::ptr::null_mut(); }
7984 CResult_NoneLightningErrorZPtr { err }
7988 result_ok: o.result_ok,
7992 impl Clone for CResult_NoneLightningErrorZ {
7993 fn clone(&self) -> Self {
7995 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7996 result: core::ptr::null_mut()
7999 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
8000 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8006 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
8007 /// but with all dynamically-allocated buffers duplicated in new buffers.
8008 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
8010 /// The contents of CResult_boolLightningErrorZ
8011 pub union CResult_boolLightningErrorZPtr {
8012 /// A pointer to the contents in the success state.
8013 /// Reading from this pointer when `result_ok` is not set is undefined.
8014 pub result: *mut bool,
8015 /// A pointer to the contents in the error state.
8016 /// Reading from this pointer when `result_ok` is set is undefined.
8017 pub err: *mut crate::lightning::ln::msgs::LightningError,
8020 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
8021 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
8022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8023 pub struct CResult_boolLightningErrorZ {
8024 /// The contents of this CResult_boolLightningErrorZ, accessible via either
8025 /// `err` or `result` depending on the state of `result_ok`.
8026 pub contents: CResult_boolLightningErrorZPtr,
8027 /// Whether this CResult_boolLightningErrorZ represents a success state.
8028 pub result_ok: bool,
8031 /// Creates a new CResult_boolLightningErrorZ in the success state.
8032 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
8033 CResult_boolLightningErrorZ {
8034 contents: CResult_boolLightningErrorZPtr {
8035 result: Box::into_raw(Box::new(o)),
8041 /// Creates a new CResult_boolLightningErrorZ in the error state.
8042 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
8043 CResult_boolLightningErrorZ {
8044 contents: CResult_boolLightningErrorZPtr {
8045 err: Box::into_raw(Box::new(e)),
8050 /// Checks if the given object is currently in the success state
8052 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
8056 /// Frees any resources used by the CResult_boolLightningErrorZ.
8057 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
8058 impl Drop for CResult_boolLightningErrorZ {
8059 fn drop(&mut self) {
8061 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8062 let _ = unsafe { Box::from_raw(self.contents.result) };
8065 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8066 let _ = unsafe { Box::from_raw(self.contents.err) };
8071 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
8072 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
8073 let contents = if o.result_ok {
8074 let result = unsafe { o.contents.result };
8075 unsafe { o.contents.result = core::ptr::null_mut() };
8076 CResult_boolLightningErrorZPtr { result }
8078 let err = unsafe { o.contents.err };
8079 unsafe { o.contents.err = core::ptr::null_mut(); }
8080 CResult_boolLightningErrorZPtr { err }
8084 result_ok: o.result_ok,
8088 impl Clone for CResult_boolLightningErrorZ {
8089 fn clone(&self) -> Self {
8091 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
8092 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8095 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
8096 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8102 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8103 /// but with all dynamically-allocated buffers duplicated in new buffers.
8104 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
8106 /// A tuple of 3 elements. See the individual fields for the types contained.
8107 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8108 /// The element at position 0
8109 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
8110 /// The element at position 1
8111 pub b: crate::lightning::ln::msgs::ChannelUpdate,
8112 /// The element at position 2
8113 pub c: crate::lightning::ln::msgs::ChannelUpdate,
8115 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8116 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
8124 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8125 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
8126 (self.a, self.b, self.c)
8129 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8130 fn clone(&self) -> Self {
8132 a: Clone::clone(&self.a),
8133 b: Clone::clone(&self.b),
8134 c: Clone::clone(&self.c),
8139 /// Creates a new tuple which has the same data as `orig`
8140 /// but with all dynamically-allocated buffers duplicated in new buffers.
8141 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
8142 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
8144 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 {
8145 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
8149 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
8150 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
8153 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
8154 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8155 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
8156 Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
8157 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
8160 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8161 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8162 if let Self::None = self { false } else { true }
8164 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8167 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8168 if let Self::Some(v) = self { v } else { unreachable!() }
8172 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
8173 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8174 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
8177 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
8178 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8179 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
8182 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
8183 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
8185 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
8186 /// but with all dynamically-allocated buffers duplicated in new buffers.
8187 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
8189 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
8190 /// This corresponds to std::vector in C++
8191 pub struct CVec_MessageSendEventZ {
8192 /// The elements in the array.
8193 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8194 pub data: *mut crate::lightning::events::MessageSendEvent,
8195 /// The number of elements pointed to by `data`.
8198 impl CVec_MessageSendEventZ {
8199 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
8200 if self.datalen == 0 { return Vec::new(); }
8201 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8202 self.data = core::ptr::null_mut();
8206 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
8207 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8210 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
8211 fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
8212 let datalen = v.len();
8213 let data = Box::into_raw(v.into_boxed_slice());
8214 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8218 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8219 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
8220 impl Drop for CVec_MessageSendEventZ {
8221 fn drop(&mut self) {
8222 if self.datalen == 0 { return; }
8223 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8226 impl Clone for CVec_MessageSendEventZ {
8227 fn clone(&self) -> Self {
8228 let mut res = Vec::new();
8229 if self.datalen == 0 { return Self::from(res); }
8230 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8235 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
8236 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
8237 /// A pointer to the contents in the success state.
8238 /// Reading from this pointer when `result_ok` is not set is undefined.
8239 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
8240 /// A pointer to the contents in the error state.
8241 /// Reading from this pointer when `result_ok` is set is undefined.
8242 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8245 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
8246 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8248 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
8249 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
8250 /// `err` or `result` depending on the state of `result_ok`.
8251 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
8252 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
8253 pub result_ok: bool,
8256 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
8257 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
8258 CResult_ChannelUpdateInfoDecodeErrorZ {
8259 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8260 result: Box::into_raw(Box::new(o)),
8266 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
8267 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
8268 CResult_ChannelUpdateInfoDecodeErrorZ {
8269 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8270 err: Box::into_raw(Box::new(e)),
8275 /// Checks if the given object is currently in the success state
8277 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
8281 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
8282 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
8283 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
8284 fn drop(&mut self) {
8286 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8287 let _ = unsafe { Box::from_raw(self.contents.result) };
8290 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8291 let _ = unsafe { Box::from_raw(self.contents.err) };
8296 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
8297 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8298 let contents = if o.result_ok {
8299 let result = unsafe { o.contents.result };
8300 unsafe { o.contents.result = core::ptr::null_mut() };
8301 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
8303 let err = unsafe { o.contents.err };
8304 unsafe { o.contents.err = core::ptr::null_mut(); }
8305 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
8309 result_ok: o.result_ok,
8313 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
8314 fn clone(&self) -> Self {
8316 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8317 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
8320 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8321 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8327 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
8328 /// but with all dynamically-allocated buffers duplicated in new buffers.
8329 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
8331 /// The contents of CResult_ChannelInfoDecodeErrorZ
8332 pub union CResult_ChannelInfoDecodeErrorZPtr {
8333 /// A pointer to the contents in the success state.
8334 /// Reading from this pointer when `result_ok` is not set is undefined.
8335 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
8336 /// A pointer to the contents in the error state.
8337 /// Reading from this pointer when `result_ok` is set is undefined.
8338 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8341 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8342 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8344 pub struct CResult_ChannelInfoDecodeErrorZ {
8345 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8346 /// `err` or `result` depending on the state of `result_ok`.
8347 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
8348 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8349 pub result_ok: bool,
8352 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8353 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
8354 CResult_ChannelInfoDecodeErrorZ {
8355 contents: CResult_ChannelInfoDecodeErrorZPtr {
8356 result: Box::into_raw(Box::new(o)),
8362 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8363 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
8364 CResult_ChannelInfoDecodeErrorZ {
8365 contents: CResult_ChannelInfoDecodeErrorZPtr {
8366 err: Box::into_raw(Box::new(e)),
8371 /// Checks if the given object is currently in the success state
8373 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
8377 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8378 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
8379 impl Drop for CResult_ChannelInfoDecodeErrorZ {
8380 fn drop(&mut self) {
8382 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8383 let _ = unsafe { Box::from_raw(self.contents.result) };
8386 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8387 let _ = unsafe { Box::from_raw(self.contents.err) };
8392 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
8393 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8394 let contents = if o.result_ok {
8395 let result = unsafe { o.contents.result };
8396 unsafe { o.contents.result = core::ptr::null_mut() };
8397 CResult_ChannelInfoDecodeErrorZPtr { result }
8399 let err = unsafe { o.contents.err };
8400 unsafe { o.contents.err = core::ptr::null_mut(); }
8401 CResult_ChannelInfoDecodeErrorZPtr { err }
8405 result_ok: o.result_ok,
8409 impl Clone for CResult_ChannelInfoDecodeErrorZ {
8410 fn clone(&self) -> Self {
8412 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
8413 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
8416 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
8417 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8423 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8424 /// but with all dynamically-allocated buffers duplicated in new buffers.
8425 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8427 /// The contents of CResult_RoutingFeesDecodeErrorZ
8428 pub union CResult_RoutingFeesDecodeErrorZPtr {
8429 /// A pointer to the contents in the success state.
8430 /// Reading from this pointer when `result_ok` is not set is undefined.
8431 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
8432 /// A pointer to the contents in the error state.
8433 /// Reading from this pointer when `result_ok` is set is undefined.
8434 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8437 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8438 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8440 pub struct CResult_RoutingFeesDecodeErrorZ {
8441 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8442 /// `err` or `result` depending on the state of `result_ok`.
8443 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8444 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8445 pub result_ok: bool,
8448 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8449 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8450 CResult_RoutingFeesDecodeErrorZ {
8451 contents: CResult_RoutingFeesDecodeErrorZPtr {
8452 result: Box::into_raw(Box::new(o)),
8458 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8459 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
8460 CResult_RoutingFeesDecodeErrorZ {
8461 contents: CResult_RoutingFeesDecodeErrorZPtr {
8462 err: Box::into_raw(Box::new(e)),
8467 /// Checks if the given object is currently in the success state
8469 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
8473 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8474 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
8475 impl Drop for CResult_RoutingFeesDecodeErrorZ {
8476 fn drop(&mut self) {
8478 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8479 let _ = unsafe { Box::from_raw(self.contents.result) };
8482 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8483 let _ = unsafe { Box::from_raw(self.contents.err) };
8488 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
8489 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
8490 let contents = if o.result_ok {
8491 let result = unsafe { o.contents.result };
8492 unsafe { o.contents.result = core::ptr::null_mut() };
8493 CResult_RoutingFeesDecodeErrorZPtr { result }
8495 let err = unsafe { o.contents.err };
8496 unsafe { o.contents.err = core::ptr::null_mut(); }
8497 CResult_RoutingFeesDecodeErrorZPtr { err }
8501 result_ok: o.result_ok,
8505 impl Clone for CResult_RoutingFeesDecodeErrorZ {
8506 fn clone(&self) -> Self {
8508 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
8509 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
8512 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
8513 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8519 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8520 /// but with all dynamically-allocated buffers duplicated in new buffers.
8521 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
8523 /// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size.
8524 /// This corresponds to std::vector in C++
8525 pub struct CVec_SocketAddressZ {
8526 /// The elements in the array.
8527 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8528 pub data: *mut crate::lightning::ln::msgs::SocketAddress,
8529 /// The number of elements pointed to by `data`.
8532 impl CVec_SocketAddressZ {
8533 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::SocketAddress> {
8534 if self.datalen == 0 { return Vec::new(); }
8535 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8536 self.data = core::ptr::null_mut();
8540 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] {
8541 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8544 impl From<Vec<crate::lightning::ln::msgs::SocketAddress>> for CVec_SocketAddressZ {
8545 fn from(v: Vec<crate::lightning::ln::msgs::SocketAddress>) -> Self {
8546 let datalen = v.len();
8547 let data = Box::into_raw(v.into_boxed_slice());
8548 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8552 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8553 pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { }
8554 impl Drop for CVec_SocketAddressZ {
8555 fn drop(&mut self) {
8556 if self.datalen == 0 { return; }
8557 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8560 impl Clone for CVec_SocketAddressZ {
8561 fn clone(&self) -> Self {
8562 let mut res = Vec::new();
8563 if self.datalen == 0 { return Self::from(res); }
8564 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8569 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8570 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8571 /// A pointer to the contents in the success state.
8572 /// Reading from this pointer when `result_ok` is not set is undefined.
8573 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
8574 /// A pointer to the contents in the error state.
8575 /// Reading from this pointer when `result_ok` is set is undefined.
8576 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8579 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8580 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8582 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
8583 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8584 /// `err` or `result` depending on the state of `result_ok`.
8585 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
8586 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8587 pub result_ok: bool,
8590 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8591 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8592 CResult_NodeAnnouncementInfoDecodeErrorZ {
8593 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8594 result: Box::into_raw(Box::new(o)),
8600 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8601 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8602 CResult_NodeAnnouncementInfoDecodeErrorZ {
8603 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8604 err: Box::into_raw(Box::new(e)),
8609 /// Checks if the given object is currently in the success state
8611 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
8615 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8616 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
8617 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
8618 fn drop(&mut self) {
8620 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8621 let _ = unsafe { Box::from_raw(self.contents.result) };
8624 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8625 let _ = unsafe { Box::from_raw(self.contents.err) };
8630 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
8631 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8632 let contents = if o.result_ok {
8633 let result = unsafe { o.contents.result };
8634 unsafe { o.contents.result = core::ptr::null_mut() };
8635 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
8637 let err = unsafe { o.contents.err };
8638 unsafe { o.contents.err = core::ptr::null_mut(); }
8639 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
8643 result_ok: o.result_ok,
8647 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
8648 fn clone(&self) -> Self {
8650 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8651 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
8654 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8655 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8661 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8662 /// but with all dynamically-allocated buffers duplicated in new buffers.
8663 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
8665 /// The contents of CResult_NodeAliasDecodeErrorZ
8666 pub union CResult_NodeAliasDecodeErrorZPtr {
8667 /// A pointer to the contents in the success state.
8668 /// Reading from this pointer when `result_ok` is not set is undefined.
8669 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
8670 /// A pointer to the contents in the error state.
8671 /// Reading from this pointer when `result_ok` is set is undefined.
8672 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8675 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
8676 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
8677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8678 pub struct CResult_NodeAliasDecodeErrorZ {
8679 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
8680 /// `err` or `result` depending on the state of `result_ok`.
8681 pub contents: CResult_NodeAliasDecodeErrorZPtr,
8682 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
8683 pub result_ok: bool,
8686 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
8687 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
8688 CResult_NodeAliasDecodeErrorZ {
8689 contents: CResult_NodeAliasDecodeErrorZPtr {
8690 result: Box::into_raw(Box::new(o)),
8696 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
8697 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
8698 CResult_NodeAliasDecodeErrorZ {
8699 contents: CResult_NodeAliasDecodeErrorZPtr {
8700 err: Box::into_raw(Box::new(e)),
8705 /// Checks if the given object is currently in the success state
8707 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
8711 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
8712 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
8713 impl Drop for CResult_NodeAliasDecodeErrorZ {
8714 fn drop(&mut self) {
8716 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8717 let _ = unsafe { Box::from_raw(self.contents.result) };
8720 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8721 let _ = unsafe { Box::from_raw(self.contents.err) };
8726 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
8727 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
8728 let contents = if o.result_ok {
8729 let result = unsafe { o.contents.result };
8730 unsafe { o.contents.result = core::ptr::null_mut() };
8731 CResult_NodeAliasDecodeErrorZPtr { result }
8733 let err = unsafe { o.contents.err };
8734 unsafe { o.contents.err = core::ptr::null_mut(); }
8735 CResult_NodeAliasDecodeErrorZPtr { err }
8739 result_ok: o.result_ok,
8743 impl Clone for CResult_NodeAliasDecodeErrorZ {
8744 fn clone(&self) -> Self {
8746 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
8747 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
8750 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
8751 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8757 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
8758 /// but with all dynamically-allocated buffers duplicated in new buffers.
8759 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
8761 /// The contents of CResult_NodeInfoDecodeErrorZ
8762 pub union CResult_NodeInfoDecodeErrorZPtr {
8763 /// A pointer to the contents in the success state.
8764 /// Reading from this pointer when `result_ok` is not set is undefined.
8765 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
8766 /// A pointer to the contents in the error state.
8767 /// Reading from this pointer when `result_ok` is set is undefined.
8768 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8771 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8772 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8774 pub struct CResult_NodeInfoDecodeErrorZ {
8775 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8776 /// `err` or `result` depending on the state of `result_ok`.
8777 pub contents: CResult_NodeInfoDecodeErrorZPtr,
8778 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8779 pub result_ok: bool,
8782 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8783 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
8784 CResult_NodeInfoDecodeErrorZ {
8785 contents: CResult_NodeInfoDecodeErrorZPtr {
8786 result: Box::into_raw(Box::new(o)),
8792 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8793 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
8794 CResult_NodeInfoDecodeErrorZ {
8795 contents: CResult_NodeInfoDecodeErrorZPtr {
8796 err: Box::into_raw(Box::new(e)),
8801 /// Checks if the given object is currently in the success state
8803 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
8807 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8808 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
8809 impl Drop for CResult_NodeInfoDecodeErrorZ {
8810 fn drop(&mut self) {
8812 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8813 let _ = unsafe { Box::from_raw(self.contents.result) };
8816 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8817 let _ = unsafe { Box::from_raw(self.contents.err) };
8822 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
8823 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8824 let contents = if o.result_ok {
8825 let result = unsafe { o.contents.result };
8826 unsafe { o.contents.result = core::ptr::null_mut() };
8827 CResult_NodeInfoDecodeErrorZPtr { result }
8829 let err = unsafe { o.contents.err };
8830 unsafe { o.contents.err = core::ptr::null_mut(); }
8831 CResult_NodeInfoDecodeErrorZPtr { err }
8835 result_ok: o.result_ok,
8839 impl Clone for CResult_NodeInfoDecodeErrorZ {
8840 fn clone(&self) -> Self {
8842 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
8843 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
8846 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
8847 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8853 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8854 /// but with all dynamically-allocated buffers duplicated in new buffers.
8855 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
8857 /// The contents of CResult_NetworkGraphDecodeErrorZ
8858 pub union CResult_NetworkGraphDecodeErrorZPtr {
8859 /// A pointer to the contents in the success state.
8860 /// Reading from this pointer when `result_ok` is not set is undefined.
8861 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
8862 /// A pointer to the contents in the error state.
8863 /// Reading from this pointer when `result_ok` is set is undefined.
8864 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8867 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8868 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
8869 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8870 pub struct CResult_NetworkGraphDecodeErrorZ {
8871 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8872 /// `err` or `result` depending on the state of `result_ok`.
8873 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
8874 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8875 pub result_ok: bool,
8878 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8879 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
8880 CResult_NetworkGraphDecodeErrorZ {
8881 contents: CResult_NetworkGraphDecodeErrorZPtr {
8882 result: Box::into_raw(Box::new(o)),
8888 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8889 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
8890 CResult_NetworkGraphDecodeErrorZ {
8891 contents: CResult_NetworkGraphDecodeErrorZPtr {
8892 err: Box::into_raw(Box::new(e)),
8897 /// Checks if the given object is currently in the success state
8899 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
8903 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8904 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
8905 impl Drop for CResult_NetworkGraphDecodeErrorZ {
8906 fn drop(&mut self) {
8908 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8909 let _ = unsafe { Box::from_raw(self.contents.result) };
8912 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8913 let _ = unsafe { Box::from_raw(self.contents.err) };
8918 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
8919 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
8920 let contents = if o.result_ok {
8921 let result = unsafe { o.contents.result };
8922 unsafe { o.contents.result = core::ptr::null_mut() };
8923 CResult_NetworkGraphDecodeErrorZPtr { result }
8925 let err = unsafe { o.contents.err };
8926 unsafe { o.contents.err = core::ptr::null_mut(); }
8927 CResult_NetworkGraphDecodeErrorZPtr { err }
8931 result_ok: o.result_ok,
8937 /// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
8938 pub enum COption_CVec_SocketAddressZZ {
8939 /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ
8940 Some(crate::c_types::derived::CVec_SocketAddressZ),
8941 /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing
8944 impl COption_CVec_SocketAddressZZ {
8945 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8946 if let Self::None = self { false } else { true }
8948 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8951 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_SocketAddressZ {
8952 if let Self::Some(v) = self { v } else { unreachable!() }
8956 /// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
8957 pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ {
8958 COption_CVec_SocketAddressZZ::Some(o)
8961 /// Constructs a new COption_CVec_SocketAddressZZ containing nothing
8962 pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ {
8963 COption_CVec_SocketAddressZZ::None
8966 /// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state
8967 pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { }
8969 /// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig`
8970 /// but with all dynamically-allocated buffers duplicated in new buffers.
8971 pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) }
8973 /// The contents of CResult_u64ShortChannelIdErrorZ
8974 pub union CResult_u64ShortChannelIdErrorZPtr {
8975 /// A pointer to the contents in the success state.
8976 /// Reading from this pointer when `result_ok` is not set is undefined.
8977 pub result: *mut u64,
8978 /// A pointer to the contents in the error state.
8979 /// Reading from this pointer when `result_ok` is set is undefined.
8980 pub err: *mut crate::lightning::util::scid_utils::ShortChannelIdError,
8983 /// A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation,
8984 /// containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure.
8985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8986 pub struct CResult_u64ShortChannelIdErrorZ {
8987 /// The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either
8988 /// `err` or `result` depending on the state of `result_ok`.
8989 pub contents: CResult_u64ShortChannelIdErrorZPtr,
8990 /// Whether this CResult_u64ShortChannelIdErrorZ represents a success state.
8991 pub result_ok: bool,
8994 /// Creates a new CResult_u64ShortChannelIdErrorZ in the success state.
8995 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_ok(o: u64) -> CResult_u64ShortChannelIdErrorZ {
8996 CResult_u64ShortChannelIdErrorZ {
8997 contents: CResult_u64ShortChannelIdErrorZPtr {
8998 result: Box::into_raw(Box::new(o)),
9004 /// Creates a new CResult_u64ShortChannelIdErrorZ in the error state.
9005 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_err(e: crate::lightning::util::scid_utils::ShortChannelIdError) -> CResult_u64ShortChannelIdErrorZ {
9006 CResult_u64ShortChannelIdErrorZ {
9007 contents: CResult_u64ShortChannelIdErrorZPtr {
9008 err: Box::into_raw(Box::new(e)),
9013 /// Checks if the given object is currently in the success state
9015 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_is_ok(o: &CResult_u64ShortChannelIdErrorZ) -> bool {
9019 /// Frees any resources used by the CResult_u64ShortChannelIdErrorZ.
9020 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_free(_res: CResult_u64ShortChannelIdErrorZ) { }
9021 impl Drop for CResult_u64ShortChannelIdErrorZ {
9022 fn drop(&mut self) {
9024 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9025 let _ = unsafe { Box::from_raw(self.contents.result) };
9028 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9029 let _ = unsafe { Box::from_raw(self.contents.err) };
9034 impl From<crate::c_types::CResultTempl<u64, crate::lightning::util::scid_utils::ShortChannelIdError>> for CResult_u64ShortChannelIdErrorZ {
9035 fn from(mut o: crate::c_types::CResultTempl<u64, crate::lightning::util::scid_utils::ShortChannelIdError>) -> Self {
9036 let contents = if o.result_ok {
9037 let result = unsafe { o.contents.result };
9038 unsafe { o.contents.result = core::ptr::null_mut() };
9039 CResult_u64ShortChannelIdErrorZPtr { result }
9041 let err = unsafe { o.contents.err };
9042 unsafe { o.contents.err = core::ptr::null_mut(); }
9043 CResult_u64ShortChannelIdErrorZPtr { err }
9047 result_ok: o.result_ok,
9052 /// The contents of CResult_PendingHTLCInfoInboundHTLCErrZ
9053 pub union CResult_PendingHTLCInfoInboundHTLCErrZPtr {
9054 /// A pointer to the contents in the success state.
9055 /// Reading from this pointer when `result_ok` is not set is undefined.
9056 pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
9057 /// A pointer to the contents in the error state.
9058 /// Reading from this pointer when `result_ok` is set is undefined.
9059 pub err: *mut crate::lightning::ln::onion_payment::InboundHTLCErr,
9062 /// A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation,
9063 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure.
9064 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9065 pub struct CResult_PendingHTLCInfoInboundHTLCErrZ {
9066 /// The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either
9067 /// `err` or `result` depending on the state of `result_ok`.
9068 pub contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr,
9069 /// Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state.
9070 pub result_ok: bool,
9073 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state.
9074 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
9075 CResult_PendingHTLCInfoInboundHTLCErrZ {
9076 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
9077 result: Box::into_raw(Box::new(o)),
9083 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state.
9084 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_err(e: crate::lightning::ln::onion_payment::InboundHTLCErr) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
9085 CResult_PendingHTLCInfoInboundHTLCErrZ {
9086 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
9087 err: Box::into_raw(Box::new(e)),
9092 /// Checks if the given object is currently in the success state
9094 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> bool {
9098 /// Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ.
9099 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res: CResult_PendingHTLCInfoInboundHTLCErrZ) { }
9100 impl Drop for CResult_PendingHTLCInfoInboundHTLCErrZ {
9101 fn drop(&mut self) {
9103 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9104 let _ = unsafe { Box::from_raw(self.contents.result) };
9107 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9108 let _ = unsafe { Box::from_raw(self.contents.err) };
9113 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>> for CResult_PendingHTLCInfoInboundHTLCErrZ {
9114 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>) -> Self {
9115 let contents = if o.result_ok {
9116 let result = unsafe { o.contents.result };
9117 unsafe { o.contents.result = core::ptr::null_mut() };
9118 CResult_PendingHTLCInfoInboundHTLCErrZPtr { result }
9120 let err = unsafe { o.contents.err };
9121 unsafe { o.contents.err = core::ptr::null_mut(); }
9122 CResult_PendingHTLCInfoInboundHTLCErrZPtr { err }
9126 result_ok: o.result_ok,
9130 impl Clone for CResult_PendingHTLCInfoInboundHTLCErrZ {
9131 fn clone(&self) -> Self {
9133 Self { result_ok: true, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
9134 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCInfo>::clone(unsafe { &*self.contents.result })))
9137 Self { result_ok: false, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
9138 err: Box::into_raw(Box::new(<crate::lightning::ln::onion_payment::InboundHTLCErr>::clone(unsafe { &*self.contents.err })))
9144 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ which has the same data as `orig`
9145 /// but with all dynamically-allocated buffers duplicated in new buffers.
9146 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> CResult_PendingHTLCInfoInboundHTLCErrZ { Clone::clone(&orig) }
9148 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
9149 /// This corresponds to std::vector in C++
9150 pub struct CVec_HTLCOutputInCommitmentZ {
9151 /// The elements in the array.
9152 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9153 pub data: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
9154 /// The number of elements pointed to by `data`.
9157 impl CVec_HTLCOutputInCommitmentZ {
9158 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment> {
9159 if self.datalen == 0 { return Vec::new(); }
9160 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9161 self.data = core::ptr::null_mut();
9165 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::HTLCOutputInCommitment] {
9166 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9169 impl From<Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>> for CVec_HTLCOutputInCommitmentZ {
9170 fn from(v: Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>) -> Self {
9171 let datalen = v.len();
9172 let data = Box::into_raw(v.into_boxed_slice());
9173 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9177 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9178 pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { }
9179 impl Drop for CVec_HTLCOutputInCommitmentZ {
9180 fn drop(&mut self) {
9181 if self.datalen == 0 { return; }
9182 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9185 impl Clone for CVec_HTLCOutputInCommitmentZ {
9186 fn clone(&self) -> Self {
9187 let mut res = Vec::new();
9188 if self.datalen == 0 { return Self::from(res); }
9189 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9194 /// A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size.
9195 /// This corresponds to std::vector in C++
9196 pub struct CVec_HTLCDescriptorZ {
9197 /// The elements in the array.
9198 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9199 pub data: *mut crate::lightning::sign::HTLCDescriptor,
9200 /// The number of elements pointed to by `data`.
9203 impl CVec_HTLCDescriptorZ {
9204 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::HTLCDescriptor> {
9205 if self.datalen == 0 { return Vec::new(); }
9206 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9207 self.data = core::ptr::null_mut();
9211 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::HTLCDescriptor] {
9212 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9215 impl From<Vec<crate::lightning::sign::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
9216 fn from(v: Vec<crate::lightning::sign::HTLCDescriptor>) -> Self {
9217 let datalen = v.len();
9218 let data = Box::into_raw(v.into_boxed_slice());
9219 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9223 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9224 pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { }
9225 impl Drop for CVec_HTLCDescriptorZ {
9226 fn drop(&mut self) {
9227 if self.datalen == 0 { return; }
9228 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9231 impl Clone for CVec_HTLCDescriptorZ {
9232 fn clone(&self) -> Self {
9233 let mut res = Vec::new();
9234 if self.datalen == 0 { return Self::from(res); }
9235 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9240 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
9241 /// This corresponds to std::vector in C++
9242 pub struct CVec_UtxoZ {
9243 /// The elements in the array.
9244 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9245 pub data: *mut crate::lightning::events::bump_transaction::Utxo,
9246 /// The number of elements pointed to by `data`.
9250 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Utxo> {
9251 if self.datalen == 0 { return Vec::new(); }
9252 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9253 self.data = core::ptr::null_mut();
9257 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Utxo] {
9258 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9261 impl From<Vec<crate::lightning::events::bump_transaction::Utxo>> for CVec_UtxoZ {
9262 fn from(v: Vec<crate::lightning::events::bump_transaction::Utxo>) -> Self {
9263 let datalen = v.len();
9264 let data = Box::into_raw(v.into_boxed_slice());
9265 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9269 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9270 pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { }
9271 impl Drop for CVec_UtxoZ {
9272 fn drop(&mut self) {
9273 if self.datalen == 0 { return; }
9274 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9277 impl Clone for CVec_UtxoZ {
9278 fn clone(&self) -> Self {
9279 let mut res = Vec::new();
9280 if self.datalen == 0 { return Self::from(res); }
9281 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9287 /// An enum which can either contain a crate::c_types::TxOut or not
9288 pub enum COption_TxOutZ {
9289 /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
9290 Some(crate::c_types::TxOut),
9291 /// When we're in this state, this COption_TxOutZ contains nothing
9294 impl COption_TxOutZ {
9295 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9296 if let Self::None = self { false } else { true }
9298 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9301 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut {
9302 if let Self::Some(v) = self { v } else { unreachable!() }
9306 /// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
9307 pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ {
9308 COption_TxOutZ::Some(o)
9311 /// Constructs a new COption_TxOutZ containing nothing
9312 pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ {
9313 COption_TxOutZ::None
9316 /// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
9317 pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { }
9319 /// Creates a new COption_TxOutZ which has the same data as `orig`
9320 /// but with all dynamically-allocated buffers duplicated in new buffers.
9321 pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) }
9323 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
9324 /// This corresponds to std::vector in C++
9325 pub struct CVec_InputZ {
9326 /// The elements in the array.
9327 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9328 pub data: *mut crate::lightning::events::bump_transaction::Input,
9329 /// The number of elements pointed to by `data`.
9333 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Input> {
9334 if self.datalen == 0 { return Vec::new(); }
9335 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9336 self.data = core::ptr::null_mut();
9340 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Input] {
9341 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9344 impl From<Vec<crate::lightning::events::bump_transaction::Input>> for CVec_InputZ {
9345 fn from(v: Vec<crate::lightning::events::bump_transaction::Input>) -> Self {
9346 let datalen = v.len();
9347 let data = Box::into_raw(v.into_boxed_slice());
9348 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9352 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9353 pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { }
9354 impl Drop for CVec_InputZ {
9355 fn drop(&mut self) {
9356 if self.datalen == 0 { return; }
9357 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9360 impl Clone for CVec_InputZ {
9361 fn clone(&self) -> Self {
9362 let mut res = Vec::new();
9363 if self.datalen == 0 { return Self::from(res); }
9364 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9369 /// The contents of CResult_CoinSelectionNoneZ
9370 pub union CResult_CoinSelectionNoneZPtr {
9371 /// A pointer to the contents in the success state.
9372 /// Reading from this pointer when `result_ok` is not set is undefined.
9373 pub result: *mut crate::lightning::events::bump_transaction::CoinSelection,
9374 /// Note that this value is always NULL, as there are no contents in the Err variant
9375 pub err: *mut core::ffi::c_void,
9378 /// A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
9379 /// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
9380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9381 pub struct CResult_CoinSelectionNoneZ {
9382 /// The contents of this CResult_CoinSelectionNoneZ, accessible via either
9383 /// `err` or `result` depending on the state of `result_ok`.
9384 pub contents: CResult_CoinSelectionNoneZPtr,
9385 /// Whether this CResult_CoinSelectionNoneZ represents a success state.
9386 pub result_ok: bool,
9389 /// Creates a new CResult_CoinSelectionNoneZ in the success state.
9390 pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ {
9391 CResult_CoinSelectionNoneZ {
9392 contents: CResult_CoinSelectionNoneZPtr {
9393 result: Box::into_raw(Box::new(o)),
9399 /// Creates a new CResult_CoinSelectionNoneZ in the error state.
9400 pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ {
9401 CResult_CoinSelectionNoneZ {
9402 contents: CResult_CoinSelectionNoneZPtr {
9403 err: core::ptr::null_mut(),
9408 /// Checks if the given object is currently in the success state
9410 pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool {
9414 /// Frees any resources used by the CResult_CoinSelectionNoneZ.
9415 pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { }
9416 impl Drop for CResult_CoinSelectionNoneZ {
9417 fn drop(&mut self) {
9419 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9420 let _ = unsafe { Box::from_raw(self.contents.result) };
9426 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>> for CResult_CoinSelectionNoneZ {
9427 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>) -> Self {
9428 let contents = if o.result_ok {
9429 let result = unsafe { o.contents.result };
9430 unsafe { o.contents.result = core::ptr::null_mut() };
9431 CResult_CoinSelectionNoneZPtr { result }
9433 let _ = unsafe { Box::from_raw(o.contents.err) };
9434 o.contents.err = core::ptr::null_mut();
9435 CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() }
9439 result_ok: o.result_ok,
9443 impl Clone for CResult_CoinSelectionNoneZ {
9444 fn clone(&self) -> Self {
9446 Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr {
9447 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::CoinSelection>::clone(unsafe { &*self.contents.result })))
9450 Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr {
9451 err: core::ptr::null_mut()
9457 /// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
9458 /// but with all dynamically-allocated buffers duplicated in new buffers.
9459 pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) }
9461 /// The contents of CResult_CVec_UtxoZNoneZ
9462 pub union CResult_CVec_UtxoZNoneZPtr {
9463 /// A pointer to the contents in the success state.
9464 /// Reading from this pointer when `result_ok` is not set is undefined.
9465 pub result: *mut crate::c_types::derived::CVec_UtxoZ,
9466 /// Note that this value is always NULL, as there are no contents in the Err variant
9467 pub err: *mut core::ffi::c_void,
9470 /// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
9471 /// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
9472 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9473 pub struct CResult_CVec_UtxoZNoneZ {
9474 /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
9475 /// `err` or `result` depending on the state of `result_ok`.
9476 pub contents: CResult_CVec_UtxoZNoneZPtr,
9477 /// Whether this CResult_CVec_UtxoZNoneZ represents a success state.
9478 pub result_ok: bool,
9481 /// Creates a new CResult_CVec_UtxoZNoneZ in the success state.
9482 pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ {
9483 CResult_CVec_UtxoZNoneZ {
9484 contents: CResult_CVec_UtxoZNoneZPtr {
9485 result: Box::into_raw(Box::new(o)),
9491 /// Creates a new CResult_CVec_UtxoZNoneZ in the error state.
9492 pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ {
9493 CResult_CVec_UtxoZNoneZ {
9494 contents: CResult_CVec_UtxoZNoneZPtr {
9495 err: core::ptr::null_mut(),
9500 /// Checks if the given object is currently in the success state
9502 pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool {
9506 /// Frees any resources used by the CResult_CVec_UtxoZNoneZ.
9507 pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { }
9508 impl Drop for CResult_CVec_UtxoZNoneZ {
9509 fn drop(&mut self) {
9511 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9512 let _ = unsafe { Box::from_raw(self.contents.result) };
9518 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>> for CResult_CVec_UtxoZNoneZ {
9519 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>) -> Self {
9520 let contents = if o.result_ok {
9521 let result = unsafe { o.contents.result };
9522 unsafe { o.contents.result = core::ptr::null_mut() };
9523 CResult_CVec_UtxoZNoneZPtr { result }
9525 let _ = unsafe { Box::from_raw(o.contents.err) };
9526 o.contents.err = core::ptr::null_mut();
9527 CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() }
9531 result_ok: o.result_ok,
9535 impl Clone for CResult_CVec_UtxoZNoneZ {
9536 fn clone(&self) -> Self {
9538 Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr {
9539 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_UtxoZ>::clone(unsafe { &*self.contents.result })))
9542 Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr {
9543 err: core::ptr::null_mut()
9549 /// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
9550 /// but with all dynamically-allocated buffers duplicated in new buffers.
9551 pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) }
9554 /// An enum which can either contain a crate::lightning::blinded_path::payment::PaymentContext or not
9555 pub enum COption_PaymentContextZ {
9556 /// When we're in this state, this COption_PaymentContextZ contains a crate::lightning::blinded_path::payment::PaymentContext
9557 Some(crate::lightning::blinded_path::payment::PaymentContext),
9558 /// When we're in this state, this COption_PaymentContextZ contains nothing
9561 impl COption_PaymentContextZ {
9562 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9563 if let Self::None = self { false } else { true }
9565 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9568 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::blinded_path::payment::PaymentContext {
9569 if let Self::Some(v) = self { v } else { unreachable!() }
9573 /// Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext
9574 pub extern "C" fn COption_PaymentContextZ_some(o: crate::lightning::blinded_path::payment::PaymentContext) -> COption_PaymentContextZ {
9575 COption_PaymentContextZ::Some(o)
9578 /// Constructs a new COption_PaymentContextZ containing nothing
9579 pub extern "C" fn COption_PaymentContextZ_none() -> COption_PaymentContextZ {
9580 COption_PaymentContextZ::None
9583 /// Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state
9584 pub extern "C" fn COption_PaymentContextZ_free(_res: COption_PaymentContextZ) { }
9586 /// Creates a new COption_PaymentContextZ which has the same data as `orig`
9587 /// but with all dynamically-allocated buffers duplicated in new buffers.
9588 pub extern "C" fn COption_PaymentContextZ_clone(orig: &COption_PaymentContextZ) -> COption_PaymentContextZ { Clone::clone(&orig) }
9590 /// A tuple of 2 elements. See the individual fields for the types contained.
9591 pub struct C2Tuple_u64u16Z {
9592 /// The element at position 0
9594 /// The element at position 1
9597 impl From<(u64, u16)> for C2Tuple_u64u16Z {
9598 fn from (tup: (u64, u16)) -> Self {
9605 impl C2Tuple_u64u16Z {
9606 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u16) {
9610 impl Clone for C2Tuple_u64u16Z {
9611 fn clone(&self) -> Self {
9613 a: Clone::clone(&self.a),
9614 b: Clone::clone(&self.b),
9619 /// Creates a new tuple which has the same data as `orig`
9620 /// but with all dynamically-allocated buffers duplicated in new buffers.
9621 pub extern "C" fn C2Tuple_u64u16Z_clone(orig: &C2Tuple_u64u16Z) -> C2Tuple_u64u16Z { Clone::clone(&orig) }
9622 /// Creates a new C2Tuple_u64u16Z from the contained elements.
9624 pub extern "C" fn C2Tuple_u64u16Z_new(a: u64, b: u16) -> C2Tuple_u64u16Z {
9625 C2Tuple_u64u16Z { a, b, }
9629 /// Frees any resources used by the C2Tuple_u64u16Z.
9630 pub extern "C" fn C2Tuple_u64u16Z_free(_res: C2Tuple_u64u16Z) { }
9633 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not
9634 pub enum COption_C2Tuple_u64u16ZZ {
9635 /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z
9636 Some(crate::c_types::derived::C2Tuple_u64u16Z),
9637 /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing
9640 impl COption_C2Tuple_u64u16ZZ {
9641 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9642 if let Self::None = self { false } else { true }
9644 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9647 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u16Z {
9648 if let Self::Some(v) = self { v } else { unreachable!() }
9652 /// Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z
9653 pub extern "C" fn COption_C2Tuple_u64u16ZZ_some(o: crate::c_types::derived::C2Tuple_u64u16Z) -> COption_C2Tuple_u64u16ZZ {
9654 COption_C2Tuple_u64u16ZZ::Some(o)
9657 /// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing
9658 pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ {
9659 COption_C2Tuple_u64u16ZZ::None
9662 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state
9663 pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) { }
9665 /// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig`
9666 /// but with all dynamically-allocated buffers duplicated in new buffers.
9667 pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) }
9669 /// The contents of CResult_ChannelIdAPIErrorZ
9670 pub union CResult_ChannelIdAPIErrorZPtr {
9671 /// A pointer to the contents in the success state.
9672 /// Reading from this pointer when `result_ok` is not set is undefined.
9673 pub result: *mut crate::lightning::ln::types::ChannelId,
9674 /// A pointer to the contents in the error state.
9675 /// Reading from this pointer when `result_ok` is set is undefined.
9676 pub err: *mut crate::lightning::util::errors::APIError,
9679 /// A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation,
9680 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::util::errors::APIError on failure.
9681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9682 pub struct CResult_ChannelIdAPIErrorZ {
9683 /// The contents of this CResult_ChannelIdAPIErrorZ, accessible via either
9684 /// `err` or `result` depending on the state of `result_ok`.
9685 pub contents: CResult_ChannelIdAPIErrorZPtr,
9686 /// Whether this CResult_ChannelIdAPIErrorZ represents a success state.
9687 pub result_ok: bool,
9690 /// Creates a new CResult_ChannelIdAPIErrorZ in the success state.
9691 pub extern "C" fn CResult_ChannelIdAPIErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdAPIErrorZ {
9692 CResult_ChannelIdAPIErrorZ {
9693 contents: CResult_ChannelIdAPIErrorZPtr {
9694 result: Box::into_raw(Box::new(o)),
9700 /// Creates a new CResult_ChannelIdAPIErrorZ in the error state.
9701 pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ChannelIdAPIErrorZ {
9702 CResult_ChannelIdAPIErrorZ {
9703 contents: CResult_ChannelIdAPIErrorZPtr {
9704 err: Box::into_raw(Box::new(e)),
9709 /// Checks if the given object is currently in the success state
9711 pub extern "C" fn CResult_ChannelIdAPIErrorZ_is_ok(o: &CResult_ChannelIdAPIErrorZ) -> bool {
9715 /// Frees any resources used by the CResult_ChannelIdAPIErrorZ.
9716 pub extern "C" fn CResult_ChannelIdAPIErrorZ_free(_res: CResult_ChannelIdAPIErrorZ) { }
9717 impl Drop for CResult_ChannelIdAPIErrorZ {
9718 fn drop(&mut self) {
9720 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9721 let _ = unsafe { Box::from_raw(self.contents.result) };
9724 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9725 let _ = unsafe { Box::from_raw(self.contents.err) };
9730 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>> for CResult_ChannelIdAPIErrorZ {
9731 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>) -> Self {
9732 let contents = if o.result_ok {
9733 let result = unsafe { o.contents.result };
9734 unsafe { o.contents.result = core::ptr::null_mut() };
9735 CResult_ChannelIdAPIErrorZPtr { result }
9737 let err = unsafe { o.contents.err };
9738 unsafe { o.contents.err = core::ptr::null_mut(); }
9739 CResult_ChannelIdAPIErrorZPtr { err }
9743 result_ok: o.result_ok,
9747 impl Clone for CResult_ChannelIdAPIErrorZ {
9748 fn clone(&self) -> Self {
9750 Self { result_ok: true, contents: CResult_ChannelIdAPIErrorZPtr {
9751 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
9754 Self { result_ok: false, contents: CResult_ChannelIdAPIErrorZPtr {
9755 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9761 /// Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig`
9762 /// but with all dynamically-allocated buffers duplicated in new buffers.
9763 pub extern "C" fn CResult_ChannelIdAPIErrorZ_clone(orig: &CResult_ChannelIdAPIErrorZ) -> CResult_ChannelIdAPIErrorZ { Clone::clone(&orig) }
9765 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
9766 /// This corresponds to std::vector in C++
9767 pub struct CVec_RecentPaymentDetailsZ {
9768 /// The elements in the array.
9769 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9770 pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
9771 /// The number of elements pointed to by `data`.
9774 impl CVec_RecentPaymentDetailsZ {
9775 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
9776 if self.datalen == 0 { return Vec::new(); }
9777 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9778 self.data = core::ptr::null_mut();
9782 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
9783 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9786 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
9787 fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
9788 let datalen = v.len();
9789 let data = Box::into_raw(v.into_boxed_slice());
9790 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9794 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9795 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
9796 impl Drop for CVec_RecentPaymentDetailsZ {
9797 fn drop(&mut self) {
9798 if self.datalen == 0 { return; }
9799 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9803 /// The contents of CResult_NonePaymentSendFailureZ
9804 pub union CResult_NonePaymentSendFailureZPtr {
9805 /// Note that this value is always NULL, as there are no contents in the OK variant
9806 pub result: *mut core::ffi::c_void,
9807 /// A pointer to the contents in the error state.
9808 /// Reading from this pointer when `result_ok` is set is undefined.
9809 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9812 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
9813 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9814 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9815 pub struct CResult_NonePaymentSendFailureZ {
9816 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
9817 /// `err` or `result` depending on the state of `result_ok`.
9818 pub contents: CResult_NonePaymentSendFailureZPtr,
9819 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
9820 pub result_ok: bool,
9823 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
9824 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
9825 CResult_NonePaymentSendFailureZ {
9826 contents: CResult_NonePaymentSendFailureZPtr {
9827 result: core::ptr::null_mut(),
9833 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
9834 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
9835 CResult_NonePaymentSendFailureZ {
9836 contents: CResult_NonePaymentSendFailureZPtr {
9837 err: Box::into_raw(Box::new(e)),
9842 /// Checks if the given object is currently in the success state
9844 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
9848 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
9849 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
9850 impl Drop for CResult_NonePaymentSendFailureZ {
9851 fn drop(&mut self) {
9854 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9855 let _ = unsafe { Box::from_raw(self.contents.err) };
9860 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
9861 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9862 let contents = if o.result_ok {
9863 let _ = unsafe { Box::from_raw(o.contents.result) };
9864 o.contents.result = core::ptr::null_mut();
9865 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
9867 let err = unsafe { o.contents.err };
9868 unsafe { o.contents.err = core::ptr::null_mut(); }
9869 CResult_NonePaymentSendFailureZPtr { err }
9873 result_ok: o.result_ok,
9877 impl Clone for CResult_NonePaymentSendFailureZ {
9878 fn clone(&self) -> Self {
9880 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
9881 result: core::ptr::null_mut()
9884 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
9885 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9891 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9892 /// but with all dynamically-allocated buffers duplicated in new buffers.
9893 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
9895 /// The contents of CResult_NoneRetryableSendFailureZ
9896 pub union CResult_NoneRetryableSendFailureZPtr {
9897 /// Note that this value is always NULL, as there are no contents in the OK variant
9898 pub result: *mut core::ffi::c_void,
9899 /// A pointer to the contents in the error state.
9900 /// Reading from this pointer when `result_ok` is set is undefined.
9901 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9904 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
9905 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9907 pub struct CResult_NoneRetryableSendFailureZ {
9908 /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
9909 /// `err` or `result` depending on the state of `result_ok`.
9910 pub contents: CResult_NoneRetryableSendFailureZPtr,
9911 /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
9912 pub result_ok: bool,
9915 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
9916 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
9917 CResult_NoneRetryableSendFailureZ {
9918 contents: CResult_NoneRetryableSendFailureZPtr {
9919 result: core::ptr::null_mut(),
9925 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
9926 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
9927 CResult_NoneRetryableSendFailureZ {
9928 contents: CResult_NoneRetryableSendFailureZPtr {
9929 err: Box::into_raw(Box::new(e)),
9934 /// Checks if the given object is currently in the success state
9936 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
9940 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
9941 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
9942 impl Drop for CResult_NoneRetryableSendFailureZ {
9943 fn drop(&mut self) {
9946 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9947 let _ = unsafe { Box::from_raw(self.contents.err) };
9952 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
9953 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9954 let contents = if o.result_ok {
9955 let _ = unsafe { Box::from_raw(o.contents.result) };
9956 o.contents.result = core::ptr::null_mut();
9957 CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
9959 let err = unsafe { o.contents.err };
9960 unsafe { o.contents.err = core::ptr::null_mut(); }
9961 CResult_NoneRetryableSendFailureZPtr { err }
9965 result_ok: o.result_ok,
9969 impl Clone for CResult_NoneRetryableSendFailureZ {
9970 fn clone(&self) -> Self {
9972 Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
9973 result: core::ptr::null_mut()
9976 Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
9977 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9983 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
9984 /// but with all dynamically-allocated buffers duplicated in new buffers.
9985 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
9987 /// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ
9988 pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9989 /// A pointer to the contents in the success state.
9990 /// Reading from this pointer when `result_ok` is not set is undefined.
9991 pub result: *mut crate::c_types::ThirtyTwoBytes,
9992 /// A pointer to the contents in the error state.
9993 /// Reading from this pointer when `result_ok` is set is undefined.
9994 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9997 /// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation,
9998 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9999 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10000 pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ {
10001 /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either
10002 /// `err` or `result` depending on the state of `result_ok`.
10003 pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr,
10004 /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state.
10005 pub result_ok: bool,
10008 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state.
10009 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
10010 CResult_ThirtyTwoBytesPaymentSendFailureZ {
10011 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10012 result: Box::into_raw(Box::new(o)),
10018 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state.
10019 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
10020 CResult_ThirtyTwoBytesPaymentSendFailureZ {
10021 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10022 err: Box::into_raw(Box::new(e)),
10027 /// Checks if the given object is currently in the success state
10029 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool {
10033 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ.
10034 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { }
10035 impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10036 fn drop(&mut self) {
10037 if self.result_ok {
10038 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10039 let _ = unsafe { Box::from_raw(self.contents.result) };
10042 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10043 let _ = unsafe { Box::from_raw(self.contents.err) };
10048 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10049 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
10050 let contents = if o.result_ok {
10051 let result = unsafe { o.contents.result };
10052 unsafe { o.contents.result = core::ptr::null_mut() };
10053 CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result }
10055 let err = unsafe { o.contents.err };
10056 unsafe { o.contents.err = core::ptr::null_mut(); }
10057 CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err }
10061 result_ok: o.result_ok,
10065 impl Clone for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10066 fn clone(&self) -> Self {
10067 if self.result_ok {
10068 Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10069 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10072 Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10073 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10079 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig`
10080 /// but with all dynamically-allocated buffers duplicated in new buffers.
10081 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) }
10083 /// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ
10084 pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10085 /// A pointer to the contents in the success state.
10086 /// Reading from this pointer when `result_ok` is not set is undefined.
10087 pub result: *mut crate::c_types::ThirtyTwoBytes,
10088 /// A pointer to the contents in the error state.
10089 /// Reading from this pointer when `result_ok` is set is undefined.
10090 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
10093 /// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation,
10094 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
10095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10096 pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ {
10097 /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either
10098 /// `err` or `result` depending on the state of `result_ok`.
10099 pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr,
10100 /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state.
10101 pub result_ok: bool,
10104 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
10105 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
10106 CResult_ThirtyTwoBytesRetryableSendFailureZ {
10107 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10108 result: Box::into_raw(Box::new(o)),
10114 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
10115 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
10116 CResult_ThirtyTwoBytesRetryableSendFailureZ {
10117 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10118 err: Box::into_raw(Box::new(e)),
10123 /// Checks if the given object is currently in the success state
10125 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool {
10129 /// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ.
10130 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { }
10131 impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10132 fn drop(&mut self) {
10133 if self.result_ok {
10134 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10135 let _ = unsafe { Box::from_raw(self.contents.result) };
10138 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10139 let _ = unsafe { Box::from_raw(self.contents.err) };
10144 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10145 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
10146 let contents = if o.result_ok {
10147 let result = unsafe { o.contents.result };
10148 unsafe { o.contents.result = core::ptr::null_mut() };
10149 CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result }
10151 let err = unsafe { o.contents.err };
10152 unsafe { o.contents.err = core::ptr::null_mut(); }
10153 CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err }
10157 result_ok: o.result_ok,
10161 impl Clone for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10162 fn clone(&self) -> Self {
10163 if self.result_ok {
10164 Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10165 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10168 Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10169 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
10175 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
10176 /// but with all dynamically-allocated buffers duplicated in new buffers.
10177 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) }
10179 /// A tuple of 2 elements. See the individual fields for the types contained.
10180 pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10181 /// The element at position 0
10182 pub a: crate::c_types::ThirtyTwoBytes,
10183 /// The element at position 1
10184 pub b: crate::c_types::ThirtyTwoBytes,
10186 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10187 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
10194 impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10195 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
10199 impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10200 fn clone(&self) -> Self {
10202 a: Clone::clone(&self.a),
10203 b: Clone::clone(&self.b),
10208 /// Creates a new tuple which has the same data as `orig`
10209 /// but with all dynamically-allocated buffers duplicated in new buffers.
10210 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) }
10211 /// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements.
10213 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10214 C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, }
10218 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ.
10219 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { }
10221 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ
10222 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10223 /// A pointer to the contents in the success state.
10224 /// Reading from this pointer when `result_ok` is not set is undefined.
10225 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10226 /// A pointer to the contents in the error state.
10227 /// Reading from this pointer when `result_ok` is set is undefined.
10228 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
10231 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation,
10232 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
10233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10234 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10235 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either
10236 /// `err` or `result` depending on the state of `result_ok`.
10237 pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr,
10238 /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state.
10239 pub result_ok: bool,
10242 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state.
10243 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10244 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10245 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10246 result: Box::into_raw(Box::new(o)),
10252 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state.
10253 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10254 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10255 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10256 err: Box::into_raw(Box::new(e)),
10261 /// Checks if the given object is currently in the success state
10263 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool {
10267 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.
10268 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { }
10269 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10270 fn drop(&mut self) {
10271 if self.result_ok {
10272 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10273 let _ = unsafe { Box::from_raw(self.contents.result) };
10276 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10277 let _ = unsafe { Box::from_raw(self.contents.err) };
10282 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10283 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
10284 let contents = if o.result_ok {
10285 let result = unsafe { o.contents.result };
10286 unsafe { o.contents.result = core::ptr::null_mut() };
10287 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result }
10289 let err = unsafe { o.contents.err };
10290 unsafe { o.contents.err = core::ptr::null_mut(); }
10291 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err }
10295 result_ok: o.result_ok,
10299 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10300 fn clone(&self) -> Self {
10301 if self.result_ok {
10302 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10303 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10306 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10307 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10313 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig`
10314 /// but with all dynamically-allocated buffers duplicated in new buffers.
10315 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) }
10317 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size.
10318 /// This corresponds to std::vector in C++
10319 pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10320 /// The elements in the array.
10321 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10322 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10323 /// The number of elements pointed to by `data`.
10326 impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10327 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ> {
10328 if self.datalen == 0 { return Vec::new(); }
10329 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10330 self.data = core::ptr::null_mut();
10334 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] {
10335 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10338 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10339 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>) -> Self {
10340 let datalen = v.len();
10341 let data = Box::into_raw(v.into_boxed_slice());
10342 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10346 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10347 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { }
10348 impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10349 fn drop(&mut self) {
10350 if self.datalen == 0 { return; }
10351 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10354 impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10355 fn clone(&self) -> Self {
10356 let mut res = Vec::new();
10357 if self.datalen == 0 { return Self::from(res); }
10358 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10363 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ
10364 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10365 /// A pointer to the contents in the success state.
10366 /// Reading from this pointer when `result_ok` is not set is undefined.
10367 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
10368 /// A pointer to the contents in the error state.
10369 /// Reading from this pointer when `result_ok` is set is undefined.
10370 pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure,
10373 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation,
10374 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure.
10375 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10376 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10377 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either
10378 /// `err` or `result` depending on the state of `result_ok`.
10379 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr,
10380 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state.
10381 pub result_ok: bool,
10384 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state.
10385 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10386 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10387 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10388 result: Box::into_raw(Box::new(o)),
10394 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state.
10395 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10396 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10397 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10398 err: Box::into_raw(Box::new(e)),
10403 /// Checks if the given object is currently in the success state
10405 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool {
10409 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.
10410 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { }
10411 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10412 fn drop(&mut self) {
10413 if self.result_ok {
10414 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10415 let _ = unsafe { Box::from_raw(self.contents.result) };
10418 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10419 let _ = unsafe { Box::from_raw(self.contents.err) };
10424 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10425 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>) -> Self {
10426 let contents = if o.result_ok {
10427 let result = unsafe { o.contents.result };
10428 unsafe { o.contents.result = core::ptr::null_mut() };
10429 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result }
10431 let err = unsafe { o.contents.err };
10432 unsafe { o.contents.err = core::ptr::null_mut(); }
10433 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err }
10437 result_ok: o.result_ok,
10441 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10442 fn clone(&self) -> Self {
10443 if self.result_ok {
10444 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10445 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
10448 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10449 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::ProbeSendFailure>::clone(unsafe { &*self.contents.err })))
10455 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig`
10456 /// but with all dynamically-allocated buffers duplicated in new buffers.
10457 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) }
10459 /// A tuple of 2 elements. See the individual fields for the types contained.
10460 pub struct C2Tuple_ChannelIdPublicKeyZ {
10461 /// The element at position 0
10462 pub a: crate::lightning::ln::types::ChannelId,
10463 /// The element at position 1
10464 pub b: crate::c_types::PublicKey,
10466 impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)> for C2Tuple_ChannelIdPublicKeyZ {
10467 fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)) -> Self {
10474 impl C2Tuple_ChannelIdPublicKeyZ {
10475 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey) {
10479 impl Clone for C2Tuple_ChannelIdPublicKeyZ {
10480 fn clone(&self) -> Self {
10482 a: Clone::clone(&self.a),
10483 b: Clone::clone(&self.b),
10488 /// Creates a new tuple which has the same data as `orig`
10489 /// but with all dynamically-allocated buffers duplicated in new buffers.
10490 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_clone(orig: &C2Tuple_ChannelIdPublicKeyZ) -> C2Tuple_ChannelIdPublicKeyZ { Clone::clone(&orig) }
10491 /// Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements.
10493 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::PublicKey) -> C2Tuple_ChannelIdPublicKeyZ {
10494 C2Tuple_ChannelIdPublicKeyZ { a, b, }
10498 /// Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ.
10499 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_free(_res: C2Tuple_ChannelIdPublicKeyZ) { }
10501 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size.
10502 /// This corresponds to std::vector in C++
10503 pub struct CVec_C2Tuple_ChannelIdPublicKeyZZ {
10504 /// The elements in the array.
10505 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10506 pub data: *mut crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ,
10507 /// The number of elements pointed to by `data`.
10510 impl CVec_C2Tuple_ChannelIdPublicKeyZZ {
10511 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ> {
10512 if self.datalen == 0 { return Vec::new(); }
10513 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10514 self.data = core::ptr::null_mut();
10518 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ] {
10519 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10522 impl From<Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>> for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10523 fn from(v: Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>) -> Self {
10524 let datalen = v.len();
10525 let data = Box::into_raw(v.into_boxed_slice());
10526 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10530 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10531 pub extern "C" fn CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res: CVec_C2Tuple_ChannelIdPublicKeyZZ) { }
10532 impl Drop for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10533 fn drop(&mut self) {
10534 if self.datalen == 0 { return; }
10535 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10538 impl Clone for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10539 fn clone(&self) -> Self {
10540 let mut res = Vec::new();
10541 if self.datalen == 0 { return Self::from(res); }
10542 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10547 /// A dynamically-allocated array of crate::lightning::ln::types::ChannelIds of arbitrary size.
10548 /// This corresponds to std::vector in C++
10549 pub struct CVec_ChannelIdZ {
10550 /// The elements in the array.
10551 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10552 pub data: *mut crate::lightning::ln::types::ChannelId,
10553 /// The number of elements pointed to by `data`.
10556 impl CVec_ChannelIdZ {
10557 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::types::ChannelId> {
10558 if self.datalen == 0 { return Vec::new(); }
10559 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10560 self.data = core::ptr::null_mut();
10564 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::types::ChannelId] {
10565 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10568 impl From<Vec<crate::lightning::ln::types::ChannelId>> for CVec_ChannelIdZ {
10569 fn from(v: Vec<crate::lightning::ln::types::ChannelId>) -> Self {
10570 let datalen = v.len();
10571 let data = Box::into_raw(v.into_boxed_slice());
10572 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10576 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10577 pub extern "C" fn CVec_ChannelIdZ_free(_res: CVec_ChannelIdZ) { }
10578 impl Drop for CVec_ChannelIdZ {
10579 fn drop(&mut self) {
10580 if self.datalen == 0 { return; }
10581 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10584 impl Clone for CVec_ChannelIdZ {
10585 fn clone(&self) -> Self {
10586 let mut res = Vec::new();
10587 if self.datalen == 0 { return Self::from(res); }
10588 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10593 /// The contents of CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ
10594 pub union CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10595 /// A pointer to the contents in the success state.
10596 /// Reading from this pointer when `result_ok` is not set is undefined.
10597 pub result: *mut crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder,
10598 /// A pointer to the contents in the error state.
10599 /// Reading from this pointer when `result_ok` is set is undefined.
10600 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
10603 /// A CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
10604 /// containing a crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
10605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10606 pub struct CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10607 /// The contents of this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either
10608 /// `err` or `result` depending on the state of `result_ok`.
10609 pub contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr,
10610 /// Whether this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state.
10611 pub result_ok: bool,
10614 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state.
10615 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10616 CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10617 contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10618 result: Box::into_raw(Box::new(o)),
10624 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state.
10625 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10626 CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10627 contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10628 err: Box::into_raw(Box::new(e)),
10633 /// Checks if the given object is currently in the success state
10635 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> bool {
10639 /// Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ.
10640 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) { }
10641 impl Drop for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10642 fn drop(&mut self) {
10643 if self.result_ok {
10644 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10645 let _ = unsafe { Box::from_raw(self.contents.result) };
10648 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10649 let _ = unsafe { Box::from_raw(self.contents.err) };
10654 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10655 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
10656 let contents = if o.result_ok {
10657 let result = unsafe { o.contents.result };
10658 unsafe { o.contents.result = core::ptr::null_mut() };
10659 CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { result }
10661 let err = unsafe { o.contents.err };
10662 unsafe { o.contents.err = core::ptr::null_mut(); }
10663 CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { err }
10667 result_ok: o.result_ok,
10671 impl Clone for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10672 fn clone(&self) -> Self {
10673 if self.result_ok {
10674 Self { result_ok: true, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10675 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder>::clone(unsafe { &*self.contents.result })))
10678 Self { result_ok: false, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10679 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
10685 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig`
10686 /// but with all dynamically-allocated buffers duplicated in new buffers.
10687 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { Clone::clone(&orig) }
10690 /// An enum which can either contain a crate::c_types::Str or not
10691 pub enum COption_StrZ {
10692 /// When we're in this state, this COption_StrZ contains a crate::c_types::Str
10693 Some(crate::c_types::Str),
10694 /// When we're in this state, this COption_StrZ contains nothing
10697 impl COption_StrZ {
10698 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10699 if let Self::None = self { false } else { true }
10701 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10704 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Str {
10705 if let Self::Some(v) = self { v } else { unreachable!() }
10709 /// Constructs a new COption_StrZ containing a crate::c_types::Str
10710 pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ {
10711 COption_StrZ::Some(o)
10714 /// Constructs a new COption_StrZ containing nothing
10715 pub extern "C" fn COption_StrZ_none() -> COption_StrZ {
10719 /// Frees any resources associated with the crate::c_types::Str, if we are in the Some state
10720 pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { }
10722 /// Creates a new COption_StrZ which has the same data as `orig`
10723 /// but with all dynamically-allocated buffers duplicated in new buffers.
10724 pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) }
10726 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
10727 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10728 /// A pointer to the contents in the success state.
10729 /// Reading from this pointer when `result_ok` is not set is undefined.
10730 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10731 /// Note that this value is always NULL, as there are no contents in the Err variant
10732 pub err: *mut core::ffi::c_void,
10735 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
10736 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
10737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10738 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10739 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
10740 /// `err` or `result` depending on the state of `result_ok`.
10741 pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
10742 /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
10743 pub result_ok: bool,
10746 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
10747 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10748 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10749 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10750 result: Box::into_raw(Box::new(o)),
10756 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
10757 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10758 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10759 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10760 err: core::ptr::null_mut(),
10765 /// Checks if the given object is currently in the success state
10767 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
10771 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
10772 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
10773 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10774 fn drop(&mut self) {
10775 if self.result_ok {
10776 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10777 let _ = unsafe { Box::from_raw(self.contents.result) };
10783 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10784 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
10785 let contents = if o.result_ok {
10786 let result = unsafe { o.contents.result };
10787 unsafe { o.contents.result = core::ptr::null_mut() };
10788 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
10790 let _ = unsafe { Box::from_raw(o.contents.err) };
10791 o.contents.err = core::ptr::null_mut();
10792 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
10796 result_ok: o.result_ok,
10800 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10801 fn clone(&self) -> Self {
10802 if self.result_ok {
10803 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10804 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10807 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10808 err: core::ptr::null_mut()
10814 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
10815 /// but with all dynamically-allocated buffers duplicated in new buffers.
10816 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
10818 /// The contents of CResult_ThirtyTwoBytesAPIErrorZ
10819 pub union CResult_ThirtyTwoBytesAPIErrorZPtr {
10820 /// A pointer to the contents in the success state.
10821 /// Reading from this pointer when `result_ok` is not set is undefined.
10822 pub result: *mut crate::c_types::ThirtyTwoBytes,
10823 /// A pointer to the contents in the error state.
10824 /// Reading from this pointer when `result_ok` is set is undefined.
10825 pub err: *mut crate::lightning::util::errors::APIError,
10828 /// A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation,
10829 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
10830 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10831 pub struct CResult_ThirtyTwoBytesAPIErrorZ {
10832 /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either
10833 /// `err` or `result` depending on the state of `result_ok`.
10834 pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr,
10835 /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state.
10836 pub result_ok: bool,
10839 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state.
10840 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesAPIErrorZ {
10841 CResult_ThirtyTwoBytesAPIErrorZ {
10842 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10843 result: Box::into_raw(Box::new(o)),
10849 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state.
10850 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ThirtyTwoBytesAPIErrorZ {
10851 CResult_ThirtyTwoBytesAPIErrorZ {
10852 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10853 err: Box::into_raw(Box::new(e)),
10858 /// Checks if the given object is currently in the success state
10860 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool {
10864 /// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ.
10865 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { }
10866 impl Drop for CResult_ThirtyTwoBytesAPIErrorZ {
10867 fn drop(&mut self) {
10868 if self.result_ok {
10869 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10870 let _ = unsafe { Box::from_raw(self.contents.result) };
10873 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10874 let _ = unsafe { Box::from_raw(self.contents.err) };
10879 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_ThirtyTwoBytesAPIErrorZ {
10880 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
10881 let contents = if o.result_ok {
10882 let result = unsafe { o.contents.result };
10883 unsafe { o.contents.result = core::ptr::null_mut() };
10884 CResult_ThirtyTwoBytesAPIErrorZPtr { result }
10886 let err = unsafe { o.contents.err };
10887 unsafe { o.contents.err = core::ptr::null_mut(); }
10888 CResult_ThirtyTwoBytesAPIErrorZPtr { err }
10892 result_ok: o.result_ok,
10896 impl Clone for CResult_ThirtyTwoBytesAPIErrorZ {
10897 fn clone(&self) -> Self {
10898 if self.result_ok {
10899 Self { result_ok: true, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10900 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10903 Self { result_ok: false, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10904 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
10910 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig`
10911 /// but with all dynamically-allocated buffers duplicated in new buffers.
10912 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) }
10915 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
10916 pub enum COption_OffersMessageZ {
10917 /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
10918 Some(crate::lightning::onion_message::offers::OffersMessage),
10919 /// When we're in this state, this COption_OffersMessageZ contains nothing
10922 impl COption_OffersMessageZ {
10923 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10924 if let Self::None = self { false } else { true }
10926 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10929 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
10930 if let Self::Some(v) = self { v } else { unreachable!() }
10934 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
10935 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
10936 COption_OffersMessageZ::Some(o)
10939 /// Constructs a new COption_OffersMessageZ containing nothing
10940 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
10941 COption_OffersMessageZ::None
10944 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
10945 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
10947 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
10948 /// but with all dynamically-allocated buffers duplicated in new buffers.
10949 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
10951 /// A tuple of 3 elements. See the individual fields for the types contained.
10952 pub struct C3Tuple_OffersMessageDestinationBlindedPathZ {
10953 /// The element at position 0
10954 pub a: crate::lightning::onion_message::offers::OffersMessage,
10955 /// The element at position 1
10956 pub b: crate::lightning::onion_message::messenger::Destination,
10957 /// The element at position 2
10958 pub c: crate::lightning::blinded_path::BlindedPath,
10960 impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OffersMessageDestinationBlindedPathZ {
10961 fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
10969 impl C3Tuple_OffersMessageDestinationBlindedPathZ {
10970 #[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) {
10971 (self.a, self.b, self.c)
10974 impl Clone for C3Tuple_OffersMessageDestinationBlindedPathZ {
10975 fn clone(&self) -> Self {
10977 a: Clone::clone(&self.a),
10978 b: Clone::clone(&self.b),
10979 c: Clone::clone(&self.c),
10984 /// Creates a new tuple which has the same data as `orig`
10985 /// but with all dynamically-allocated buffers duplicated in new buffers.
10986 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig: &C3Tuple_OffersMessageDestinationBlindedPathZ) -> C3Tuple_OffersMessageDestinationBlindedPathZ { Clone::clone(&orig) }
10987 /// Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
10989 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 {
10990 C3Tuple_OffersMessageDestinationBlindedPathZ { a, b, c, }
10994 /// Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
10995 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res: C3Tuple_OffersMessageDestinationBlindedPathZ) { }
10997 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
10998 /// This corresponds to std::vector in C++
10999 pub struct CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11000 /// The elements in the array.
11001 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11002 pub data: *mut crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ,
11003 /// The number of elements pointed to by `data`.
11006 impl CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11007 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ> {
11008 if self.datalen == 0 { return Vec::new(); }
11009 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11010 self.data = core::ptr::null_mut();
11014 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ] {
11015 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11018 impl From<Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>> for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11019 fn from(v: Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>) -> Self {
11020 let datalen = v.len();
11021 let data = Box::into_raw(v.into_boxed_slice());
11022 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11026 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11027 pub extern "C" fn CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ) { }
11028 impl Drop for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11029 fn drop(&mut self) {
11030 if self.datalen == 0 { return; }
11031 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11034 impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11035 fn clone(&self) -> Self {
11036 let mut res = Vec::new();
11037 if self.datalen == 0 { return Self::from(res); }
11038 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11043 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
11044 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
11045 /// A pointer to the contents in the success state.
11046 /// Reading from this pointer when `result_ok` is not set is undefined.
11047 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
11048 /// A pointer to the contents in the error state.
11049 /// Reading from this pointer when `result_ok` is set is undefined.
11050 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11053 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
11054 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
11055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11056 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
11057 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
11058 /// `err` or `result` depending on the state of `result_ok`.
11059 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
11060 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
11061 pub result_ok: bool,
11064 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
11065 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
11066 CResult_PhantomRouteHintsDecodeErrorZ {
11067 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11068 result: Box::into_raw(Box::new(o)),
11074 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
11075 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
11076 CResult_PhantomRouteHintsDecodeErrorZ {
11077 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11078 err: Box::into_raw(Box::new(e)),
11083 /// Checks if the given object is currently in the success state
11085 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
11089 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
11090 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
11091 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
11092 fn drop(&mut self) {
11093 if self.result_ok {
11094 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11095 let _ = unsafe { Box::from_raw(self.contents.result) };
11098 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11099 let _ = unsafe { Box::from_raw(self.contents.err) };
11104 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
11105 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
11106 let contents = if o.result_ok {
11107 let result = unsafe { o.contents.result };
11108 unsafe { o.contents.result = core::ptr::null_mut() };
11109 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
11111 let err = unsafe { o.contents.err };
11112 unsafe { o.contents.err = core::ptr::null_mut(); }
11113 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
11117 result_ok: o.result_ok,
11121 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
11122 fn clone(&self) -> Self {
11123 if self.result_ok {
11124 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11125 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
11128 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11129 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11135 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
11136 /// but with all dynamically-allocated buffers duplicated in new buffers.
11137 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
11139 /// The contents of CResult_BlindedForwardDecodeErrorZ
11140 pub union CResult_BlindedForwardDecodeErrorZPtr {
11141 /// A pointer to the contents in the success state.
11142 /// Reading from this pointer when `result_ok` is not set is undefined.
11143 pub result: *mut crate::lightning::ln::channelmanager::BlindedForward,
11144 /// A pointer to the contents in the error state.
11145 /// Reading from this pointer when `result_ok` is set is undefined.
11146 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11149 /// A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation,
11150 /// containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure.
11151 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11152 pub struct CResult_BlindedForwardDecodeErrorZ {
11153 /// The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either
11154 /// `err` or `result` depending on the state of `result_ok`.
11155 pub contents: CResult_BlindedForwardDecodeErrorZPtr,
11156 /// Whether this CResult_BlindedForwardDecodeErrorZ represents a success state.
11157 pub result_ok: bool,
11160 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the success state.
11161 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ {
11162 CResult_BlindedForwardDecodeErrorZ {
11163 contents: CResult_BlindedForwardDecodeErrorZPtr {
11164 result: Box::into_raw(Box::new(o)),
11170 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the error state.
11171 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ {
11172 CResult_BlindedForwardDecodeErrorZ {
11173 contents: CResult_BlindedForwardDecodeErrorZPtr {
11174 err: Box::into_raw(Box::new(e)),
11179 /// Checks if the given object is currently in the success state
11181 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> bool {
11185 /// Frees any resources used by the CResult_BlindedForwardDecodeErrorZ.
11186 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { }
11187 impl Drop for CResult_BlindedForwardDecodeErrorZ {
11188 fn drop(&mut self) {
11189 if self.result_ok {
11190 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11191 let _ = unsafe { Box::from_raw(self.contents.result) };
11194 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11195 let _ = unsafe { Box::from_raw(self.contents.err) };
11200 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedForwardDecodeErrorZ {
11201 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>) -> Self {
11202 let contents = if o.result_ok {
11203 let result = unsafe { o.contents.result };
11204 unsafe { o.contents.result = core::ptr::null_mut() };
11205 CResult_BlindedForwardDecodeErrorZPtr { result }
11207 let err = unsafe { o.contents.err };
11208 unsafe { o.contents.err = core::ptr::null_mut(); }
11209 CResult_BlindedForwardDecodeErrorZPtr { err }
11213 result_ok: o.result_ok,
11217 impl Clone for CResult_BlindedForwardDecodeErrorZ {
11218 fn clone(&self) -> Self {
11219 if self.result_ok {
11220 Self { result_ok: true, contents: CResult_BlindedForwardDecodeErrorZPtr {
11221 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedForward>::clone(unsafe { &*self.contents.result })))
11224 Self { result_ok: false, contents: CResult_BlindedForwardDecodeErrorZPtr {
11225 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11231 /// Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig`
11232 /// but with all dynamically-allocated buffers duplicated in new buffers.
11233 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) }
11235 /// The contents of CResult_PendingHTLCRoutingDecodeErrorZ
11236 pub union CResult_PendingHTLCRoutingDecodeErrorZPtr {
11237 /// A pointer to the contents in the success state.
11238 /// Reading from this pointer when `result_ok` is not set is undefined.
11239 pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCRouting,
11240 /// A pointer to the contents in the error state.
11241 /// Reading from this pointer when `result_ok` is set is undefined.
11242 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11245 /// A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation,
11246 /// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure.
11247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11248 pub struct CResult_PendingHTLCRoutingDecodeErrorZ {
11249 /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either
11250 /// `err` or `result` depending on the state of `result_ok`.
11251 pub contents: CResult_PendingHTLCRoutingDecodeErrorZPtr,
11252 /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state.
11253 pub result_ok: bool,
11256 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state.
11257 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11258 CResult_PendingHTLCRoutingDecodeErrorZ {
11259 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11260 result: Box::into_raw(Box::new(o)),
11266 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state.
11267 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11268 CResult_PendingHTLCRoutingDecodeErrorZ {
11269 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11270 err: Box::into_raw(Box::new(e)),
11275 /// Checks if the given object is currently in the success state
11277 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> bool {
11281 /// Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ.
11282 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { }
11283 impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ {
11284 fn drop(&mut self) {
11285 if self.result_ok {
11286 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11287 let _ = unsafe { Box::from_raw(self.contents.result) };
11290 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11291 let _ = unsafe { Box::from_raw(self.contents.err) };
11296 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCRoutingDecodeErrorZ {
11297 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>) -> Self {
11298 let contents = if o.result_ok {
11299 let result = unsafe { o.contents.result };
11300 unsafe { o.contents.result = core::ptr::null_mut() };
11301 CResult_PendingHTLCRoutingDecodeErrorZPtr { result }
11303 let err = unsafe { o.contents.err };
11304 unsafe { o.contents.err = core::ptr::null_mut(); }
11305 CResult_PendingHTLCRoutingDecodeErrorZPtr { err }
11309 result_ok: o.result_ok,
11313 impl Clone for CResult_PendingHTLCRoutingDecodeErrorZ {
11314 fn clone(&self) -> Self {
11315 if self.result_ok {
11316 Self { result_ok: true, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11317 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCRouting>::clone(unsafe { &*self.contents.result })))
11320 Self { result_ok: false, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11321 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11327 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig`
11328 /// but with all dynamically-allocated buffers duplicated in new buffers.
11329 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) }
11331 /// The contents of CResult_PendingHTLCInfoDecodeErrorZ
11332 pub union CResult_PendingHTLCInfoDecodeErrorZPtr {
11333 /// A pointer to the contents in the success state.
11334 /// Reading from this pointer when `result_ok` is not set is undefined.
11335 pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
11336 /// A pointer to the contents in the error state.
11337 /// Reading from this pointer when `result_ok` is set is undefined.
11338 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11341 /// A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation,
11342 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11344 pub struct CResult_PendingHTLCInfoDecodeErrorZ {
11345 /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either
11346 /// `err` or `result` depending on the state of `result_ok`.
11347 pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr,
11348 /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state.
11349 pub result_ok: bool,
11352 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state.
11353 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ {
11354 CResult_PendingHTLCInfoDecodeErrorZ {
11355 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11356 result: Box::into_raw(Box::new(o)),
11362 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state.
11363 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ {
11364 CResult_PendingHTLCInfoDecodeErrorZ {
11365 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11366 err: Box::into_raw(Box::new(e)),
11371 /// Checks if the given object is currently in the success state
11373 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool {
11377 /// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ.
11378 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { }
11379 impl Drop for CResult_PendingHTLCInfoDecodeErrorZ {
11380 fn drop(&mut self) {
11381 if self.result_ok {
11382 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11383 let _ = unsafe { Box::from_raw(self.contents.result) };
11386 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11387 let _ = unsafe { Box::from_raw(self.contents.err) };
11392 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCInfoDecodeErrorZ {
11393 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11394 let contents = if o.result_ok {
11395 let result = unsafe { o.contents.result };
11396 unsafe { o.contents.result = core::ptr::null_mut() };
11397 CResult_PendingHTLCInfoDecodeErrorZPtr { result }
11399 let err = unsafe { o.contents.err };
11400 unsafe { o.contents.err = core::ptr::null_mut(); }
11401 CResult_PendingHTLCInfoDecodeErrorZPtr { err }
11405 result_ok: o.result_ok,
11409 impl Clone for CResult_PendingHTLCInfoDecodeErrorZ {
11410 fn clone(&self) -> Self {
11411 if self.result_ok {
11412 Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11413 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCInfo>::clone(unsafe { &*self.contents.result })))
11416 Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11417 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11423 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig`
11424 /// but with all dynamically-allocated buffers duplicated in new buffers.
11425 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) }
11427 /// The contents of CResult_BlindedFailureDecodeErrorZ
11428 pub union CResult_BlindedFailureDecodeErrorZPtr {
11429 /// A pointer to the contents in the success state.
11430 /// Reading from this pointer when `result_ok` is not set is undefined.
11431 pub result: *mut crate::lightning::ln::channelmanager::BlindedFailure,
11432 /// A pointer to the contents in the error state.
11433 /// Reading from this pointer when `result_ok` is set is undefined.
11434 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11437 /// A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation,
11438 /// containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure.
11439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11440 pub struct CResult_BlindedFailureDecodeErrorZ {
11441 /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either
11442 /// `err` or `result` depending on the state of `result_ok`.
11443 pub contents: CResult_BlindedFailureDecodeErrorZPtr,
11444 /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state.
11445 pub result_ok: bool,
11448 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state.
11449 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ {
11450 CResult_BlindedFailureDecodeErrorZ {
11451 contents: CResult_BlindedFailureDecodeErrorZPtr {
11452 result: Box::into_raw(Box::new(o)),
11458 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state.
11459 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ {
11460 CResult_BlindedFailureDecodeErrorZ {
11461 contents: CResult_BlindedFailureDecodeErrorZPtr {
11462 err: Box::into_raw(Box::new(e)),
11467 /// Checks if the given object is currently in the success state
11469 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool {
11473 /// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ.
11474 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { }
11475 impl Drop for CResult_BlindedFailureDecodeErrorZ {
11476 fn drop(&mut self) {
11477 if self.result_ok {
11478 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11479 let _ = unsafe { Box::from_raw(self.contents.result) };
11482 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11483 let _ = unsafe { Box::from_raw(self.contents.err) };
11488 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedFailureDecodeErrorZ {
11489 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>) -> Self {
11490 let contents = if o.result_ok {
11491 let result = unsafe { o.contents.result };
11492 unsafe { o.contents.result = core::ptr::null_mut() };
11493 CResult_BlindedFailureDecodeErrorZPtr { result }
11495 let err = unsafe { o.contents.err };
11496 unsafe { o.contents.err = core::ptr::null_mut(); }
11497 CResult_BlindedFailureDecodeErrorZPtr { err }
11501 result_ok: o.result_ok,
11505 impl Clone for CResult_BlindedFailureDecodeErrorZ {
11506 fn clone(&self) -> Self {
11507 if self.result_ok {
11508 Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr {
11509 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedFailure>::clone(unsafe { &*self.contents.result })))
11512 Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr {
11513 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11519 /// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig`
11520 /// but with all dynamically-allocated buffers duplicated in new buffers.
11521 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) }
11523 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
11524 /// This corresponds to std::vector in C++
11525 pub struct CVec_ChannelMonitorZ {
11526 /// The elements in the array.
11527 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11528 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
11529 /// The number of elements pointed to by `data`.
11532 impl CVec_ChannelMonitorZ {
11533 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
11534 if self.datalen == 0 { return Vec::new(); }
11535 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11536 self.data = core::ptr::null_mut();
11540 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
11541 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11544 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
11545 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
11546 let datalen = v.len();
11547 let data = Box::into_raw(v.into_boxed_slice());
11548 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11552 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11553 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
11554 impl Drop for CVec_ChannelMonitorZ {
11555 fn drop(&mut self) {
11556 if self.datalen == 0 { return; }
11557 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11560 impl Clone for CVec_ChannelMonitorZ {
11561 fn clone(&self) -> Self {
11562 let mut res = Vec::new();
11563 if self.datalen == 0 { return Self::from(res); }
11564 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11569 /// A tuple of 2 elements. See the individual fields for the types contained.
11570 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
11571 /// The element at position 0
11572 pub a: crate::c_types::ThirtyTwoBytes,
11573 /// The element at position 1
11574 pub b: crate::lightning::ln::channelmanager::ChannelManager,
11576 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
11577 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
11584 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
11585 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
11589 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
11591 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
11592 C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
11596 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
11597 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
11599 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
11600 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11601 /// A pointer to the contents in the success state.
11602 /// Reading from this pointer when `result_ok` is not set is undefined.
11603 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
11604 /// A pointer to the contents in the error state.
11605 /// Reading from this pointer when `result_ok` is set is undefined.
11606 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11609 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
11610 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11611 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11612 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11613 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
11614 /// `err` or `result` depending on the state of `result_ok`.
11615 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
11616 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
11617 pub result_ok: bool,
11620 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
11621 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11622 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11623 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11624 result: Box::into_raw(Box::new(o)),
11630 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
11631 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11632 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11633 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11634 err: Box::into_raw(Box::new(e)),
11639 /// Checks if the given object is currently in the success state
11641 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
11645 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
11646 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
11647 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11648 fn drop(&mut self) {
11649 if self.result_ok {
11650 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11651 let _ = unsafe { Box::from_raw(self.contents.result) };
11654 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11655 let _ = unsafe { Box::from_raw(self.contents.err) };
11660 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11661 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11662 let contents = if o.result_ok {
11663 let result = unsafe { o.contents.result };
11664 unsafe { o.contents.result = core::ptr::null_mut() };
11665 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
11667 let err = unsafe { o.contents.err };
11668 unsafe { o.contents.err = core::ptr::null_mut(); }
11669 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
11673 result_ok: o.result_ok,
11678 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
11679 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11680 /// A pointer to the contents in the success state.
11681 /// Reading from this pointer when `result_ok` is not set is undefined.
11682 pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
11683 /// A pointer to the contents in the error state.
11684 /// Reading from this pointer when `result_ok` is set is undefined.
11685 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11688 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
11689 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
11690 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11691 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
11692 /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
11693 /// `err` or `result` depending on the state of `result_ok`.
11694 pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
11695 /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
11696 pub result_ok: bool,
11699 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
11700 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
11701 CResult_MaxDustHTLCExposureDecodeErrorZ {
11702 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11703 result: Box::into_raw(Box::new(o)),
11709 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
11710 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
11711 CResult_MaxDustHTLCExposureDecodeErrorZ {
11712 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11713 err: Box::into_raw(Box::new(e)),
11718 /// Checks if the given object is currently in the success state
11720 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
11724 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
11725 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
11726 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
11727 fn drop(&mut self) {
11728 if self.result_ok {
11729 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11730 let _ = unsafe { Box::from_raw(self.contents.result) };
11733 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11734 let _ = unsafe { Box::from_raw(self.contents.err) };
11739 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
11740 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
11741 let contents = if o.result_ok {
11742 let result = unsafe { o.contents.result };
11743 unsafe { o.contents.result = core::ptr::null_mut() };
11744 CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
11746 let err = unsafe { o.contents.err };
11747 unsafe { o.contents.err = core::ptr::null_mut(); }
11748 CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
11752 result_ok: o.result_ok,
11756 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
11757 fn clone(&self) -> Self {
11758 if self.result_ok {
11759 Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11760 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
11763 Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11764 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11770 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
11771 /// but with all dynamically-allocated buffers duplicated in new buffers.
11772 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
11774 /// The contents of CResult_ChannelConfigDecodeErrorZ
11775 pub union CResult_ChannelConfigDecodeErrorZPtr {
11776 /// A pointer to the contents in the success state.
11777 /// Reading from this pointer when `result_ok` is not set is undefined.
11778 pub result: *mut crate::lightning::util::config::ChannelConfig,
11779 /// A pointer to the contents in the error state.
11780 /// Reading from this pointer when `result_ok` is set is undefined.
11781 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11784 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
11785 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
11786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11787 pub struct CResult_ChannelConfigDecodeErrorZ {
11788 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
11789 /// `err` or `result` depending on the state of `result_ok`.
11790 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
11791 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
11792 pub result_ok: bool,
11795 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
11796 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
11797 CResult_ChannelConfigDecodeErrorZ {
11798 contents: CResult_ChannelConfigDecodeErrorZPtr {
11799 result: Box::into_raw(Box::new(o)),
11805 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
11806 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
11807 CResult_ChannelConfigDecodeErrorZ {
11808 contents: CResult_ChannelConfigDecodeErrorZPtr {
11809 err: Box::into_raw(Box::new(e)),
11814 /// Checks if the given object is currently in the success state
11816 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
11820 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
11821 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
11822 impl Drop for CResult_ChannelConfigDecodeErrorZ {
11823 fn drop(&mut self) {
11824 if self.result_ok {
11825 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11826 let _ = unsafe { Box::from_raw(self.contents.result) };
11829 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11830 let _ = unsafe { Box::from_raw(self.contents.err) };
11835 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
11836 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
11837 let contents = if o.result_ok {
11838 let result = unsafe { o.contents.result };
11839 unsafe { o.contents.result = core::ptr::null_mut() };
11840 CResult_ChannelConfigDecodeErrorZPtr { result }
11842 let err = unsafe { o.contents.err };
11843 unsafe { o.contents.err = core::ptr::null_mut(); }
11844 CResult_ChannelConfigDecodeErrorZPtr { err }
11848 result_ok: o.result_ok,
11852 impl Clone for CResult_ChannelConfigDecodeErrorZ {
11853 fn clone(&self) -> Self {
11854 if self.result_ok {
11855 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
11856 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
11859 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
11860 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11866 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
11867 /// but with all dynamically-allocated buffers duplicated in new buffers.
11868 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
11871 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
11872 pub enum COption_MaxDustHTLCExposureZ {
11873 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
11874 Some(crate::lightning::util::config::MaxDustHTLCExposure),
11875 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
11878 impl COption_MaxDustHTLCExposureZ {
11879 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11880 if let Self::None = self { false } else { true }
11882 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11885 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
11886 if let Self::Some(v) = self { v } else { unreachable!() }
11890 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
11891 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
11892 COption_MaxDustHTLCExposureZ::Some(o)
11895 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
11896 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
11897 COption_MaxDustHTLCExposureZ::None
11900 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
11901 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
11903 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
11904 /// but with all dynamically-allocated buffers duplicated in new buffers.
11905 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
11908 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
11909 pub enum COption_APIErrorZ {
11910 /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
11911 Some(crate::lightning::util::errors::APIError),
11912 /// When we're in this state, this COption_APIErrorZ contains nothing
11915 impl COption_APIErrorZ {
11916 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11917 if let Self::None = self { false } else { true }
11919 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11922 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
11923 if let Self::Some(v) = self { v } else { unreachable!() }
11927 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
11928 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
11929 COption_APIErrorZ::Some(o)
11932 /// Constructs a new COption_APIErrorZ containing nothing
11933 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
11934 COption_APIErrorZ::None
11937 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
11938 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
11940 /// Creates a new COption_APIErrorZ which has the same data as `orig`
11941 /// but with all dynamically-allocated buffers duplicated in new buffers.
11942 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
11944 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
11945 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
11946 /// A pointer to the contents in the success state.
11947 /// Reading from this pointer when `result_ok` is not set is undefined.
11948 pub result: *mut crate::c_types::derived::COption_APIErrorZ,
11949 /// A pointer to the contents in the error state.
11950 /// Reading from this pointer when `result_ok` is set is undefined.
11951 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11954 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
11955 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11956 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11957 pub struct CResult_COption_APIErrorZDecodeErrorZ {
11958 /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
11959 /// `err` or `result` depending on the state of `result_ok`.
11960 pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
11961 /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
11962 pub result_ok: bool,
11965 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
11966 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
11967 CResult_COption_APIErrorZDecodeErrorZ {
11968 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11969 result: Box::into_raw(Box::new(o)),
11975 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
11976 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
11977 CResult_COption_APIErrorZDecodeErrorZ {
11978 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11979 err: Box::into_raw(Box::new(e)),
11984 /// Checks if the given object is currently in the success state
11986 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
11990 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
11991 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
11992 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
11993 fn drop(&mut self) {
11994 if self.result_ok {
11995 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11996 let _ = unsafe { Box::from_raw(self.contents.result) };
11999 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12000 let _ = unsafe { Box::from_raw(self.contents.err) };
12005 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
12006 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12007 let contents = if o.result_ok {
12008 let result = unsafe { o.contents.result };
12009 unsafe { o.contents.result = core::ptr::null_mut() };
12010 CResult_COption_APIErrorZDecodeErrorZPtr { result }
12012 let err = unsafe { o.contents.err };
12013 unsafe { o.contents.err = core::ptr::null_mut(); }
12014 CResult_COption_APIErrorZDecodeErrorZPtr { err }
12018 result_ok: o.result_ok,
12022 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
12023 fn clone(&self) -> Self {
12024 if self.result_ok {
12025 Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12026 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
12029 Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12030 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12036 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
12037 /// but with all dynamically-allocated buffers duplicated in new buffers.
12038 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
12040 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
12041 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12042 /// A pointer to the contents in the success state.
12043 /// Reading from this pointer when `result_ok` is not set is undefined.
12044 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
12045 /// A pointer to the contents in the error state.
12046 /// Reading from this pointer when `result_ok` is set is undefined.
12047 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12050 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
12051 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12053 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
12054 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
12055 /// `err` or `result` depending on the state of `result_ok`.
12056 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
12057 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
12058 pub result_ok: bool,
12061 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
12062 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12063 CResult_ChannelMonitorUpdateDecodeErrorZ {
12064 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12065 result: Box::into_raw(Box::new(o)),
12071 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
12072 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12073 CResult_ChannelMonitorUpdateDecodeErrorZ {
12074 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12075 err: Box::into_raw(Box::new(e)),
12080 /// Checks if the given object is currently in the success state
12082 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
12086 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
12087 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
12088 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
12089 fn drop(&mut self) {
12090 if self.result_ok {
12091 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12092 let _ = unsafe { Box::from_raw(self.contents.result) };
12095 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12096 let _ = unsafe { Box::from_raw(self.contents.err) };
12101 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
12102 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12103 let contents = if o.result_ok {
12104 let result = unsafe { o.contents.result };
12105 unsafe { o.contents.result = core::ptr::null_mut() };
12106 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
12108 let err = unsafe { o.contents.err };
12109 unsafe { o.contents.err = core::ptr::null_mut(); }
12110 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
12114 result_ok: o.result_ok,
12118 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
12119 fn clone(&self) -> Self {
12120 if self.result_ok {
12121 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12122 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
12125 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12126 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12132 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
12133 /// but with all dynamically-allocated buffers duplicated in new buffers.
12134 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
12137 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
12138 pub enum COption_MonitorEventZ {
12139 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
12140 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
12141 /// When we're in this state, this COption_MonitorEventZ contains nothing
12144 impl COption_MonitorEventZ {
12145 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12146 if let Self::None = self { false } else { true }
12148 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12151 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
12152 if let Self::Some(v) = self { v } else { unreachable!() }
12156 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
12157 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
12158 COption_MonitorEventZ::Some(o)
12161 /// Constructs a new COption_MonitorEventZ containing nothing
12162 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
12163 COption_MonitorEventZ::None
12166 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
12167 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
12169 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
12170 /// but with all dynamically-allocated buffers duplicated in new buffers.
12171 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
12173 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
12174 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
12175 /// A pointer to the contents in the success state.
12176 /// Reading from this pointer when `result_ok` is not set is undefined.
12177 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
12178 /// A pointer to the contents in the error state.
12179 /// Reading from this pointer when `result_ok` is set is undefined.
12180 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12183 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
12184 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12186 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
12187 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
12188 /// `err` or `result` depending on the state of `result_ok`.
12189 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
12190 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
12191 pub result_ok: bool,
12194 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
12195 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
12196 CResult_COption_MonitorEventZDecodeErrorZ {
12197 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12198 result: Box::into_raw(Box::new(o)),
12204 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
12205 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
12206 CResult_COption_MonitorEventZDecodeErrorZ {
12207 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12208 err: Box::into_raw(Box::new(e)),
12213 /// Checks if the given object is currently in the success state
12215 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
12219 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
12220 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
12221 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
12222 fn drop(&mut self) {
12223 if self.result_ok {
12224 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12225 let _ = unsafe { Box::from_raw(self.contents.result) };
12228 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12229 let _ = unsafe { Box::from_raw(self.contents.err) };
12234 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
12235 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12236 let contents = if o.result_ok {
12237 let result = unsafe { o.contents.result };
12238 unsafe { o.contents.result = core::ptr::null_mut() };
12239 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
12241 let err = unsafe { o.contents.err };
12242 unsafe { o.contents.err = core::ptr::null_mut(); }
12243 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
12247 result_ok: o.result_ok,
12251 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
12252 fn clone(&self) -> Self {
12253 if self.result_ok {
12254 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12255 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
12258 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12259 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12265 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
12266 /// but with all dynamically-allocated buffers duplicated in new buffers.
12267 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
12269 /// The contents of CResult_HTLCUpdateDecodeErrorZ
12270 pub union CResult_HTLCUpdateDecodeErrorZPtr {
12271 /// A pointer to the contents in the success state.
12272 /// Reading from this pointer when `result_ok` is not set is undefined.
12273 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
12274 /// A pointer to the contents in the error state.
12275 /// Reading from this pointer when `result_ok` is set is undefined.
12276 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12279 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
12280 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12281 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12282 pub struct CResult_HTLCUpdateDecodeErrorZ {
12283 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
12284 /// `err` or `result` depending on the state of `result_ok`.
12285 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
12286 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
12287 pub result_ok: bool,
12290 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
12291 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
12292 CResult_HTLCUpdateDecodeErrorZ {
12293 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12294 result: Box::into_raw(Box::new(o)),
12300 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
12301 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
12302 CResult_HTLCUpdateDecodeErrorZ {
12303 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12304 err: Box::into_raw(Box::new(e)),
12309 /// Checks if the given object is currently in the success state
12311 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
12315 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
12316 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
12317 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
12318 fn drop(&mut self) {
12319 if self.result_ok {
12320 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12321 let _ = unsafe { Box::from_raw(self.contents.result) };
12324 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12325 let _ = unsafe { Box::from_raw(self.contents.err) };
12330 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
12331 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12332 let contents = if o.result_ok {
12333 let result = unsafe { o.contents.result };
12334 unsafe { o.contents.result = core::ptr::null_mut() };
12335 CResult_HTLCUpdateDecodeErrorZPtr { result }
12337 let err = unsafe { o.contents.err };
12338 unsafe { o.contents.err = core::ptr::null_mut(); }
12339 CResult_HTLCUpdateDecodeErrorZPtr { err }
12343 result_ok: o.result_ok,
12347 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
12348 fn clone(&self) -> Self {
12349 if self.result_ok {
12350 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12351 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
12354 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12355 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12361 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
12362 /// but with all dynamically-allocated buffers duplicated in new buffers.
12363 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
12365 /// A tuple of 2 elements. See the individual fields for the types contained.
12366 pub struct C2Tuple_OutPointCVec_u8ZZ {
12367 /// The element at position 0
12368 pub a: crate::lightning::chain::transaction::OutPoint,
12369 /// The element at position 1
12370 pub b: crate::c_types::derived::CVec_u8Z,
12372 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
12373 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
12380 impl C2Tuple_OutPointCVec_u8ZZ {
12381 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
12385 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
12386 fn clone(&self) -> Self {
12388 a: Clone::clone(&self.a),
12389 b: Clone::clone(&self.b),
12394 /// Creates a new tuple which has the same data as `orig`
12395 /// but with all dynamically-allocated buffers duplicated in new buffers.
12396 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
12397 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
12399 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
12400 C2Tuple_OutPointCVec_u8ZZ { a, b, }
12404 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
12405 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
12407 /// A tuple of 2 elements. See the individual fields for the types contained.
12408 pub struct C2Tuple_u32CVec_u8ZZ {
12409 /// The element at position 0
12411 /// The element at position 1
12412 pub b: crate::c_types::derived::CVec_u8Z,
12414 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
12415 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
12422 impl C2Tuple_u32CVec_u8ZZ {
12423 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
12427 impl Clone for C2Tuple_u32CVec_u8ZZ {
12428 fn clone(&self) -> Self {
12430 a: Clone::clone(&self.a),
12431 b: Clone::clone(&self.b),
12436 /// Creates a new tuple which has the same data as `orig`
12437 /// but with all dynamically-allocated buffers duplicated in new buffers.
12438 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
12439 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
12441 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
12442 C2Tuple_u32CVec_u8ZZ { a, b, }
12446 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
12447 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
12449 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
12450 /// This corresponds to std::vector in C++
12451 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
12452 /// The elements in the array.
12453 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12454 pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
12455 /// The number of elements pointed to by `data`.
12458 impl CVec_C2Tuple_u32CVec_u8ZZZ {
12459 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
12460 if self.datalen == 0 { return Vec::new(); }
12461 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12462 self.data = core::ptr::null_mut();
12466 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
12467 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12470 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
12471 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
12472 let datalen = v.len();
12473 let data = Box::into_raw(v.into_boxed_slice());
12474 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12478 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12479 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
12480 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
12481 fn drop(&mut self) {
12482 if self.datalen == 0 { return; }
12483 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12486 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
12487 fn clone(&self) -> Self {
12488 let mut res = Vec::new();
12489 if self.datalen == 0 { return Self::from(res); }
12490 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12495 /// A tuple of 2 elements. See the individual fields for the types contained.
12496 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12497 /// The element at position 0
12498 pub a: crate::c_types::ThirtyTwoBytes,
12499 /// The element at position 1
12500 pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
12502 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12503 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
12510 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12511 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
12515 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12516 fn clone(&self) -> Self {
12518 a: Clone::clone(&self.a),
12519 b: Clone::clone(&self.b),
12524 /// Creates a new tuple which has the same data as `orig`
12525 /// but with all dynamically-allocated buffers duplicated in new buffers.
12526 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
12527 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
12529 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 {
12530 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
12534 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
12535 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
12537 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
12538 /// This corresponds to std::vector in C++
12539 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12540 /// The elements in the array.
12541 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12542 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
12543 /// The number of elements pointed to by `data`.
12546 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12547 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
12548 if self.datalen == 0 { return Vec::new(); }
12549 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12550 self.data = core::ptr::null_mut();
12554 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
12555 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12558 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12559 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
12560 let datalen = v.len();
12561 let data = Box::into_raw(v.into_boxed_slice());
12562 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12566 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12567 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
12568 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12569 fn drop(&mut self) {
12570 if self.datalen == 0 { return; }
12571 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12574 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12575 fn clone(&self) -> Self {
12576 let mut res = Vec::new();
12577 if self.datalen == 0 { return Self::from(res); }
12578 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12583 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
12584 /// This corresponds to std::vector in C++
12585 pub struct CVec_CommitmentTransactionZ {
12586 /// The elements in the array.
12587 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12588 pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
12589 /// The number of elements pointed to by `data`.
12592 impl CVec_CommitmentTransactionZ {
12593 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
12594 if self.datalen == 0 { return Vec::new(); }
12595 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12596 self.data = core::ptr::null_mut();
12600 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
12601 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12604 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
12605 fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
12606 let datalen = v.len();
12607 let data = Box::into_raw(v.into_boxed_slice());
12608 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12612 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12613 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
12614 impl Drop for CVec_CommitmentTransactionZ {
12615 fn drop(&mut self) {
12616 if self.datalen == 0 { return; }
12617 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12620 impl Clone for CVec_CommitmentTransactionZ {
12621 fn clone(&self) -> Self {
12622 let mut res = Vec::new();
12623 if self.datalen == 0 { return Self::from(res); }
12624 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12629 /// A tuple of 2 elements. See the individual fields for the types contained.
12630 pub struct C2Tuple_u32TxOutZ {
12631 /// The element at position 0
12633 /// The element at position 1
12634 pub b: crate::c_types::TxOut,
12636 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
12637 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
12644 impl C2Tuple_u32TxOutZ {
12645 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
12649 impl Clone for C2Tuple_u32TxOutZ {
12650 fn clone(&self) -> Self {
12652 a: Clone::clone(&self.a),
12653 b: Clone::clone(&self.b),
12658 /// Creates a new tuple which has the same data as `orig`
12659 /// but with all dynamically-allocated buffers duplicated in new buffers.
12660 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
12661 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
12663 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
12664 C2Tuple_u32TxOutZ { a, b, }
12668 /// Frees any resources used by the C2Tuple_u32TxOutZ.
12669 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
12671 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
12672 /// This corresponds to std::vector in C++
12673 pub struct CVec_C2Tuple_u32TxOutZZ {
12674 /// The elements in the array.
12675 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12676 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
12677 /// The number of elements pointed to by `data`.
12680 impl CVec_C2Tuple_u32TxOutZZ {
12681 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
12682 if self.datalen == 0 { return Vec::new(); }
12683 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12684 self.data = core::ptr::null_mut();
12688 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
12689 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12692 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
12693 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
12694 let datalen = v.len();
12695 let data = Box::into_raw(v.into_boxed_slice());
12696 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12700 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12701 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
12702 impl Drop for CVec_C2Tuple_u32TxOutZZ {
12703 fn drop(&mut self) {
12704 if self.datalen == 0 { return; }
12705 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12708 impl Clone for CVec_C2Tuple_u32TxOutZZ {
12709 fn clone(&self) -> Self {
12710 let mut res = Vec::new();
12711 if self.datalen == 0 { return Self::from(res); }
12712 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12717 /// A tuple of 2 elements. See the individual fields for the types contained.
12718 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12719 /// The element at position 0
12720 pub a: crate::c_types::ThirtyTwoBytes,
12721 /// The element at position 1
12722 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
12724 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12725 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
12732 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12733 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
12737 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12738 fn clone(&self) -> Self {
12740 a: Clone::clone(&self.a),
12741 b: Clone::clone(&self.b),
12746 /// Creates a new tuple which has the same data as `orig`
12747 /// but with all dynamically-allocated buffers duplicated in new buffers.
12748 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
12749 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12751 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 {
12752 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
12756 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
12757 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
12759 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
12760 /// This corresponds to std::vector in C++
12761 pub struct CVec_TransactionOutputsZ {
12762 /// The elements in the array.
12763 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12764 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
12765 /// The number of elements pointed to by `data`.
12768 impl CVec_TransactionOutputsZ {
12769 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
12770 if self.datalen == 0 { return Vec::new(); }
12771 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12772 self.data = core::ptr::null_mut();
12776 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
12777 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12780 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
12781 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
12782 let datalen = v.len();
12783 let data = Box::into_raw(v.into_boxed_slice());
12784 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12788 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12789 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
12790 impl Drop for CVec_TransactionOutputsZ {
12791 fn drop(&mut self) {
12792 if self.datalen == 0 { return; }
12793 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12796 impl Clone for CVec_TransactionOutputsZ {
12797 fn clone(&self) -> Self {
12798 let mut res = Vec::new();
12799 if self.datalen == 0 { return Self::from(res); }
12800 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12805 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
12806 /// This corresponds to std::vector in C++
12807 pub struct CVec_BalanceZ {
12808 /// The elements in the array.
12809 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12810 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
12811 /// The number of elements pointed to by `data`.
12814 impl CVec_BalanceZ {
12815 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12816 if self.datalen == 0 { return Vec::new(); }
12817 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12818 self.data = core::ptr::null_mut();
12822 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
12823 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12826 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
12827 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
12828 let datalen = v.len();
12829 let data = Box::into_raw(v.into_boxed_slice());
12830 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12834 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12835 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
12836 impl Drop for CVec_BalanceZ {
12837 fn drop(&mut self) {
12838 if self.datalen == 0 { return; }
12839 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12842 impl Clone for CVec_BalanceZ {
12843 fn clone(&self) -> Self {
12844 let mut res = Vec::new();
12845 if self.datalen == 0 { return Self::from(res); }
12846 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12851 /// A tuple of 2 elements. See the individual fields for the types contained.
12852 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12853 /// The element at position 0
12854 pub a: crate::c_types::ThirtyTwoBytes,
12855 /// The element at position 1
12856 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
12858 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12859 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
12866 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12867 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
12871 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12872 fn clone(&self) -> Self {
12874 a: Clone::clone(&self.a),
12875 b: Clone::clone(&self.b),
12880 /// Creates a new tuple which has the same data as `orig`
12881 /// but with all dynamically-allocated buffers duplicated in new buffers.
12882 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
12883 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
12885 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12886 C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
12890 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
12891 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
12893 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
12894 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12895 /// A pointer to the contents in the success state.
12896 /// Reading from this pointer when `result_ok` is not set is undefined.
12897 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12898 /// A pointer to the contents in the error state.
12899 /// Reading from this pointer when `result_ok` is set is undefined.
12900 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12903 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
12904 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12905 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12906 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12907 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
12908 /// `err` or `result` depending on the state of `result_ok`.
12909 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
12910 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
12911 pub result_ok: bool,
12914 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
12915 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12916 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12917 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12918 result: Box::into_raw(Box::new(o)),
12924 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
12925 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12926 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12927 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12928 err: Box::into_raw(Box::new(e)),
12933 /// Checks if the given object is currently in the success state
12935 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
12939 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
12940 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
12941 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12942 fn drop(&mut self) {
12943 if self.result_ok {
12944 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12945 let _ = unsafe { Box::from_raw(self.contents.result) };
12948 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12949 let _ = unsafe { Box::from_raw(self.contents.err) };
12954 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12955 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12956 let contents = if o.result_ok {
12957 let result = unsafe { o.contents.result };
12958 unsafe { o.contents.result = core::ptr::null_mut() };
12959 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
12961 let err = unsafe { o.contents.err };
12962 unsafe { o.contents.err = core::ptr::null_mut(); }
12963 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
12967 result_ok: o.result_ok,
12971 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12972 fn clone(&self) -> Self {
12973 if self.result_ok {
12974 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12975 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
12978 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12979 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12985 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
12986 /// but with all dynamically-allocated buffers duplicated in new buffers.
12987 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
12989 /// A tuple of 2 elements. See the individual fields for the types contained.
12990 pub struct C2Tuple_PublicKeyTypeZ {
12991 /// The element at position 0
12992 pub a: crate::c_types::PublicKey,
12993 /// The element at position 1
12994 pub b: crate::lightning::ln::wire::Type,
12996 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
12997 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
13004 impl C2Tuple_PublicKeyTypeZ {
13005 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
13009 impl Clone for C2Tuple_PublicKeyTypeZ {
13010 fn clone(&self) -> Self {
13012 a: Clone::clone(&self.a),
13013 b: Clone::clone(&self.b),
13018 /// Creates a new tuple which has the same data as `orig`
13019 /// but with all dynamically-allocated buffers duplicated in new buffers.
13020 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
13021 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
13023 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
13024 C2Tuple_PublicKeyTypeZ { a, b, }
13028 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
13029 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
13031 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
13032 /// This corresponds to std::vector in C++
13033 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
13034 /// The elements in the array.
13035 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13036 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
13037 /// The number of elements pointed to by `data`.
13040 impl CVec_C2Tuple_PublicKeyTypeZZ {
13041 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
13042 if self.datalen == 0 { return Vec::new(); }
13043 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13044 self.data = core::ptr::null_mut();
13048 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
13049 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13052 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
13053 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
13054 let datalen = v.len();
13055 let data = Box::into_raw(v.into_boxed_slice());
13056 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13061 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
13062 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
13063 fn drop(&mut self) {
13064 if self.datalen == 0 { return; }
13065 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13068 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
13069 fn clone(&self) -> Self {
13070 let mut res = Vec::new();
13071 if self.datalen == 0 { return Self::from(res); }
13072 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13077 /// A tuple of 2 elements. See the individual fields for the types contained.
13078 pub struct C2Tuple_PublicKeyCVec_SocketAddressZZ {
13079 /// The element at position 0
13080 pub a: crate::c_types::PublicKey,
13081 /// The element at position 1
13082 pub b: crate::c_types::derived::CVec_SocketAddressZ,
13084 impl From<(crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)> for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13085 fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)) -> Self {
13092 impl C2Tuple_PublicKeyCVec_SocketAddressZZ {
13093 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ) {
13097 impl Clone for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13098 fn clone(&self) -> Self {
13100 a: Clone::clone(&self.a),
13101 b: Clone::clone(&self.b),
13106 /// Creates a new tuple which has the same data as `orig`
13107 /// but with all dynamically-allocated buffers duplicated in new buffers.
13108 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCVec_SocketAddressZZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { Clone::clone(&orig) }
13109 /// Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements.
13111 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::CVec_SocketAddressZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ {
13112 C2Tuple_PublicKeyCVec_SocketAddressZZ { a, b, }
13116 /// Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ.
13117 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCVec_SocketAddressZZ) { }
13119 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZs of arbitrary size.
13120 /// This corresponds to std::vector in C++
13121 pub struct CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13122 /// The elements in the array.
13123 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13124 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ,
13125 /// The number of elements pointed to by `data`.
13128 impl CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13129 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ> {
13130 if self.datalen == 0 { return Vec::new(); }
13131 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13132 self.data = core::ptr::null_mut();
13136 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ] {
13137 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13140 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13141 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>) -> Self {
13142 let datalen = v.len();
13143 let data = Box::into_raw(v.into_boxed_slice());
13144 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13148 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13149 pub extern "C" fn CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ) { }
13150 impl Drop for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13151 fn drop(&mut self) {
13152 if self.datalen == 0 { return; }
13153 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13156 impl Clone for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13157 fn clone(&self) -> Self {
13158 let mut res = Vec::new();
13159 if self.datalen == 0 { return Self::from(res); }
13160 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13166 /// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
13167 pub enum COption_OnionMessageContentsZ {
13168 /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
13169 Some(crate::lightning::onion_message::packet::OnionMessageContents),
13170 /// When we're in this state, this COption_OnionMessageContentsZ contains nothing
13173 impl COption_OnionMessageContentsZ {
13174 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13175 if let Self::None = self { false } else { true }
13177 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13180 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents {
13181 if let Self::Some(v) = self { v } else { unreachable!() }
13185 /// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
13186 pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ {
13187 COption_OnionMessageContentsZ::Some(o)
13190 /// Constructs a new COption_OnionMessageContentsZ containing nothing
13191 pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ {
13192 COption_OnionMessageContentsZ::None
13195 /// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
13196 pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { }
13198 /// Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
13199 /// but with all dynamically-allocated buffers duplicated in new buffers.
13200 pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) }
13202 /// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
13203 pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13204 /// A pointer to the contents in the success state.
13205 /// Reading from this pointer when `result_ok` is not set is undefined.
13206 pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ,
13207 /// A pointer to the contents in the error state.
13208 /// Reading from this pointer when `result_ok` is set is undefined.
13209 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13212 /// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
13213 /// containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13214 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13215 pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ {
13216 /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
13217 /// `err` or `result` depending on the state of `result_ok`.
13218 pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr,
13219 /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
13220 pub result_ok: bool,
13223 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
13224 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13225 CResult_COption_OnionMessageContentsZDecodeErrorZ {
13226 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13227 result: Box::into_raw(Box::new(o)),
13233 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
13234 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13235 CResult_COption_OnionMessageContentsZDecodeErrorZ {
13236 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13237 err: Box::into_raw(Box::new(e)),
13242 /// Checks if the given object is currently in the success state
13244 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool {
13248 /// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
13249 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { }
13250 impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13251 fn drop(&mut self) {
13252 if self.result_ok {
13253 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13254 let _ = unsafe { Box::from_raw(self.contents.result) };
13257 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13258 let _ = unsafe { Box::from_raw(self.contents.err) };
13263 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13264 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13265 let contents = if o.result_ok {
13266 let result = unsafe { o.contents.result };
13267 unsafe { o.contents.result = core::ptr::null_mut() };
13268 CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result }
13270 let err = unsafe { o.contents.err };
13271 unsafe { o.contents.err = core::ptr::null_mut(); }
13272 CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err }
13276 result_ok: o.result_ok,
13280 impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13281 fn clone(&self) -> Self {
13282 if self.result_ok {
13283 Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13284 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
13287 Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13288 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13294 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
13295 /// but with all dynamically-allocated buffers duplicated in new buffers.
13296 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
13298 /// A tuple of 3 elements. See the individual fields for the types contained.
13299 pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13300 /// The element at position 0
13301 pub a: crate::lightning::onion_message::packet::OnionMessageContents,
13302 /// The element at position 1
13303 pub b: crate::lightning::onion_message::messenger::Destination,
13304 /// The element at position 2
13305 pub c: crate::lightning::blinded_path::BlindedPath,
13307 impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13308 fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
13316 impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13317 #[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) {
13318 (self.a, self.b, self.c)
13321 impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13322 fn clone(&self) -> Self {
13324 a: Clone::clone(&self.a),
13325 b: Clone::clone(&self.b),
13326 c: Clone::clone(&self.c),
13331 /// Creates a new tuple which has the same data as `orig`
13332 /// but with all dynamically-allocated buffers duplicated in new buffers.
13333 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) }
13334 /// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
13336 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 {
13337 C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, }
13341 /// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
13342 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { }
13344 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
13345 /// This corresponds to std::vector in C++
13346 pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13347 /// The elements in the array.
13348 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13349 pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ,
13350 /// The number of elements pointed to by `data`.
13353 impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13354 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ> {
13355 if self.datalen == 0 { return Vec::new(); }
13356 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13357 self.data = core::ptr::null_mut();
13361 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] {
13362 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13365 impl From<Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13366 fn from(v: Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>) -> Self {
13367 let datalen = v.len();
13368 let data = Box::into_raw(v.into_boxed_slice());
13369 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13373 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13374 pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { }
13375 impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13376 fn drop(&mut self) {
13377 if self.datalen == 0 { return; }
13378 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13381 impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13382 fn clone(&self) -> Self {
13383 let mut res = Vec::new();
13384 if self.datalen == 0 { return Self::from(res); }
13385 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13391 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
13392 pub enum COption_TypeZ {
13393 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
13394 Some(crate::lightning::ln::wire::Type),
13395 /// When we're in this state, this COption_TypeZ contains nothing
13398 impl COption_TypeZ {
13399 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13400 if let Self::None = self { false } else { true }
13402 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13405 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
13406 if let Self::Some(v) = self { v } else { unreachable!() }
13410 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
13411 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
13412 COption_TypeZ::Some(o)
13415 /// Constructs a new COption_TypeZ containing nothing
13416 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
13417 COption_TypeZ::None
13420 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
13421 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
13423 /// Creates a new COption_TypeZ which has the same data as `orig`
13424 /// but with all dynamically-allocated buffers duplicated in new buffers.
13425 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
13427 /// The contents of CResult_COption_TypeZDecodeErrorZ
13428 pub union CResult_COption_TypeZDecodeErrorZPtr {
13429 /// A pointer to the contents in the success state.
13430 /// Reading from this pointer when `result_ok` is not set is undefined.
13431 pub result: *mut crate::c_types::derived::COption_TypeZ,
13432 /// A pointer to the contents in the error state.
13433 /// Reading from this pointer when `result_ok` is set is undefined.
13434 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13437 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
13438 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13440 pub struct CResult_COption_TypeZDecodeErrorZ {
13441 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
13442 /// `err` or `result` depending on the state of `result_ok`.
13443 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
13444 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
13445 pub result_ok: bool,
13448 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
13449 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
13450 CResult_COption_TypeZDecodeErrorZ {
13451 contents: CResult_COption_TypeZDecodeErrorZPtr {
13452 result: Box::into_raw(Box::new(o)),
13458 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
13459 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
13460 CResult_COption_TypeZDecodeErrorZ {
13461 contents: CResult_COption_TypeZDecodeErrorZPtr {
13462 err: Box::into_raw(Box::new(e)),
13467 /// Checks if the given object is currently in the success state
13469 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
13473 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
13474 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
13475 impl Drop for CResult_COption_TypeZDecodeErrorZ {
13476 fn drop(&mut self) {
13477 if self.result_ok {
13478 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13479 let _ = unsafe { Box::from_raw(self.contents.result) };
13482 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13483 let _ = unsafe { Box::from_raw(self.contents.err) };
13488 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
13489 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13490 let contents = if o.result_ok {
13491 let result = unsafe { o.contents.result };
13492 unsafe { o.contents.result = core::ptr::null_mut() };
13493 CResult_COption_TypeZDecodeErrorZPtr { result }
13495 let err = unsafe { o.contents.err };
13496 unsafe { o.contents.err = core::ptr::null_mut(); }
13497 CResult_COption_TypeZDecodeErrorZPtr { err }
13501 result_ok: o.result_ok,
13505 impl Clone for CResult_COption_TypeZDecodeErrorZ {
13506 fn clone(&self) -> Self {
13507 if self.result_ok {
13508 Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
13509 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
13512 Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
13513 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13519 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
13520 /// but with all dynamically-allocated buffers duplicated in new buffers.
13521 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
13524 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
13525 pub enum COption_SocketAddressZ {
13526 /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
13527 Some(crate::lightning::ln::msgs::SocketAddress),
13528 /// When we're in this state, this COption_SocketAddressZ contains nothing
13531 impl COption_SocketAddressZ {
13532 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13533 if let Self::None = self { false } else { true }
13535 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13538 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
13539 if let Self::Some(v) = self { v } else { unreachable!() }
13543 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
13544 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
13545 COption_SocketAddressZ::Some(o)
13548 /// Constructs a new COption_SocketAddressZ containing nothing
13549 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
13550 COption_SocketAddressZ::None
13553 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
13554 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
13556 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
13557 /// but with all dynamically-allocated buffers duplicated in new buffers.
13558 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
13560 /// A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size.
13561 /// This corresponds to std::vector in C++
13562 pub struct CVec_PeerDetailsZ {
13563 /// The elements in the array.
13564 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13565 pub data: *mut crate::lightning::ln::peer_handler::PeerDetails,
13566 /// The number of elements pointed to by `data`.
13569 impl CVec_PeerDetailsZ {
13570 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::peer_handler::PeerDetails> {
13571 if self.datalen == 0 { return Vec::new(); }
13572 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13573 self.data = core::ptr::null_mut();
13577 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::peer_handler::PeerDetails] {
13578 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13581 impl From<Vec<crate::lightning::ln::peer_handler::PeerDetails>> for CVec_PeerDetailsZ {
13582 fn from(v: Vec<crate::lightning::ln::peer_handler::PeerDetails>) -> Self {
13583 let datalen = v.len();
13584 let data = Box::into_raw(v.into_boxed_slice());
13585 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13589 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13590 pub extern "C" fn CVec_PeerDetailsZ_free(_res: CVec_PeerDetailsZ) { }
13591 impl Drop for CVec_PeerDetailsZ {
13592 fn drop(&mut self) {
13593 if self.datalen == 0 { return; }
13594 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13598 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
13599 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
13600 /// A pointer to the contents in the success state.
13601 /// Reading from this pointer when `result_ok` is not set is undefined.
13602 pub result: *mut crate::c_types::derived::CVec_u8Z,
13603 /// A pointer to the contents in the error state.
13604 /// Reading from this pointer when `result_ok` is set is undefined.
13605 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13608 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
13609 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13611 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
13612 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
13613 /// `err` or `result` depending on the state of `result_ok`.
13614 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
13615 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
13616 pub result_ok: bool,
13619 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
13620 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
13621 CResult_CVec_u8ZPeerHandleErrorZ {
13622 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13623 result: Box::into_raw(Box::new(o)),
13629 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
13630 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
13631 CResult_CVec_u8ZPeerHandleErrorZ {
13632 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13633 err: Box::into_raw(Box::new(e)),
13638 /// Checks if the given object is currently in the success state
13640 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
13644 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
13645 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
13646 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
13647 fn drop(&mut self) {
13648 if self.result_ok {
13649 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13650 let _ = unsafe { Box::from_raw(self.contents.result) };
13653 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13654 let _ = unsafe { Box::from_raw(self.contents.err) };
13659 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
13660 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13661 let contents = if o.result_ok {
13662 let result = unsafe { o.contents.result };
13663 unsafe { o.contents.result = core::ptr::null_mut() };
13664 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
13666 let err = unsafe { o.contents.err };
13667 unsafe { o.contents.err = core::ptr::null_mut(); }
13668 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
13672 result_ok: o.result_ok,
13676 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
13677 fn clone(&self) -> Self {
13678 if self.result_ok {
13679 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13680 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
13683 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13684 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13690 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
13691 /// but with all dynamically-allocated buffers duplicated in new buffers.
13692 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
13694 /// The contents of CResult_NonePeerHandleErrorZ
13695 pub union CResult_NonePeerHandleErrorZPtr {
13696 /// Note that this value is always NULL, as there are no contents in the OK variant
13697 pub result: *mut core::ffi::c_void,
13698 /// A pointer to the contents in the error state.
13699 /// Reading from this pointer when `result_ok` is set is undefined.
13700 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13703 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
13704 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13705 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13706 pub struct CResult_NonePeerHandleErrorZ {
13707 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
13708 /// `err` or `result` depending on the state of `result_ok`.
13709 pub contents: CResult_NonePeerHandleErrorZPtr,
13710 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
13711 pub result_ok: bool,
13714 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
13715 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
13716 CResult_NonePeerHandleErrorZ {
13717 contents: CResult_NonePeerHandleErrorZPtr {
13718 result: core::ptr::null_mut(),
13724 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
13725 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
13726 CResult_NonePeerHandleErrorZ {
13727 contents: CResult_NonePeerHandleErrorZPtr {
13728 err: Box::into_raw(Box::new(e)),
13733 /// Checks if the given object is currently in the success state
13735 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
13739 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
13740 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
13741 impl Drop for CResult_NonePeerHandleErrorZ {
13742 fn drop(&mut self) {
13743 if self.result_ok {
13745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13746 let _ = unsafe { Box::from_raw(self.contents.err) };
13751 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
13752 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13753 let contents = if o.result_ok {
13754 let _ = unsafe { Box::from_raw(o.contents.result) };
13755 o.contents.result = core::ptr::null_mut();
13756 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
13758 let err = unsafe { o.contents.err };
13759 unsafe { o.contents.err = core::ptr::null_mut(); }
13760 CResult_NonePeerHandleErrorZPtr { err }
13764 result_ok: o.result_ok,
13768 impl Clone for CResult_NonePeerHandleErrorZ {
13769 fn clone(&self) -> Self {
13770 if self.result_ok {
13771 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
13772 result: core::ptr::null_mut()
13775 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
13776 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13782 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
13783 /// but with all dynamically-allocated buffers duplicated in new buffers.
13784 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
13786 /// The contents of CResult_boolPeerHandleErrorZ
13787 pub union CResult_boolPeerHandleErrorZPtr {
13788 /// A pointer to the contents in the success state.
13789 /// Reading from this pointer when `result_ok` is not set is undefined.
13790 pub result: *mut bool,
13791 /// A pointer to the contents in the error state.
13792 /// Reading from this pointer when `result_ok` is set is undefined.
13793 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13796 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
13797 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13799 pub struct CResult_boolPeerHandleErrorZ {
13800 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
13801 /// `err` or `result` depending on the state of `result_ok`.
13802 pub contents: CResult_boolPeerHandleErrorZPtr,
13803 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
13804 pub result_ok: bool,
13807 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
13808 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
13809 CResult_boolPeerHandleErrorZ {
13810 contents: CResult_boolPeerHandleErrorZPtr {
13811 result: Box::into_raw(Box::new(o)),
13817 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
13818 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
13819 CResult_boolPeerHandleErrorZ {
13820 contents: CResult_boolPeerHandleErrorZPtr {
13821 err: Box::into_raw(Box::new(e)),
13826 /// Checks if the given object is currently in the success state
13828 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
13832 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
13833 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
13834 impl Drop for CResult_boolPeerHandleErrorZ {
13835 fn drop(&mut self) {
13836 if self.result_ok {
13837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13838 let _ = unsafe { Box::from_raw(self.contents.result) };
13841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13842 let _ = unsafe { Box::from_raw(self.contents.err) };
13847 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
13848 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13849 let contents = if o.result_ok {
13850 let result = unsafe { o.contents.result };
13851 unsafe { o.contents.result = core::ptr::null_mut() };
13852 CResult_boolPeerHandleErrorZPtr { result }
13854 let err = unsafe { o.contents.err };
13855 unsafe { o.contents.err = core::ptr::null_mut(); }
13856 CResult_boolPeerHandleErrorZPtr { err }
13860 result_ok: o.result_ok,
13864 impl Clone for CResult_boolPeerHandleErrorZ {
13865 fn clone(&self) -> Self {
13866 if self.result_ok {
13867 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
13868 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
13871 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
13872 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13878 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
13879 /// but with all dynamically-allocated buffers duplicated in new buffers.
13880 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
13882 /// The contents of CResult_u32GraphSyncErrorZ
13883 pub union CResult_u32GraphSyncErrorZPtr {
13884 /// A pointer to the contents in the success state.
13885 /// Reading from this pointer when `result_ok` is not set is undefined.
13886 pub result: *mut u32,
13887 /// A pointer to the contents in the error state.
13888 /// Reading from this pointer when `result_ok` is set is undefined.
13889 pub err: *mut crate::lightning_rapid_gossip_sync::GraphSyncError,
13892 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
13893 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure.
13894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13895 pub struct CResult_u32GraphSyncErrorZ {
13896 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
13897 /// `err` or `result` depending on the state of `result_ok`.
13898 pub contents: CResult_u32GraphSyncErrorZPtr,
13899 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
13900 pub result_ok: bool,
13903 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
13904 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
13905 CResult_u32GraphSyncErrorZ {
13906 contents: CResult_u32GraphSyncErrorZPtr {
13907 result: Box::into_raw(Box::new(o)),
13913 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
13914 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
13915 CResult_u32GraphSyncErrorZ {
13916 contents: CResult_u32GraphSyncErrorZPtr {
13917 err: Box::into_raw(Box::new(e)),
13922 /// Checks if the given object is currently in the success state
13924 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
13928 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
13929 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
13930 impl Drop for CResult_u32GraphSyncErrorZ {
13931 fn drop(&mut self) {
13932 if self.result_ok {
13933 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13934 let _ = unsafe { Box::from_raw(self.contents.result) };
13937 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13938 let _ = unsafe { Box::from_raw(self.contents.err) };
13943 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
13944 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>) -> Self {
13945 let contents = if o.result_ok {
13946 let result = unsafe { o.contents.result };
13947 unsafe { o.contents.result = core::ptr::null_mut() };
13948 CResult_u32GraphSyncErrorZPtr { result }
13950 let err = unsafe { o.contents.err };
13951 unsafe { o.contents.err = core::ptr::null_mut(); }
13952 CResult_u32GraphSyncErrorZPtr { err }
13956 result_ok: o.result_ok,
13961 /// The contents of CResult_CVec_u8ZIOErrorZ
13962 pub union CResult_CVec_u8ZIOErrorZPtr {
13963 /// A pointer to the contents in the success state.
13964 /// Reading from this pointer when `result_ok` is not set is undefined.
13965 pub result: *mut crate::c_types::derived::CVec_u8Z,
13966 /// A pointer to the contents in the error state.
13967 /// Reading from this pointer when `result_ok` is set is undefined.
13968 pub err: *mut crate::c_types::IOError,
13971 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
13972 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
13973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13974 pub struct CResult_CVec_u8ZIOErrorZ {
13975 /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
13976 /// `err` or `result` depending on the state of `result_ok`.
13977 pub contents: CResult_CVec_u8ZIOErrorZPtr,
13978 /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
13979 pub result_ok: bool,
13982 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
13983 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
13984 CResult_CVec_u8ZIOErrorZ {
13985 contents: CResult_CVec_u8ZIOErrorZPtr {
13986 result: Box::into_raw(Box::new(o)),
13992 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
13993 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
13994 CResult_CVec_u8ZIOErrorZ {
13995 contents: CResult_CVec_u8ZIOErrorZPtr {
13996 err: Box::into_raw(Box::new(e)),
14001 /// Checks if the given object is currently in the success state
14003 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
14007 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
14008 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
14009 impl Drop for CResult_CVec_u8ZIOErrorZ {
14010 fn drop(&mut self) {
14011 if self.result_ok {
14012 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14013 let _ = unsafe { Box::from_raw(self.contents.result) };
14016 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14017 let _ = unsafe { Box::from_raw(self.contents.err) };
14022 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
14023 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
14024 let contents = if o.result_ok {
14025 let result = unsafe { o.contents.result };
14026 unsafe { o.contents.result = core::ptr::null_mut() };
14027 CResult_CVec_u8ZIOErrorZPtr { result }
14029 let err = unsafe { o.contents.err };
14030 unsafe { o.contents.err = core::ptr::null_mut(); }
14031 CResult_CVec_u8ZIOErrorZPtr { err }
14035 result_ok: o.result_ok,
14039 impl Clone for CResult_CVec_u8ZIOErrorZ {
14040 fn clone(&self) -> Self {
14041 if self.result_ok {
14042 Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
14043 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
14046 Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
14047 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14053 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
14054 /// but with all dynamically-allocated buffers duplicated in new buffers.
14055 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
14057 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
14058 /// This corresponds to std::vector in C++
14059 pub struct CVec_StrZ {
14060 /// The elements in the array.
14061 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14062 pub data: *mut crate::c_types::Str,
14063 /// The number of elements pointed to by `data`.
14067 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
14068 if self.datalen == 0 { return Vec::new(); }
14069 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14070 self.data = core::ptr::null_mut();
14074 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
14075 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14078 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
14079 fn from(v: Vec<crate::c_types::Str>) -> Self {
14080 let datalen = v.len();
14081 let data = Box::into_raw(v.into_boxed_slice());
14082 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14086 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14087 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
14088 impl Drop for CVec_StrZ {
14089 fn drop(&mut self) {
14090 if self.datalen == 0 { return; }
14091 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14094 impl Clone for CVec_StrZ {
14095 fn clone(&self) -> Self {
14096 let mut res = Vec::new();
14097 if self.datalen == 0 { return Self::from(res); }
14098 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14103 /// The contents of CResult_CVec_StrZIOErrorZ
14104 pub union CResult_CVec_StrZIOErrorZPtr {
14105 /// A pointer to the contents in the success state.
14106 /// Reading from this pointer when `result_ok` is not set is undefined.
14107 pub result: *mut crate::c_types::derived::CVec_StrZ,
14108 /// A pointer to the contents in the error state.
14109 /// Reading from this pointer when `result_ok` is set is undefined.
14110 pub err: *mut crate::c_types::IOError,
14113 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
14114 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
14115 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14116 pub struct CResult_CVec_StrZIOErrorZ {
14117 /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
14118 /// `err` or `result` depending on the state of `result_ok`.
14119 pub contents: CResult_CVec_StrZIOErrorZPtr,
14120 /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
14121 pub result_ok: bool,
14124 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
14125 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
14126 CResult_CVec_StrZIOErrorZ {
14127 contents: CResult_CVec_StrZIOErrorZPtr {
14128 result: Box::into_raw(Box::new(o)),
14134 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
14135 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
14136 CResult_CVec_StrZIOErrorZ {
14137 contents: CResult_CVec_StrZIOErrorZPtr {
14138 err: Box::into_raw(Box::new(e)),
14143 /// Checks if the given object is currently in the success state
14145 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
14149 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
14150 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
14151 impl Drop for CResult_CVec_StrZIOErrorZ {
14152 fn drop(&mut self) {
14153 if self.result_ok {
14154 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14155 let _ = unsafe { Box::from_raw(self.contents.result) };
14158 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14159 let _ = unsafe { Box::from_raw(self.contents.err) };
14164 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
14165 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
14166 let contents = if o.result_ok {
14167 let result = unsafe { o.contents.result };
14168 unsafe { o.contents.result = core::ptr::null_mut() };
14169 CResult_CVec_StrZIOErrorZPtr { result }
14171 let err = unsafe { o.contents.err };
14172 unsafe { o.contents.err = core::ptr::null_mut(); }
14173 CResult_CVec_StrZIOErrorZPtr { err }
14177 result_ok: o.result_ok,
14181 impl Clone for CResult_CVec_StrZIOErrorZ {
14182 fn clone(&self) -> Self {
14183 if self.result_ok {
14184 Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
14185 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
14188 Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
14189 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14195 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
14196 /// but with all dynamically-allocated buffers duplicated in new buffers.
14197 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
14199 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
14200 /// This corresponds to std::vector in C++
14201 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14202 /// The elements in the array.
14203 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14204 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14205 /// The number of elements pointed to by `data`.
14208 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14209 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
14210 if self.datalen == 0 { return Vec::new(); }
14211 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14212 self.data = core::ptr::null_mut();
14216 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
14217 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14220 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14221 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
14222 let datalen = v.len();
14223 let data = Box::into_raw(v.into_boxed_slice());
14224 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14228 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14229 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
14230 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14231 fn drop(&mut self) {
14232 if self.datalen == 0 { return; }
14233 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14236 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14237 fn clone(&self) -> Self {
14238 let mut res = Vec::new();
14239 if self.datalen == 0 { return Self::from(res); }
14240 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14245 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
14246 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14247 /// A pointer to the contents in the success state.
14248 /// Reading from this pointer when `result_ok` is not set is undefined.
14249 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
14250 /// A pointer to the contents in the error state.
14251 /// Reading from this pointer when `result_ok` is set is undefined.
14252 pub err: *mut crate::c_types::IOError,
14255 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
14256 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
14257 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14258 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14259 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
14260 /// `err` or `result` depending on the state of `result_ok`.
14261 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
14262 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
14263 pub result_ok: bool,
14266 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
14267 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14268 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14269 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14270 result: Box::into_raw(Box::new(o)),
14276 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
14277 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14278 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14279 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14280 err: Box::into_raw(Box::new(e)),
14285 /// Checks if the given object is currently in the success state
14287 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
14291 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
14292 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
14293 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14294 fn drop(&mut self) {
14295 if self.result_ok {
14296 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14297 let _ = unsafe { Box::from_raw(self.contents.result) };
14300 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14301 let _ = unsafe { Box::from_raw(self.contents.err) };
14306 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14307 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> Self {
14308 let contents = if o.result_ok {
14309 let result = unsafe { o.contents.result };
14310 unsafe { o.contents.result = core::ptr::null_mut() };
14311 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
14313 let err = unsafe { o.contents.err };
14314 unsafe { o.contents.err = core::ptr::null_mut(); }
14315 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
14319 result_ok: o.result_ok,
14323 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14324 fn clone(&self) -> Self {
14325 if self.result_ok {
14326 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14327 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
14330 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14331 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14337 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
14338 /// but with all dynamically-allocated buffers duplicated in new buffers.
14339 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
14341 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
14342 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14343 /// A pointer to the contents in the success state.
14344 /// Reading from this pointer when `result_ok` is not set is undefined.
14345 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14346 /// A pointer to the contents in the error state.
14347 /// Reading from this pointer when `result_ok` is set is undefined.
14348 pub err: *mut crate::c_types::IOError,
14351 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
14352 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
14353 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14354 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14355 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
14356 /// `err` or `result` depending on the state of `result_ok`.
14357 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
14358 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
14359 pub result_ok: bool,
14362 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
14363 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14364 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14365 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14366 result: Box::into_raw(Box::new(o)),
14372 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
14373 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14374 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14375 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14376 err: Box::into_raw(Box::new(e)),
14381 /// Checks if the given object is currently in the success state
14383 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
14387 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
14388 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
14389 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14390 fn drop(&mut self) {
14391 if self.result_ok {
14392 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14393 let _ = unsafe { Box::from_raw(self.contents.result) };
14396 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14397 let _ = unsafe { Box::from_raw(self.contents.err) };
14402 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14403 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
14404 let contents = if o.result_ok {
14405 let result = unsafe { o.contents.result };
14406 unsafe { o.contents.result = core::ptr::null_mut() };
14407 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
14409 let err = unsafe { o.contents.err };
14410 unsafe { o.contents.err = core::ptr::null_mut(); }
14411 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
14415 result_ok: o.result_ok,
14419 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14420 fn clone(&self) -> Self {
14421 if self.result_ok {
14422 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14423 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
14426 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14427 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14433 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
14434 /// but with all dynamically-allocated buffers duplicated in new buffers.
14435 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
14437 /// The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ
14438 pub union CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14439 /// A pointer to the contents in the success state.
14440 /// Reading from this pointer when `result_ok` is not set is undefined.
14441 pub result: *mut crate::lightning::offers::invoice_request::UnsignedInvoiceRequest,
14442 /// A pointer to the contents in the error state.
14443 /// Reading from this pointer when `result_ok` is set is undefined.
14444 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14447 /// A CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14448 /// containing a crate::lightning::offers::invoice_request::UnsignedInvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14450 pub struct CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14451 /// The contents of this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ, accessible via either
14452 /// `err` or `result` depending on the state of `result_ok`.
14453 pub contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr,
14454 /// Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state.
14455 pub result_ok: bool,
14458 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the success state.
14459 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14460 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14461 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14462 result: Box::into_raw(Box::new(o)),
14468 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the error state.
14469 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14470 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14471 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14472 err: Box::into_raw(Box::new(e)),
14477 /// Checks if the given object is currently in the success state
14479 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> bool {
14483 /// Frees any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ.
14484 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) { }
14485 impl Drop for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14486 fn drop(&mut self) {
14487 if self.result_ok {
14488 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14489 let _ = unsafe { Box::from_raw(self.contents.result) };
14492 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14493 let _ = unsafe { Box::from_raw(self.contents.err) };
14498 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14499 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14500 let contents = if o.result_ok {
14501 let result = unsafe { o.contents.result };
14502 unsafe { o.contents.result = core::ptr::null_mut() };
14503 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { result }
14505 let err = unsafe { o.contents.err };
14506 unsafe { o.contents.err = core::ptr::null_mut(); }
14507 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { err }
14511 result_ok: o.result_ok,
14515 impl Clone for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14516 fn clone(&self) -> Self {
14517 if self.result_ok {
14518 Self { result_ok: true, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14519 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
14522 Self { result_ok: false, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14523 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
14529 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
14530 /// but with all dynamically-allocated buffers duplicated in new buffers.
14531 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) }
14533 /// The contents of CResult_InvoiceRequestBolt12SemanticErrorZ
14534 pub union CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14535 /// A pointer to the contents in the success state.
14536 /// Reading from this pointer when `result_ok` is not set is undefined.
14537 pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequest,
14538 /// A pointer to the contents in the error state.
14539 /// Reading from this pointer when `result_ok` is set is undefined.
14540 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14543 /// A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14544 /// containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14545 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14546 pub struct CResult_InvoiceRequestBolt12SemanticErrorZ {
14547 /// The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either
14548 /// `err` or `result` depending on the state of `result_ok`.
14549 pub contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr,
14550 /// Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state.
14551 pub result_ok: bool,
14554 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state.
14555 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14556 CResult_InvoiceRequestBolt12SemanticErrorZ {
14557 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14558 result: Box::into_raw(Box::new(o)),
14564 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state.
14565 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14566 CResult_InvoiceRequestBolt12SemanticErrorZ {
14567 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14568 err: Box::into_raw(Box::new(e)),
14573 /// Checks if the given object is currently in the success state
14575 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> bool {
14579 /// Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ.
14580 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestBolt12SemanticErrorZ) { }
14581 impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ {
14582 fn drop(&mut self) {
14583 if self.result_ok {
14584 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14585 let _ = unsafe { Box::from_raw(self.contents.result) };
14588 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14589 let _ = unsafe { Box::from_raw(self.contents.err) };
14594 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestBolt12SemanticErrorZ {
14595 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14596 let contents = if o.result_ok {
14597 let result = unsafe { o.contents.result };
14598 unsafe { o.contents.result = core::ptr::null_mut() };
14599 CResult_InvoiceRequestBolt12SemanticErrorZPtr { result }
14601 let err = unsafe { o.contents.err };
14602 unsafe { o.contents.err = core::ptr::null_mut(); }
14603 CResult_InvoiceRequestBolt12SemanticErrorZPtr { err }
14607 result_ok: o.result_ok,
14611 impl Clone for CResult_InvoiceRequestBolt12SemanticErrorZ {
14612 fn clone(&self) -> Self {
14613 if self.result_ok {
14614 Self { result_ok: true, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14615 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequest>::clone(unsafe { &*self.contents.result })))
14618 Self { result_ok: false, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14619 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
14625 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
14626 /// but with all dynamically-allocated buffers duplicated in new buffers.
14627 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> CResult_InvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) }
14630 /// An enum which can either contain a crate::c_types::SecretKey or not
14631 pub enum COption_SecretKeyZ {
14632 /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
14633 Some(crate::c_types::SecretKey),
14634 /// When we're in this state, this COption_SecretKeyZ contains nothing
14637 impl COption_SecretKeyZ {
14638 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
14639 if let Self::None = self { false } else { true }
14641 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
14644 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
14645 if let Self::Some(v) = self { v } else { unreachable!() }
14649 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
14650 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
14651 COption_SecretKeyZ::Some(o)
14654 /// Constructs a new COption_SecretKeyZ containing nothing
14655 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
14656 COption_SecretKeyZ::None
14659 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
14660 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
14662 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
14663 /// but with all dynamically-allocated buffers duplicated in new buffers.
14664 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
14666 /// The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ
14667 pub union CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14668 /// A pointer to the contents in the success state.
14669 /// Reading from this pointer when `result_ok` is not set is undefined.
14670 pub result: *mut crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder,
14671 /// A pointer to the contents in the error state.
14672 /// Reading from this pointer when `result_ok` is set is undefined.
14673 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14676 /// A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
14677 /// containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14678 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14679 pub struct CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14680 /// The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
14681 /// `err` or `result` depending on the state of `result_ok`.
14682 pub contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr,
14683 /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
14684 pub result_ok: bool,
14687 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
14688 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14689 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14690 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14691 result: Box::into_raw(Box::new(o)),
14697 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
14698 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14699 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14700 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14701 err: Box::into_raw(Box::new(e)),
14706 /// Checks if the given object is currently in the success state
14708 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
14712 /// Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.
14713 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) { }
14714 impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14715 fn drop(&mut self) {
14716 if self.result_ok {
14717 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14718 let _ = unsafe { Box::from_raw(self.contents.result) };
14721 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14722 let _ = unsafe { Box::from_raw(self.contents.err) };
14727 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14728 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14729 let contents = if o.result_ok {
14730 let result = unsafe { o.contents.result };
14731 unsafe { o.contents.result = core::ptr::null_mut() };
14732 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
14734 let err = unsafe { o.contents.err };
14735 unsafe { o.contents.err = core::ptr::null_mut(); }
14736 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
14740 result_ok: o.result_ok,
14745 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
14746 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
14747 /// A pointer to the contents in the success state.
14748 /// Reading from this pointer when `result_ok` is not set is undefined.
14749 pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
14750 /// Note that this value is always NULL, as there are no contents in the Err variant
14751 pub err: *mut core::ffi::c_void,
14754 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
14755 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
14756 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14757 pub struct CResult_VerifiedInvoiceRequestNoneZ {
14758 /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
14759 /// `err` or `result` depending on the state of `result_ok`.
14760 pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
14761 /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
14762 pub result_ok: bool,
14765 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
14766 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
14767 CResult_VerifiedInvoiceRequestNoneZ {
14768 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14769 result: Box::into_raw(Box::new(o)),
14775 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
14776 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
14777 CResult_VerifiedInvoiceRequestNoneZ {
14778 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14779 err: core::ptr::null_mut(),
14784 /// Checks if the given object is currently in the success state
14786 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
14790 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
14791 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
14792 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
14793 fn drop(&mut self) {
14794 if self.result_ok {
14795 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14796 let _ = unsafe { Box::from_raw(self.contents.result) };
14802 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
14803 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
14804 let contents = if o.result_ok {
14805 let result = unsafe { o.contents.result };
14806 unsafe { o.contents.result = core::ptr::null_mut() };
14807 CResult_VerifiedInvoiceRequestNoneZPtr { result }
14809 let _ = unsafe { Box::from_raw(o.contents.err) };
14810 o.contents.err = core::ptr::null_mut();
14811 CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
14815 result_ok: o.result_ok,
14819 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
14820 fn clone(&self) -> Self {
14821 if self.result_ok {
14822 Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14823 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
14826 Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14827 err: core::ptr::null_mut()
14833 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
14834 /// but with all dynamically-allocated buffers duplicated in new buffers.
14835 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
14837 /// The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ
14838 pub union CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14839 /// A pointer to the contents in the success state.
14840 /// Reading from this pointer when `result_ok` is not set is undefined.
14841 pub result: *mut crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder,
14842 /// A pointer to the contents in the error state.
14843 /// Reading from this pointer when `result_ok` is set is undefined.
14844 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14847 /// A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
14848 /// containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14850 pub struct CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14851 /// The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
14852 /// `err` or `result` depending on the state of `result_ok`.
14853 pub contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr,
14854 /// Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
14855 pub result_ok: bool,
14858 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
14859 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14860 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14861 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14862 result: Box::into_raw(Box::new(o)),
14868 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
14869 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14870 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14871 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14872 err: Box::into_raw(Box::new(e)),
14877 /// Checks if the given object is currently in the success state
14879 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
14883 /// Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ.
14884 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) { }
14885 impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14886 fn drop(&mut self) {
14887 if self.result_ok {
14888 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14889 let _ = unsafe { Box::from_raw(self.contents.result) };
14892 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14893 let _ = unsafe { Box::from_raw(self.contents.err) };
14898 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14899 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14900 let contents = if o.result_ok {
14901 let result = unsafe { o.contents.result };
14902 unsafe { o.contents.result = core::ptr::null_mut() };
14903 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
14905 let err = unsafe { o.contents.err };
14906 unsafe { o.contents.err = core::ptr::null_mut(); }
14907 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
14911 result_ok: o.result_ok,
14916 /// The contents of CResult_InvoiceRequestFieldsDecodeErrorZ
14917 pub union CResult_InvoiceRequestFieldsDecodeErrorZPtr {
14918 /// A pointer to the contents in the success state.
14919 /// Reading from this pointer when `result_ok` is not set is undefined.
14920 pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestFields,
14921 /// A pointer to the contents in the error state.
14922 /// Reading from this pointer when `result_ok` is set is undefined.
14923 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14926 /// A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation,
14927 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
14928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14929 pub struct CResult_InvoiceRequestFieldsDecodeErrorZ {
14930 /// The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either
14931 /// `err` or `result` depending on the state of `result_ok`.
14932 pub contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr,
14933 /// Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state.
14934 pub result_ok: bool,
14937 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state.
14938 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestFields) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
14939 CResult_InvoiceRequestFieldsDecodeErrorZ {
14940 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
14941 result: Box::into_raw(Box::new(o)),
14947 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state.
14948 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
14949 CResult_InvoiceRequestFieldsDecodeErrorZ {
14950 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
14951 err: Box::into_raw(Box::new(e)),
14956 /// Checks if the given object is currently in the success state
14958 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> bool {
14962 /// Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ.
14963 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res: CResult_InvoiceRequestFieldsDecodeErrorZ) { }
14964 impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ {
14965 fn drop(&mut self) {
14966 if self.result_ok {
14967 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14968 let _ = unsafe { Box::from_raw(self.contents.result) };
14971 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14972 let _ = unsafe { Box::from_raw(self.contents.err) };
14977 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceRequestFieldsDecodeErrorZ {
14978 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
14979 let contents = if o.result_ok {
14980 let result = unsafe { o.contents.result };
14981 unsafe { o.contents.result = core::ptr::null_mut() };
14982 CResult_InvoiceRequestFieldsDecodeErrorZPtr { result }
14984 let err = unsafe { o.contents.err };
14985 unsafe { o.contents.err = core::ptr::null_mut(); }
14986 CResult_InvoiceRequestFieldsDecodeErrorZPtr { err }
14990 result_ok: o.result_ok,
14994 impl Clone for CResult_InvoiceRequestFieldsDecodeErrorZ {
14995 fn clone(&self) -> Self {
14996 if self.result_ok {
14997 Self { result_ok: true, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
14998 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequestFields>::clone(unsafe { &*self.contents.result })))
15001 Self { result_ok: false, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15002 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15008 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig`
15009 /// but with all dynamically-allocated buffers duplicated in new buffers.
15010 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> CResult_InvoiceRequestFieldsDecodeErrorZ { Clone::clone(&orig) }
15012 /// An enum which can either contain a or not
15013 pub enum COption_NoneZ {
15014 /// When we're in this state, this COption_NoneZ contains a
15016 /// When we're in this state, this COption_NoneZ contains nothing
15019 impl COption_NoneZ {
15020 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15021 if let Self::None = self { false } else { true }
15023 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15028 /// Constructs a new COption_NoneZ containing a
15029 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
15030 COption_NoneZ::Some
15033 /// Constructs a new COption_NoneZ containing nothing
15034 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
15035 COption_NoneZ::None
15038 /// Frees any resources associated with the , if we are in the Some state
15039 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
15041 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
15042 /// This corresponds to std::vector in C++
15043 pub struct CVec_WitnessZ {
15044 /// The elements in the array.
15045 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15046 pub data: *mut crate::c_types::Witness,
15047 /// The number of elements pointed to by `data`.
15050 impl CVec_WitnessZ {
15051 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
15052 if self.datalen == 0 { return Vec::new(); }
15053 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15054 self.data = core::ptr::null_mut();
15058 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
15059 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15062 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
15063 fn from(v: Vec<crate::c_types::Witness>) -> Self {
15064 let datalen = v.len();
15065 let data = Box::into_raw(v.into_boxed_slice());
15066 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15070 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15071 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
15072 impl Drop for CVec_WitnessZ {
15073 fn drop(&mut self) {
15074 if self.datalen == 0 { return; }
15075 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15078 impl Clone for CVec_WitnessZ {
15079 fn clone(&self) -> Self {
15080 let mut res = Vec::new();
15081 if self.datalen == 0 { return Self::from(res); }
15082 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15088 /// An enum which can either contain a crate::c_types::ECDSASignature or not
15089 pub enum COption_ECDSASignatureZ {
15090 /// When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature
15091 Some(crate::c_types::ECDSASignature),
15092 /// When we're in this state, this COption_ECDSASignatureZ contains nothing
15095 impl COption_ECDSASignatureZ {
15096 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15097 if let Self::None = self { false } else { true }
15099 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15102 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ECDSASignature {
15103 if let Self::Some(v) = self { v } else { unreachable!() }
15107 /// Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature
15108 pub extern "C" fn COption_ECDSASignatureZ_some(o: crate::c_types::ECDSASignature) -> COption_ECDSASignatureZ {
15109 COption_ECDSASignatureZ::Some(o)
15112 /// Constructs a new COption_ECDSASignatureZ containing nothing
15113 pub extern "C" fn COption_ECDSASignatureZ_none() -> COption_ECDSASignatureZ {
15114 COption_ECDSASignatureZ::None
15117 /// Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state
15118 pub extern "C" fn COption_ECDSASignatureZ_free(_res: COption_ECDSASignatureZ) { }
15120 /// Creates a new COption_ECDSASignatureZ which has the same data as `orig`
15121 /// but with all dynamically-allocated buffers duplicated in new buffers.
15122 pub extern "C" fn COption_ECDSASignatureZ_clone(orig: &COption_ECDSASignatureZ) -> COption_ECDSASignatureZ { Clone::clone(&orig) }
15125 /// An enum which can either contain a i64 or not
15126 pub enum COption_i64Z {
15127 /// When we're in this state, this COption_i64Z contains a i64
15129 /// When we're in this state, this COption_i64Z contains nothing
15132 impl COption_i64Z {
15133 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15134 if let Self::None = self { false } else { true }
15136 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15139 #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
15140 if let Self::Some(v) = self { v } else { unreachable!() }
15144 /// Constructs a new COption_i64Z containing a i64
15145 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
15146 COption_i64Z::Some(o)
15149 /// Constructs a new COption_i64Z containing nothing
15150 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
15154 /// Frees any resources associated with the i64, if we are in the Some state
15155 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
15157 /// Creates a new COption_i64Z which has the same data as `orig`
15158 /// but with all dynamically-allocated buffers duplicated in new buffers.
15159 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
15161 /// The contents of CResult_SocketAddressDecodeErrorZ
15162 pub union CResult_SocketAddressDecodeErrorZPtr {
15163 /// A pointer to the contents in the success state.
15164 /// Reading from this pointer when `result_ok` is not set is undefined.
15165 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15166 /// A pointer to the contents in the error state.
15167 /// Reading from this pointer when `result_ok` is set is undefined.
15168 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15171 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
15172 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
15173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15174 pub struct CResult_SocketAddressDecodeErrorZ {
15175 /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
15176 /// `err` or `result` depending on the state of `result_ok`.
15177 pub contents: CResult_SocketAddressDecodeErrorZPtr,
15178 /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
15179 pub result_ok: bool,
15182 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
15183 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
15184 CResult_SocketAddressDecodeErrorZ {
15185 contents: CResult_SocketAddressDecodeErrorZPtr {
15186 result: Box::into_raw(Box::new(o)),
15192 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
15193 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
15194 CResult_SocketAddressDecodeErrorZ {
15195 contents: CResult_SocketAddressDecodeErrorZPtr {
15196 err: Box::into_raw(Box::new(e)),
15201 /// Checks if the given object is currently in the success state
15203 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
15207 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
15208 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
15209 impl Drop for CResult_SocketAddressDecodeErrorZ {
15210 fn drop(&mut self) {
15211 if self.result_ok {
15212 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15213 let _ = unsafe { Box::from_raw(self.contents.result) };
15216 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15217 let _ = unsafe { Box::from_raw(self.contents.err) };
15222 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
15223 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
15224 let contents = if o.result_ok {
15225 let result = unsafe { o.contents.result };
15226 unsafe { o.contents.result = core::ptr::null_mut() };
15227 CResult_SocketAddressDecodeErrorZPtr { result }
15229 let err = unsafe { o.contents.err };
15230 unsafe { o.contents.err = core::ptr::null_mut(); }
15231 CResult_SocketAddressDecodeErrorZPtr { err }
15235 result_ok: o.result_ok,
15239 impl Clone for CResult_SocketAddressDecodeErrorZ {
15240 fn clone(&self) -> Self {
15241 if self.result_ok {
15242 Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
15243 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15246 Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
15247 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15253 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
15254 /// but with all dynamically-allocated buffers duplicated in new buffers.
15255 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
15257 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
15258 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
15259 /// A pointer to the contents in the success state.
15260 /// Reading from this pointer when `result_ok` is not set is undefined.
15261 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15262 /// A pointer to the contents in the error state.
15263 /// Reading from this pointer when `result_ok` is set is undefined.
15264 pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
15267 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
15268 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
15269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15270 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
15271 /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
15272 /// `err` or `result` depending on the state of `result_ok`.
15273 pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
15274 /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
15275 pub result_ok: bool,
15278 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
15279 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
15280 CResult_SocketAddressSocketAddressParseErrorZ {
15281 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15282 result: Box::into_raw(Box::new(o)),
15288 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
15289 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
15290 CResult_SocketAddressSocketAddressParseErrorZ {
15291 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15292 err: Box::into_raw(Box::new(e)),
15297 /// Checks if the given object is currently in the success state
15299 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
15303 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
15304 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
15305 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
15306 fn drop(&mut self) {
15307 if self.result_ok {
15308 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15309 let _ = unsafe { Box::from_raw(self.contents.result) };
15312 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15313 let _ = unsafe { Box::from_raw(self.contents.err) };
15318 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
15319 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
15320 let contents = if o.result_ok {
15321 let result = unsafe { o.contents.result };
15322 unsafe { o.contents.result = core::ptr::null_mut() };
15323 CResult_SocketAddressSocketAddressParseErrorZPtr { result }
15325 let err = unsafe { o.contents.err };
15326 unsafe { o.contents.err = core::ptr::null_mut(); }
15327 CResult_SocketAddressSocketAddressParseErrorZPtr { err }
15331 result_ok: o.result_ok,
15335 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
15336 fn clone(&self) -> Self {
15337 if self.result_ok {
15338 Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15339 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15342 Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15343 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
15349 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
15350 /// but with all dynamically-allocated buffers duplicated in new buffers.
15351 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
15353 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
15354 /// This corresponds to std::vector in C++
15355 pub struct CVec_UpdateAddHTLCZ {
15356 /// The elements in the array.
15357 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15358 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15359 /// The number of elements pointed to by `data`.
15362 impl CVec_UpdateAddHTLCZ {
15363 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
15364 if self.datalen == 0 { return Vec::new(); }
15365 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15366 self.data = core::ptr::null_mut();
15370 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
15371 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15374 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
15375 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
15376 let datalen = v.len();
15377 let data = Box::into_raw(v.into_boxed_slice());
15378 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15382 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15383 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
15384 impl Drop for CVec_UpdateAddHTLCZ {
15385 fn drop(&mut self) {
15386 if self.datalen == 0 { return; }
15387 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15390 impl Clone for CVec_UpdateAddHTLCZ {
15391 fn clone(&self) -> Self {
15392 let mut res = Vec::new();
15393 if self.datalen == 0 { return Self::from(res); }
15394 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15399 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
15400 /// This corresponds to std::vector in C++
15401 pub struct CVec_UpdateFulfillHTLCZ {
15402 /// The elements in the array.
15403 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15404 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
15405 /// The number of elements pointed to by `data`.
15408 impl CVec_UpdateFulfillHTLCZ {
15409 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
15410 if self.datalen == 0 { return Vec::new(); }
15411 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15412 self.data = core::ptr::null_mut();
15416 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
15417 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15420 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
15421 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
15422 let datalen = v.len();
15423 let data = Box::into_raw(v.into_boxed_slice());
15424 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15428 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15429 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
15430 impl Drop for CVec_UpdateFulfillHTLCZ {
15431 fn drop(&mut self) {
15432 if self.datalen == 0 { return; }
15433 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15436 impl Clone for CVec_UpdateFulfillHTLCZ {
15437 fn clone(&self) -> Self {
15438 let mut res = Vec::new();
15439 if self.datalen == 0 { return Self::from(res); }
15440 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15445 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
15446 /// This corresponds to std::vector in C++
15447 pub struct CVec_UpdateFailHTLCZ {
15448 /// The elements in the array.
15449 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15450 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15451 /// The number of elements pointed to by `data`.
15454 impl CVec_UpdateFailHTLCZ {
15455 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
15456 if self.datalen == 0 { return Vec::new(); }
15457 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15458 self.data = core::ptr::null_mut();
15462 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
15463 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15466 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
15467 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
15468 let datalen = v.len();
15469 let data = Box::into_raw(v.into_boxed_slice());
15470 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15474 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15475 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
15476 impl Drop for CVec_UpdateFailHTLCZ {
15477 fn drop(&mut self) {
15478 if self.datalen == 0 { return; }
15479 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15482 impl Clone for CVec_UpdateFailHTLCZ {
15483 fn clone(&self) -> Self {
15484 let mut res = Vec::new();
15485 if self.datalen == 0 { return Self::from(res); }
15486 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15491 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
15492 /// This corresponds to std::vector in C++
15493 pub struct CVec_UpdateFailMalformedHTLCZ {
15494 /// The elements in the array.
15495 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15496 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15497 /// The number of elements pointed to by `data`.
15500 impl CVec_UpdateFailMalformedHTLCZ {
15501 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
15502 if self.datalen == 0 { return Vec::new(); }
15503 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15504 self.data = core::ptr::null_mut();
15508 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
15509 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15512 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
15513 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
15514 let datalen = v.len();
15515 let data = Box::into_raw(v.into_boxed_slice());
15516 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15520 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15521 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
15522 impl Drop for CVec_UpdateFailMalformedHTLCZ {
15523 fn drop(&mut self) {
15524 if self.datalen == 0 { return; }
15525 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15528 impl Clone for CVec_UpdateFailMalformedHTLCZ {
15529 fn clone(&self) -> Self {
15530 let mut res = Vec::new();
15531 if self.datalen == 0 { return Self::from(res); }
15532 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15537 /// The contents of CResult_AcceptChannelDecodeErrorZ
15538 pub union CResult_AcceptChannelDecodeErrorZPtr {
15539 /// A pointer to the contents in the success state.
15540 /// Reading from this pointer when `result_ok` is not set is undefined.
15541 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
15542 /// A pointer to the contents in the error state.
15543 /// Reading from this pointer when `result_ok` is set is undefined.
15544 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15547 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
15548 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15549 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15550 pub struct CResult_AcceptChannelDecodeErrorZ {
15551 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
15552 /// `err` or `result` depending on the state of `result_ok`.
15553 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
15554 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
15555 pub result_ok: bool,
15558 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
15559 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
15560 CResult_AcceptChannelDecodeErrorZ {
15561 contents: CResult_AcceptChannelDecodeErrorZPtr {
15562 result: Box::into_raw(Box::new(o)),
15568 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
15569 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
15570 CResult_AcceptChannelDecodeErrorZ {
15571 contents: CResult_AcceptChannelDecodeErrorZPtr {
15572 err: Box::into_raw(Box::new(e)),
15577 /// Checks if the given object is currently in the success state
15579 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
15583 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
15584 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
15585 impl Drop for CResult_AcceptChannelDecodeErrorZ {
15586 fn drop(&mut self) {
15587 if self.result_ok {
15588 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15589 let _ = unsafe { Box::from_raw(self.contents.result) };
15592 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15593 let _ = unsafe { Box::from_raw(self.contents.err) };
15598 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
15599 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15600 let contents = if o.result_ok {
15601 let result = unsafe { o.contents.result };
15602 unsafe { o.contents.result = core::ptr::null_mut() };
15603 CResult_AcceptChannelDecodeErrorZPtr { result }
15605 let err = unsafe { o.contents.err };
15606 unsafe { o.contents.err = core::ptr::null_mut(); }
15607 CResult_AcceptChannelDecodeErrorZPtr { err }
15611 result_ok: o.result_ok,
15615 impl Clone for CResult_AcceptChannelDecodeErrorZ {
15616 fn clone(&self) -> Self {
15617 if self.result_ok {
15618 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
15619 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
15622 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
15623 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15629 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
15630 /// but with all dynamically-allocated buffers duplicated in new buffers.
15631 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
15633 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
15634 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
15635 /// A pointer to the contents in the success state.
15636 /// Reading from this pointer when `result_ok` is not set is undefined.
15637 pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
15638 /// A pointer to the contents in the error state.
15639 /// Reading from this pointer when `result_ok` is set is undefined.
15640 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15643 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
15644 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
15645 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15646 pub struct CResult_AcceptChannelV2DecodeErrorZ {
15647 /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
15648 /// `err` or `result` depending on the state of `result_ok`.
15649 pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
15650 /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
15651 pub result_ok: bool,
15654 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
15655 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
15656 CResult_AcceptChannelV2DecodeErrorZ {
15657 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15658 result: Box::into_raw(Box::new(o)),
15664 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
15665 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
15666 CResult_AcceptChannelV2DecodeErrorZ {
15667 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15668 err: Box::into_raw(Box::new(e)),
15673 /// Checks if the given object is currently in the success state
15675 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
15679 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
15680 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
15681 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
15682 fn drop(&mut self) {
15683 if self.result_ok {
15684 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15685 let _ = unsafe { Box::from_raw(self.contents.result) };
15688 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15689 let _ = unsafe { Box::from_raw(self.contents.err) };
15694 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
15695 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
15696 let contents = if o.result_ok {
15697 let result = unsafe { o.contents.result };
15698 unsafe { o.contents.result = core::ptr::null_mut() };
15699 CResult_AcceptChannelV2DecodeErrorZPtr { result }
15701 let err = unsafe { o.contents.err };
15702 unsafe { o.contents.err = core::ptr::null_mut(); }
15703 CResult_AcceptChannelV2DecodeErrorZPtr { err }
15707 result_ok: o.result_ok,
15711 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
15712 fn clone(&self) -> Self {
15713 if self.result_ok {
15714 Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15715 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
15718 Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15719 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15725 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
15726 /// but with all dynamically-allocated buffers duplicated in new buffers.
15727 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
15729 /// The contents of CResult_StfuDecodeErrorZ
15730 pub union CResult_StfuDecodeErrorZPtr {
15731 /// A pointer to the contents in the success state.
15732 /// Reading from this pointer when `result_ok` is not set is undefined.
15733 pub result: *mut crate::lightning::ln::msgs::Stfu,
15734 /// A pointer to the contents in the error state.
15735 /// Reading from this pointer when `result_ok` is set is undefined.
15736 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15739 /// A CResult_StfuDecodeErrorZ represents the result of a fallible operation,
15740 /// containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure.
15741 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15742 pub struct CResult_StfuDecodeErrorZ {
15743 /// The contents of this CResult_StfuDecodeErrorZ, accessible via either
15744 /// `err` or `result` depending on the state of `result_ok`.
15745 pub contents: CResult_StfuDecodeErrorZPtr,
15746 /// Whether this CResult_StfuDecodeErrorZ represents a success state.
15747 pub result_ok: bool,
15750 /// Creates a new CResult_StfuDecodeErrorZ in the success state.
15751 pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ {
15752 CResult_StfuDecodeErrorZ {
15753 contents: CResult_StfuDecodeErrorZPtr {
15754 result: Box::into_raw(Box::new(o)),
15760 /// Creates a new CResult_StfuDecodeErrorZ in the error state.
15761 pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ {
15762 CResult_StfuDecodeErrorZ {
15763 contents: CResult_StfuDecodeErrorZPtr {
15764 err: Box::into_raw(Box::new(e)),
15769 /// Checks if the given object is currently in the success state
15771 pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool {
15775 /// Frees any resources used by the CResult_StfuDecodeErrorZ.
15776 pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { }
15777 impl Drop for CResult_StfuDecodeErrorZ {
15778 fn drop(&mut self) {
15779 if self.result_ok {
15780 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15781 let _ = unsafe { Box::from_raw(self.contents.result) };
15784 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15785 let _ = unsafe { Box::from_raw(self.contents.err) };
15790 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>> for CResult_StfuDecodeErrorZ {
15791 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>) -> Self {
15792 let contents = if o.result_ok {
15793 let result = unsafe { o.contents.result };
15794 unsafe { o.contents.result = core::ptr::null_mut() };
15795 CResult_StfuDecodeErrorZPtr { result }
15797 let err = unsafe { o.contents.err };
15798 unsafe { o.contents.err = core::ptr::null_mut(); }
15799 CResult_StfuDecodeErrorZPtr { err }
15803 result_ok: o.result_ok,
15807 impl Clone for CResult_StfuDecodeErrorZ {
15808 fn clone(&self) -> Self {
15809 if self.result_ok {
15810 Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr {
15811 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Stfu>::clone(unsafe { &*self.contents.result })))
15814 Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr {
15815 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15821 /// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig`
15822 /// but with all dynamically-allocated buffers duplicated in new buffers.
15823 pub extern "C" fn CResult_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) }
15825 /// The contents of CResult_SpliceDecodeErrorZ
15826 pub union CResult_SpliceDecodeErrorZPtr {
15827 /// A pointer to the contents in the success state.
15828 /// Reading from this pointer when `result_ok` is not set is undefined.
15829 pub result: *mut crate::lightning::ln::msgs::Splice,
15830 /// A pointer to the contents in the error state.
15831 /// Reading from this pointer when `result_ok` is set is undefined.
15832 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15835 /// A CResult_SpliceDecodeErrorZ represents the result of a fallible operation,
15836 /// containing a crate::lightning::ln::msgs::Splice on success and a crate::lightning::ln::msgs::DecodeError on failure.
15837 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15838 pub struct CResult_SpliceDecodeErrorZ {
15839 /// The contents of this CResult_SpliceDecodeErrorZ, accessible via either
15840 /// `err` or `result` depending on the state of `result_ok`.
15841 pub contents: CResult_SpliceDecodeErrorZPtr,
15842 /// Whether this CResult_SpliceDecodeErrorZ represents a success state.
15843 pub result_ok: bool,
15846 /// Creates a new CResult_SpliceDecodeErrorZ in the success state.
15847 pub extern "C" fn CResult_SpliceDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Splice) -> CResult_SpliceDecodeErrorZ {
15848 CResult_SpliceDecodeErrorZ {
15849 contents: CResult_SpliceDecodeErrorZPtr {
15850 result: Box::into_raw(Box::new(o)),
15856 /// Creates a new CResult_SpliceDecodeErrorZ in the error state.
15857 pub extern "C" fn CResult_SpliceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceDecodeErrorZ {
15858 CResult_SpliceDecodeErrorZ {
15859 contents: CResult_SpliceDecodeErrorZPtr {
15860 err: Box::into_raw(Box::new(e)),
15865 /// Checks if the given object is currently in the success state
15867 pub extern "C" fn CResult_SpliceDecodeErrorZ_is_ok(o: &CResult_SpliceDecodeErrorZ) -> bool {
15871 /// Frees any resources used by the CResult_SpliceDecodeErrorZ.
15872 pub extern "C" fn CResult_SpliceDecodeErrorZ_free(_res: CResult_SpliceDecodeErrorZ) { }
15873 impl Drop for CResult_SpliceDecodeErrorZ {
15874 fn drop(&mut self) {
15875 if self.result_ok {
15876 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15877 let _ = unsafe { Box::from_raw(self.contents.result) };
15880 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15881 let _ = unsafe { Box::from_raw(self.contents.err) };
15886 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceDecodeErrorZ {
15887 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>) -> Self {
15888 let contents = if o.result_ok {
15889 let result = unsafe { o.contents.result };
15890 unsafe { o.contents.result = core::ptr::null_mut() };
15891 CResult_SpliceDecodeErrorZPtr { result }
15893 let err = unsafe { o.contents.err };
15894 unsafe { o.contents.err = core::ptr::null_mut(); }
15895 CResult_SpliceDecodeErrorZPtr { err }
15899 result_ok: o.result_ok,
15903 impl Clone for CResult_SpliceDecodeErrorZ {
15904 fn clone(&self) -> Self {
15905 if self.result_ok {
15906 Self { result_ok: true, contents: CResult_SpliceDecodeErrorZPtr {
15907 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Splice>::clone(unsafe { &*self.contents.result })))
15910 Self { result_ok: false, contents: CResult_SpliceDecodeErrorZPtr {
15911 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15917 /// Creates a new CResult_SpliceDecodeErrorZ which has the same data as `orig`
15918 /// but with all dynamically-allocated buffers duplicated in new buffers.
15919 pub extern "C" fn CResult_SpliceDecodeErrorZ_clone(orig: &CResult_SpliceDecodeErrorZ) -> CResult_SpliceDecodeErrorZ { Clone::clone(&orig) }
15921 /// The contents of CResult_SpliceAckDecodeErrorZ
15922 pub union CResult_SpliceAckDecodeErrorZPtr {
15923 /// A pointer to the contents in the success state.
15924 /// Reading from this pointer when `result_ok` is not set is undefined.
15925 pub result: *mut crate::lightning::ln::msgs::SpliceAck,
15926 /// A pointer to the contents in the error state.
15927 /// Reading from this pointer when `result_ok` is set is undefined.
15928 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15931 /// A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation,
15932 /// containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure.
15933 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15934 pub struct CResult_SpliceAckDecodeErrorZ {
15935 /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either
15936 /// `err` or `result` depending on the state of `result_ok`.
15937 pub contents: CResult_SpliceAckDecodeErrorZPtr,
15938 /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state.
15939 pub result_ok: bool,
15942 /// Creates a new CResult_SpliceAckDecodeErrorZ in the success state.
15943 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ {
15944 CResult_SpliceAckDecodeErrorZ {
15945 contents: CResult_SpliceAckDecodeErrorZPtr {
15946 result: Box::into_raw(Box::new(o)),
15952 /// Creates a new CResult_SpliceAckDecodeErrorZ in the error state.
15953 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ {
15954 CResult_SpliceAckDecodeErrorZ {
15955 contents: CResult_SpliceAckDecodeErrorZPtr {
15956 err: Box::into_raw(Box::new(e)),
15961 /// Checks if the given object is currently in the success state
15963 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool {
15967 /// Frees any resources used by the CResult_SpliceAckDecodeErrorZ.
15968 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { }
15969 impl Drop for CResult_SpliceAckDecodeErrorZ {
15970 fn drop(&mut self) {
15971 if self.result_ok {
15972 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15973 let _ = unsafe { Box::from_raw(self.contents.result) };
15976 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15977 let _ = unsafe { Box::from_raw(self.contents.err) };
15982 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceAckDecodeErrorZ {
15983 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>) -> Self {
15984 let contents = if o.result_ok {
15985 let result = unsafe { o.contents.result };
15986 unsafe { o.contents.result = core::ptr::null_mut() };
15987 CResult_SpliceAckDecodeErrorZPtr { result }
15989 let err = unsafe { o.contents.err };
15990 unsafe { o.contents.err = core::ptr::null_mut(); }
15991 CResult_SpliceAckDecodeErrorZPtr { err }
15995 result_ok: o.result_ok,
15999 impl Clone for CResult_SpliceAckDecodeErrorZ {
16000 fn clone(&self) -> Self {
16001 if self.result_ok {
16002 Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr {
16003 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceAck>::clone(unsafe { &*self.contents.result })))
16006 Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr {
16007 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16013 /// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig`
16014 /// but with all dynamically-allocated buffers duplicated in new buffers.
16015 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) }
16017 /// The contents of CResult_SpliceLockedDecodeErrorZ
16018 pub union CResult_SpliceLockedDecodeErrorZPtr {
16019 /// A pointer to the contents in the success state.
16020 /// Reading from this pointer when `result_ok` is not set is undefined.
16021 pub result: *mut crate::lightning::ln::msgs::SpliceLocked,
16022 /// A pointer to the contents in the error state.
16023 /// Reading from this pointer when `result_ok` is set is undefined.
16024 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16027 /// A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation,
16028 /// containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
16029 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16030 pub struct CResult_SpliceLockedDecodeErrorZ {
16031 /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either
16032 /// `err` or `result` depending on the state of `result_ok`.
16033 pub contents: CResult_SpliceLockedDecodeErrorZPtr,
16034 /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state.
16035 pub result_ok: bool,
16038 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state.
16039 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ {
16040 CResult_SpliceLockedDecodeErrorZ {
16041 contents: CResult_SpliceLockedDecodeErrorZPtr {
16042 result: Box::into_raw(Box::new(o)),
16048 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state.
16049 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ {
16050 CResult_SpliceLockedDecodeErrorZ {
16051 contents: CResult_SpliceLockedDecodeErrorZPtr {
16052 err: Box::into_raw(Box::new(e)),
16057 /// Checks if the given object is currently in the success state
16059 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool {
16063 /// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ.
16064 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { }
16065 impl Drop for CResult_SpliceLockedDecodeErrorZ {
16066 fn drop(&mut self) {
16067 if self.result_ok {
16068 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16069 let _ = unsafe { Box::from_raw(self.contents.result) };
16072 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16073 let _ = unsafe { Box::from_raw(self.contents.err) };
16078 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceLockedDecodeErrorZ {
16079 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
16080 let contents = if o.result_ok {
16081 let result = unsafe { o.contents.result };
16082 unsafe { o.contents.result = core::ptr::null_mut() };
16083 CResult_SpliceLockedDecodeErrorZPtr { result }
16085 let err = unsafe { o.contents.err };
16086 unsafe { o.contents.err = core::ptr::null_mut(); }
16087 CResult_SpliceLockedDecodeErrorZPtr { err }
16091 result_ok: o.result_ok,
16095 impl Clone for CResult_SpliceLockedDecodeErrorZ {
16096 fn clone(&self) -> Self {
16097 if self.result_ok {
16098 Self { result_ok: true, contents: CResult_SpliceLockedDecodeErrorZPtr {
16099 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceLocked>::clone(unsafe { &*self.contents.result })))
16102 Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr {
16103 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16109 /// Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig`
16110 /// but with all dynamically-allocated buffers duplicated in new buffers.
16111 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) }
16113 /// The contents of CResult_TxAddInputDecodeErrorZ
16114 pub union CResult_TxAddInputDecodeErrorZPtr {
16115 /// A pointer to the contents in the success state.
16116 /// Reading from this pointer when `result_ok` is not set is undefined.
16117 pub result: *mut crate::lightning::ln::msgs::TxAddInput,
16118 /// A pointer to the contents in the error state.
16119 /// Reading from this pointer when `result_ok` is set is undefined.
16120 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16123 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
16124 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16126 pub struct CResult_TxAddInputDecodeErrorZ {
16127 /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
16128 /// `err` or `result` depending on the state of `result_ok`.
16129 pub contents: CResult_TxAddInputDecodeErrorZPtr,
16130 /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
16131 pub result_ok: bool,
16134 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
16135 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
16136 CResult_TxAddInputDecodeErrorZ {
16137 contents: CResult_TxAddInputDecodeErrorZPtr {
16138 result: Box::into_raw(Box::new(o)),
16144 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
16145 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
16146 CResult_TxAddInputDecodeErrorZ {
16147 contents: CResult_TxAddInputDecodeErrorZPtr {
16148 err: Box::into_raw(Box::new(e)),
16153 /// Checks if the given object is currently in the success state
16155 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
16159 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
16160 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
16161 impl Drop for CResult_TxAddInputDecodeErrorZ {
16162 fn drop(&mut self) {
16163 if self.result_ok {
16164 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16165 let _ = unsafe { Box::from_raw(self.contents.result) };
16168 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16169 let _ = unsafe { Box::from_raw(self.contents.err) };
16174 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
16175 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16176 let contents = if o.result_ok {
16177 let result = unsafe { o.contents.result };
16178 unsafe { o.contents.result = core::ptr::null_mut() };
16179 CResult_TxAddInputDecodeErrorZPtr { result }
16181 let err = unsafe { o.contents.err };
16182 unsafe { o.contents.err = core::ptr::null_mut(); }
16183 CResult_TxAddInputDecodeErrorZPtr { err }
16187 result_ok: o.result_ok,
16191 impl Clone for CResult_TxAddInputDecodeErrorZ {
16192 fn clone(&self) -> Self {
16193 if self.result_ok {
16194 Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
16195 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
16198 Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
16199 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16205 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
16206 /// but with all dynamically-allocated buffers duplicated in new buffers.
16207 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
16209 /// The contents of CResult_TxAddOutputDecodeErrorZ
16210 pub union CResult_TxAddOutputDecodeErrorZPtr {
16211 /// A pointer to the contents in the success state.
16212 /// Reading from this pointer when `result_ok` is not set is undefined.
16213 pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
16214 /// A pointer to the contents in the error state.
16215 /// Reading from this pointer when `result_ok` is set is undefined.
16216 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16219 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
16220 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16221 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16222 pub struct CResult_TxAddOutputDecodeErrorZ {
16223 /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
16224 /// `err` or `result` depending on the state of `result_ok`.
16225 pub contents: CResult_TxAddOutputDecodeErrorZPtr,
16226 /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
16227 pub result_ok: bool,
16230 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
16231 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
16232 CResult_TxAddOutputDecodeErrorZ {
16233 contents: CResult_TxAddOutputDecodeErrorZPtr {
16234 result: Box::into_raw(Box::new(o)),
16240 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
16241 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
16242 CResult_TxAddOutputDecodeErrorZ {
16243 contents: CResult_TxAddOutputDecodeErrorZPtr {
16244 err: Box::into_raw(Box::new(e)),
16249 /// Checks if the given object is currently in the success state
16251 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
16255 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
16256 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
16257 impl Drop for CResult_TxAddOutputDecodeErrorZ {
16258 fn drop(&mut self) {
16259 if self.result_ok {
16260 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16261 let _ = unsafe { Box::from_raw(self.contents.result) };
16264 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16265 let _ = unsafe { Box::from_raw(self.contents.err) };
16270 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
16271 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16272 let contents = if o.result_ok {
16273 let result = unsafe { o.contents.result };
16274 unsafe { o.contents.result = core::ptr::null_mut() };
16275 CResult_TxAddOutputDecodeErrorZPtr { result }
16277 let err = unsafe { o.contents.err };
16278 unsafe { o.contents.err = core::ptr::null_mut(); }
16279 CResult_TxAddOutputDecodeErrorZPtr { err }
16283 result_ok: o.result_ok,
16287 impl Clone for CResult_TxAddOutputDecodeErrorZ {
16288 fn clone(&self) -> Self {
16289 if self.result_ok {
16290 Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
16291 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
16294 Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
16295 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16301 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
16302 /// but with all dynamically-allocated buffers duplicated in new buffers.
16303 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
16305 /// The contents of CResult_TxRemoveInputDecodeErrorZ
16306 pub union CResult_TxRemoveInputDecodeErrorZPtr {
16307 /// A pointer to the contents in the success state.
16308 /// Reading from this pointer when `result_ok` is not set is undefined.
16309 pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
16310 /// A pointer to the contents in the error state.
16311 /// Reading from this pointer when `result_ok` is set is undefined.
16312 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16315 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
16316 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16317 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16318 pub struct CResult_TxRemoveInputDecodeErrorZ {
16319 /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
16320 /// `err` or `result` depending on the state of `result_ok`.
16321 pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
16322 /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
16323 pub result_ok: bool,
16326 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
16327 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
16328 CResult_TxRemoveInputDecodeErrorZ {
16329 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16330 result: Box::into_raw(Box::new(o)),
16336 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
16337 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
16338 CResult_TxRemoveInputDecodeErrorZ {
16339 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16340 err: Box::into_raw(Box::new(e)),
16345 /// Checks if the given object is currently in the success state
16347 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
16351 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
16352 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
16353 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
16354 fn drop(&mut self) {
16355 if self.result_ok {
16356 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16357 let _ = unsafe { Box::from_raw(self.contents.result) };
16360 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16361 let _ = unsafe { Box::from_raw(self.contents.err) };
16366 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
16367 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16368 let contents = if o.result_ok {
16369 let result = unsafe { o.contents.result };
16370 unsafe { o.contents.result = core::ptr::null_mut() };
16371 CResult_TxRemoveInputDecodeErrorZPtr { result }
16373 let err = unsafe { o.contents.err };
16374 unsafe { o.contents.err = core::ptr::null_mut(); }
16375 CResult_TxRemoveInputDecodeErrorZPtr { err }
16379 result_ok: o.result_ok,
16383 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
16384 fn clone(&self) -> Self {
16385 if self.result_ok {
16386 Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16387 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
16390 Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16391 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16397 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
16398 /// but with all dynamically-allocated buffers duplicated in new buffers.
16399 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
16401 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
16402 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
16403 /// A pointer to the contents in the success state.
16404 /// Reading from this pointer when `result_ok` is not set is undefined.
16405 pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
16406 /// A pointer to the contents in the error state.
16407 /// Reading from this pointer when `result_ok` is set is undefined.
16408 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16411 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
16412 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16414 pub struct CResult_TxRemoveOutputDecodeErrorZ {
16415 /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
16416 /// `err` or `result` depending on the state of `result_ok`.
16417 pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
16418 /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
16419 pub result_ok: bool,
16422 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
16423 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
16424 CResult_TxRemoveOutputDecodeErrorZ {
16425 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16426 result: Box::into_raw(Box::new(o)),
16432 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
16433 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
16434 CResult_TxRemoveOutputDecodeErrorZ {
16435 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16436 err: Box::into_raw(Box::new(e)),
16441 /// Checks if the given object is currently in the success state
16443 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
16447 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
16448 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
16449 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
16450 fn drop(&mut self) {
16451 if self.result_ok {
16452 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16453 let _ = unsafe { Box::from_raw(self.contents.result) };
16456 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16457 let _ = unsafe { Box::from_raw(self.contents.err) };
16462 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
16463 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16464 let contents = if o.result_ok {
16465 let result = unsafe { o.contents.result };
16466 unsafe { o.contents.result = core::ptr::null_mut() };
16467 CResult_TxRemoveOutputDecodeErrorZPtr { result }
16469 let err = unsafe { o.contents.err };
16470 unsafe { o.contents.err = core::ptr::null_mut(); }
16471 CResult_TxRemoveOutputDecodeErrorZPtr { err }
16475 result_ok: o.result_ok,
16479 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
16480 fn clone(&self) -> Self {
16481 if self.result_ok {
16482 Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16483 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
16486 Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16487 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16493 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
16494 /// but with all dynamically-allocated buffers duplicated in new buffers.
16495 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
16497 /// The contents of CResult_TxCompleteDecodeErrorZ
16498 pub union CResult_TxCompleteDecodeErrorZPtr {
16499 /// A pointer to the contents in the success state.
16500 /// Reading from this pointer when `result_ok` is not set is undefined.
16501 pub result: *mut crate::lightning::ln::msgs::TxComplete,
16502 /// A pointer to the contents in the error state.
16503 /// Reading from this pointer when `result_ok` is set is undefined.
16504 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16507 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
16508 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
16509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16510 pub struct CResult_TxCompleteDecodeErrorZ {
16511 /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
16512 /// `err` or `result` depending on the state of `result_ok`.
16513 pub contents: CResult_TxCompleteDecodeErrorZPtr,
16514 /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
16515 pub result_ok: bool,
16518 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
16519 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
16520 CResult_TxCompleteDecodeErrorZ {
16521 contents: CResult_TxCompleteDecodeErrorZPtr {
16522 result: Box::into_raw(Box::new(o)),
16528 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
16529 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
16530 CResult_TxCompleteDecodeErrorZ {
16531 contents: CResult_TxCompleteDecodeErrorZPtr {
16532 err: Box::into_raw(Box::new(e)),
16537 /// Checks if the given object is currently in the success state
16539 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
16543 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
16544 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
16545 impl Drop for CResult_TxCompleteDecodeErrorZ {
16546 fn drop(&mut self) {
16547 if self.result_ok {
16548 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16549 let _ = unsafe { Box::from_raw(self.contents.result) };
16552 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16553 let _ = unsafe { Box::from_raw(self.contents.err) };
16558 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
16559 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
16560 let contents = if o.result_ok {
16561 let result = unsafe { o.contents.result };
16562 unsafe { o.contents.result = core::ptr::null_mut() };
16563 CResult_TxCompleteDecodeErrorZPtr { result }
16565 let err = unsafe { o.contents.err };
16566 unsafe { o.contents.err = core::ptr::null_mut(); }
16567 CResult_TxCompleteDecodeErrorZPtr { err }
16571 result_ok: o.result_ok,
16575 impl Clone for CResult_TxCompleteDecodeErrorZ {
16576 fn clone(&self) -> Self {
16577 if self.result_ok {
16578 Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
16579 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
16582 Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
16583 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16589 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
16590 /// but with all dynamically-allocated buffers duplicated in new buffers.
16591 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
16593 /// The contents of CResult_TxSignaturesDecodeErrorZ
16594 pub union CResult_TxSignaturesDecodeErrorZPtr {
16595 /// A pointer to the contents in the success state.
16596 /// Reading from this pointer when `result_ok` is not set is undefined.
16597 pub result: *mut crate::lightning::ln::msgs::TxSignatures,
16598 /// A pointer to the contents in the error state.
16599 /// Reading from this pointer when `result_ok` is set is undefined.
16600 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16603 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
16604 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
16605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16606 pub struct CResult_TxSignaturesDecodeErrorZ {
16607 /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
16608 /// `err` or `result` depending on the state of `result_ok`.
16609 pub contents: CResult_TxSignaturesDecodeErrorZPtr,
16610 /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
16611 pub result_ok: bool,
16614 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
16615 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
16616 CResult_TxSignaturesDecodeErrorZ {
16617 contents: CResult_TxSignaturesDecodeErrorZPtr {
16618 result: Box::into_raw(Box::new(o)),
16624 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
16625 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
16626 CResult_TxSignaturesDecodeErrorZ {
16627 contents: CResult_TxSignaturesDecodeErrorZPtr {
16628 err: Box::into_raw(Box::new(e)),
16633 /// Checks if the given object is currently in the success state
16635 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
16639 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
16640 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
16641 impl Drop for CResult_TxSignaturesDecodeErrorZ {
16642 fn drop(&mut self) {
16643 if self.result_ok {
16644 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16645 let _ = unsafe { Box::from_raw(self.contents.result) };
16648 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16649 let _ = unsafe { Box::from_raw(self.contents.err) };
16654 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
16655 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
16656 let contents = if o.result_ok {
16657 let result = unsafe { o.contents.result };
16658 unsafe { o.contents.result = core::ptr::null_mut() };
16659 CResult_TxSignaturesDecodeErrorZPtr { result }
16661 let err = unsafe { o.contents.err };
16662 unsafe { o.contents.err = core::ptr::null_mut(); }
16663 CResult_TxSignaturesDecodeErrorZPtr { err }
16667 result_ok: o.result_ok,
16671 impl Clone for CResult_TxSignaturesDecodeErrorZ {
16672 fn clone(&self) -> Self {
16673 if self.result_ok {
16674 Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
16675 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
16678 Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
16679 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16685 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
16686 /// but with all dynamically-allocated buffers duplicated in new buffers.
16687 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
16689 /// The contents of CResult_TxInitRbfDecodeErrorZ
16690 pub union CResult_TxInitRbfDecodeErrorZPtr {
16691 /// A pointer to the contents in the success state.
16692 /// Reading from this pointer when `result_ok` is not set is undefined.
16693 pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
16694 /// A pointer to the contents in the error state.
16695 /// Reading from this pointer when `result_ok` is set is undefined.
16696 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16699 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
16700 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
16701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16702 pub struct CResult_TxInitRbfDecodeErrorZ {
16703 /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
16704 /// `err` or `result` depending on the state of `result_ok`.
16705 pub contents: CResult_TxInitRbfDecodeErrorZPtr,
16706 /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
16707 pub result_ok: bool,
16710 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
16711 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
16712 CResult_TxInitRbfDecodeErrorZ {
16713 contents: CResult_TxInitRbfDecodeErrorZPtr {
16714 result: Box::into_raw(Box::new(o)),
16720 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
16721 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
16722 CResult_TxInitRbfDecodeErrorZ {
16723 contents: CResult_TxInitRbfDecodeErrorZPtr {
16724 err: Box::into_raw(Box::new(e)),
16729 /// Checks if the given object is currently in the success state
16731 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
16735 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
16736 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
16737 impl Drop for CResult_TxInitRbfDecodeErrorZ {
16738 fn drop(&mut self) {
16739 if self.result_ok {
16740 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16741 let _ = unsafe { Box::from_raw(self.contents.result) };
16744 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16745 let _ = unsafe { Box::from_raw(self.contents.err) };
16750 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
16751 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
16752 let contents = if o.result_ok {
16753 let result = unsafe { o.contents.result };
16754 unsafe { o.contents.result = core::ptr::null_mut() };
16755 CResult_TxInitRbfDecodeErrorZPtr { result }
16757 let err = unsafe { o.contents.err };
16758 unsafe { o.contents.err = core::ptr::null_mut(); }
16759 CResult_TxInitRbfDecodeErrorZPtr { err }
16763 result_ok: o.result_ok,
16767 impl Clone for CResult_TxInitRbfDecodeErrorZ {
16768 fn clone(&self) -> Self {
16769 if self.result_ok {
16770 Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
16771 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
16774 Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
16775 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16781 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
16782 /// but with all dynamically-allocated buffers duplicated in new buffers.
16783 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
16785 /// The contents of CResult_TxAckRbfDecodeErrorZ
16786 pub union CResult_TxAckRbfDecodeErrorZPtr {
16787 /// A pointer to the contents in the success state.
16788 /// Reading from this pointer when `result_ok` is not set is undefined.
16789 pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
16790 /// A pointer to the contents in the error state.
16791 /// Reading from this pointer when `result_ok` is set is undefined.
16792 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16795 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
16796 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
16797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16798 pub struct CResult_TxAckRbfDecodeErrorZ {
16799 /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
16800 /// `err` or `result` depending on the state of `result_ok`.
16801 pub contents: CResult_TxAckRbfDecodeErrorZPtr,
16802 /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
16803 pub result_ok: bool,
16806 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
16807 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
16808 CResult_TxAckRbfDecodeErrorZ {
16809 contents: CResult_TxAckRbfDecodeErrorZPtr {
16810 result: Box::into_raw(Box::new(o)),
16816 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
16817 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
16818 CResult_TxAckRbfDecodeErrorZ {
16819 contents: CResult_TxAckRbfDecodeErrorZPtr {
16820 err: Box::into_raw(Box::new(e)),
16825 /// Checks if the given object is currently in the success state
16827 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
16831 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
16832 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
16833 impl Drop for CResult_TxAckRbfDecodeErrorZ {
16834 fn drop(&mut self) {
16835 if self.result_ok {
16836 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16837 let _ = unsafe { Box::from_raw(self.contents.result) };
16840 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16841 let _ = unsafe { Box::from_raw(self.contents.err) };
16846 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
16847 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
16848 let contents = if o.result_ok {
16849 let result = unsafe { o.contents.result };
16850 unsafe { o.contents.result = core::ptr::null_mut() };
16851 CResult_TxAckRbfDecodeErrorZPtr { result }
16853 let err = unsafe { o.contents.err };
16854 unsafe { o.contents.err = core::ptr::null_mut(); }
16855 CResult_TxAckRbfDecodeErrorZPtr { err }
16859 result_ok: o.result_ok,
16863 impl Clone for CResult_TxAckRbfDecodeErrorZ {
16864 fn clone(&self) -> Self {
16865 if self.result_ok {
16866 Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
16867 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
16870 Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
16871 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16877 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
16878 /// but with all dynamically-allocated buffers duplicated in new buffers.
16879 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
16881 /// The contents of CResult_TxAbortDecodeErrorZ
16882 pub union CResult_TxAbortDecodeErrorZPtr {
16883 /// A pointer to the contents in the success state.
16884 /// Reading from this pointer when `result_ok` is not set is undefined.
16885 pub result: *mut crate::lightning::ln::msgs::TxAbort,
16886 /// A pointer to the contents in the error state.
16887 /// Reading from this pointer when `result_ok` is set is undefined.
16888 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16891 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
16892 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
16893 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16894 pub struct CResult_TxAbortDecodeErrorZ {
16895 /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
16896 /// `err` or `result` depending on the state of `result_ok`.
16897 pub contents: CResult_TxAbortDecodeErrorZPtr,
16898 /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
16899 pub result_ok: bool,
16902 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
16903 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
16904 CResult_TxAbortDecodeErrorZ {
16905 contents: CResult_TxAbortDecodeErrorZPtr {
16906 result: Box::into_raw(Box::new(o)),
16912 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
16913 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
16914 CResult_TxAbortDecodeErrorZ {
16915 contents: CResult_TxAbortDecodeErrorZPtr {
16916 err: Box::into_raw(Box::new(e)),
16921 /// Checks if the given object is currently in the success state
16923 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
16927 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
16928 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
16929 impl Drop for CResult_TxAbortDecodeErrorZ {
16930 fn drop(&mut self) {
16931 if self.result_ok {
16932 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16933 let _ = unsafe { Box::from_raw(self.contents.result) };
16936 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16937 let _ = unsafe { Box::from_raw(self.contents.err) };
16942 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
16943 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
16944 let contents = if o.result_ok {
16945 let result = unsafe { o.contents.result };
16946 unsafe { o.contents.result = core::ptr::null_mut() };
16947 CResult_TxAbortDecodeErrorZPtr { result }
16949 let err = unsafe { o.contents.err };
16950 unsafe { o.contents.err = core::ptr::null_mut(); }
16951 CResult_TxAbortDecodeErrorZPtr { err }
16955 result_ok: o.result_ok,
16959 impl Clone for CResult_TxAbortDecodeErrorZ {
16960 fn clone(&self) -> Self {
16961 if self.result_ok {
16962 Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
16963 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
16966 Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
16967 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16973 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
16974 /// but with all dynamically-allocated buffers duplicated in new buffers.
16975 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
16977 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
16978 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
16979 /// A pointer to the contents in the success state.
16980 /// Reading from this pointer when `result_ok` is not set is undefined.
16981 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
16982 /// A pointer to the contents in the error state.
16983 /// Reading from this pointer when `result_ok` is set is undefined.
16984 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16987 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
16988 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
16989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16990 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
16991 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
16992 /// `err` or `result` depending on the state of `result_ok`.
16993 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
16994 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
16995 pub result_ok: bool,
16998 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
16999 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17000 CResult_AnnouncementSignaturesDecodeErrorZ {
17001 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17002 result: Box::into_raw(Box::new(o)),
17008 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
17009 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17010 CResult_AnnouncementSignaturesDecodeErrorZ {
17011 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17012 err: Box::into_raw(Box::new(e)),
17017 /// Checks if the given object is currently in the success state
17019 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
17023 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
17024 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
17025 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
17026 fn drop(&mut self) {
17027 if self.result_ok {
17028 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17029 let _ = unsafe { Box::from_raw(self.contents.result) };
17032 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17033 let _ = unsafe { Box::from_raw(self.contents.err) };
17038 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
17039 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
17040 let contents = if o.result_ok {
17041 let result = unsafe { o.contents.result };
17042 unsafe { o.contents.result = core::ptr::null_mut() };
17043 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
17045 let err = unsafe { o.contents.err };
17046 unsafe { o.contents.err = core::ptr::null_mut(); }
17047 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
17051 result_ok: o.result_ok,
17055 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
17056 fn clone(&self) -> Self {
17057 if self.result_ok {
17058 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17059 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
17062 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17063 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17069 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
17070 /// but with all dynamically-allocated buffers duplicated in new buffers.
17071 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
17073 /// The contents of CResult_ChannelReestablishDecodeErrorZ
17074 pub union CResult_ChannelReestablishDecodeErrorZPtr {
17075 /// A pointer to the contents in the success state.
17076 /// Reading from this pointer when `result_ok` is not set is undefined.
17077 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
17078 /// A pointer to the contents in the error state.
17079 /// Reading from this pointer when `result_ok` is set is undefined.
17080 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17083 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
17084 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
17085 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17086 pub struct CResult_ChannelReestablishDecodeErrorZ {
17087 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
17088 /// `err` or `result` depending on the state of `result_ok`.
17089 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
17090 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
17091 pub result_ok: bool,
17094 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
17095 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
17096 CResult_ChannelReestablishDecodeErrorZ {
17097 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17098 result: Box::into_raw(Box::new(o)),
17104 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
17105 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
17106 CResult_ChannelReestablishDecodeErrorZ {
17107 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17108 err: Box::into_raw(Box::new(e)),
17113 /// Checks if the given object is currently in the success state
17115 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
17119 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
17120 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
17121 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
17122 fn drop(&mut self) {
17123 if self.result_ok {
17124 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17125 let _ = unsafe { Box::from_raw(self.contents.result) };
17128 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17129 let _ = unsafe { Box::from_raw(self.contents.err) };
17134 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
17135 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
17136 let contents = if o.result_ok {
17137 let result = unsafe { o.contents.result };
17138 unsafe { o.contents.result = core::ptr::null_mut() };
17139 CResult_ChannelReestablishDecodeErrorZPtr { result }
17141 let err = unsafe { o.contents.err };
17142 unsafe { o.contents.err = core::ptr::null_mut(); }
17143 CResult_ChannelReestablishDecodeErrorZPtr { err }
17147 result_ok: o.result_ok,
17151 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
17152 fn clone(&self) -> Self {
17153 if self.result_ok {
17154 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17155 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
17158 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17159 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17165 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
17166 /// but with all dynamically-allocated buffers duplicated in new buffers.
17167 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
17169 /// The contents of CResult_ClosingSignedDecodeErrorZ
17170 pub union CResult_ClosingSignedDecodeErrorZPtr {
17171 /// A pointer to the contents in the success state.
17172 /// Reading from this pointer when `result_ok` is not set is undefined.
17173 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
17174 /// A pointer to the contents in the error state.
17175 /// Reading from this pointer when `result_ok` is set is undefined.
17176 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17179 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
17180 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17181 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17182 pub struct CResult_ClosingSignedDecodeErrorZ {
17183 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
17184 /// `err` or `result` depending on the state of `result_ok`.
17185 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
17186 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
17187 pub result_ok: bool,
17190 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
17191 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
17192 CResult_ClosingSignedDecodeErrorZ {
17193 contents: CResult_ClosingSignedDecodeErrorZPtr {
17194 result: Box::into_raw(Box::new(o)),
17200 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
17201 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
17202 CResult_ClosingSignedDecodeErrorZ {
17203 contents: CResult_ClosingSignedDecodeErrorZPtr {
17204 err: Box::into_raw(Box::new(e)),
17209 /// Checks if the given object is currently in the success state
17211 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
17215 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
17216 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
17217 impl Drop for CResult_ClosingSignedDecodeErrorZ {
17218 fn drop(&mut self) {
17219 if self.result_ok {
17220 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17221 let _ = unsafe { Box::from_raw(self.contents.result) };
17224 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17225 let _ = unsafe { Box::from_raw(self.contents.err) };
17230 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
17231 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17232 let contents = if o.result_ok {
17233 let result = unsafe { o.contents.result };
17234 unsafe { o.contents.result = core::ptr::null_mut() };
17235 CResult_ClosingSignedDecodeErrorZPtr { result }
17237 let err = unsafe { o.contents.err };
17238 unsafe { o.contents.err = core::ptr::null_mut(); }
17239 CResult_ClosingSignedDecodeErrorZPtr { err }
17243 result_ok: o.result_ok,
17247 impl Clone for CResult_ClosingSignedDecodeErrorZ {
17248 fn clone(&self) -> Self {
17249 if self.result_ok {
17250 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
17251 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
17254 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
17255 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17261 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
17262 /// but with all dynamically-allocated buffers duplicated in new buffers.
17263 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
17265 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
17266 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17267 /// A pointer to the contents in the success state.
17268 /// Reading from this pointer when `result_ok` is not set is undefined.
17269 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
17270 /// A pointer to the contents in the error state.
17271 /// Reading from this pointer when `result_ok` is set is undefined.
17272 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17275 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
17276 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17277 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17278 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
17279 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
17280 /// `err` or `result` depending on the state of `result_ok`.
17281 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
17282 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
17283 pub result_ok: bool,
17286 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
17287 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17288 CResult_ClosingSignedFeeRangeDecodeErrorZ {
17289 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17290 result: Box::into_raw(Box::new(o)),
17296 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
17297 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17298 CResult_ClosingSignedFeeRangeDecodeErrorZ {
17299 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17300 err: Box::into_raw(Box::new(e)),
17305 /// Checks if the given object is currently in the success state
17307 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
17311 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
17312 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
17313 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17314 fn drop(&mut self) {
17315 if self.result_ok {
17316 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17317 let _ = unsafe { Box::from_raw(self.contents.result) };
17320 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17321 let _ = unsafe { Box::from_raw(self.contents.err) };
17326 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17327 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17328 let contents = if o.result_ok {
17329 let result = unsafe { o.contents.result };
17330 unsafe { o.contents.result = core::ptr::null_mut() };
17331 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
17333 let err = unsafe { o.contents.err };
17334 unsafe { o.contents.err = core::ptr::null_mut(); }
17335 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
17339 result_ok: o.result_ok,
17343 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17344 fn clone(&self) -> Self {
17345 if self.result_ok {
17346 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17347 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
17350 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17351 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17357 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
17358 /// but with all dynamically-allocated buffers duplicated in new buffers.
17359 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
17361 /// The contents of CResult_CommitmentSignedDecodeErrorZ
17362 pub union CResult_CommitmentSignedDecodeErrorZPtr {
17363 /// A pointer to the contents in the success state.
17364 /// Reading from this pointer when `result_ok` is not set is undefined.
17365 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
17366 /// A pointer to the contents in the error state.
17367 /// Reading from this pointer when `result_ok` is set is undefined.
17368 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17371 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
17372 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17373 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17374 pub struct CResult_CommitmentSignedDecodeErrorZ {
17375 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
17376 /// `err` or `result` depending on the state of `result_ok`.
17377 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
17378 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
17379 pub result_ok: bool,
17382 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
17383 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
17384 CResult_CommitmentSignedDecodeErrorZ {
17385 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17386 result: Box::into_raw(Box::new(o)),
17392 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
17393 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
17394 CResult_CommitmentSignedDecodeErrorZ {
17395 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17396 err: Box::into_raw(Box::new(e)),
17401 /// Checks if the given object is currently in the success state
17403 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
17407 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
17408 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
17409 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
17410 fn drop(&mut self) {
17411 if self.result_ok {
17412 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17413 let _ = unsafe { Box::from_raw(self.contents.result) };
17416 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17417 let _ = unsafe { Box::from_raw(self.contents.err) };
17422 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
17423 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17424 let contents = if o.result_ok {
17425 let result = unsafe { o.contents.result };
17426 unsafe { o.contents.result = core::ptr::null_mut() };
17427 CResult_CommitmentSignedDecodeErrorZPtr { result }
17429 let err = unsafe { o.contents.err };
17430 unsafe { o.contents.err = core::ptr::null_mut(); }
17431 CResult_CommitmentSignedDecodeErrorZPtr { err }
17435 result_ok: o.result_ok,
17439 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
17440 fn clone(&self) -> Self {
17441 if self.result_ok {
17442 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17443 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
17446 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17447 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17453 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
17454 /// but with all dynamically-allocated buffers duplicated in new buffers.
17455 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
17457 /// The contents of CResult_FundingCreatedDecodeErrorZ
17458 pub union CResult_FundingCreatedDecodeErrorZPtr {
17459 /// A pointer to the contents in the success state.
17460 /// Reading from this pointer when `result_ok` is not set is undefined.
17461 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
17462 /// A pointer to the contents in the error state.
17463 /// Reading from this pointer when `result_ok` is set is undefined.
17464 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17467 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
17468 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
17469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17470 pub struct CResult_FundingCreatedDecodeErrorZ {
17471 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
17472 /// `err` or `result` depending on the state of `result_ok`.
17473 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
17474 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
17475 pub result_ok: bool,
17478 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
17479 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
17480 CResult_FundingCreatedDecodeErrorZ {
17481 contents: CResult_FundingCreatedDecodeErrorZPtr {
17482 result: Box::into_raw(Box::new(o)),
17488 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
17489 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
17490 CResult_FundingCreatedDecodeErrorZ {
17491 contents: CResult_FundingCreatedDecodeErrorZPtr {
17492 err: Box::into_raw(Box::new(e)),
17497 /// Checks if the given object is currently in the success state
17499 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
17503 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
17504 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
17505 impl Drop for CResult_FundingCreatedDecodeErrorZ {
17506 fn drop(&mut self) {
17507 if self.result_ok {
17508 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17509 let _ = unsafe { Box::from_raw(self.contents.result) };
17512 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17513 let _ = unsafe { Box::from_raw(self.contents.err) };
17518 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
17519 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
17520 let contents = if o.result_ok {
17521 let result = unsafe { o.contents.result };
17522 unsafe { o.contents.result = core::ptr::null_mut() };
17523 CResult_FundingCreatedDecodeErrorZPtr { result }
17525 let err = unsafe { o.contents.err };
17526 unsafe { o.contents.err = core::ptr::null_mut(); }
17527 CResult_FundingCreatedDecodeErrorZPtr { err }
17531 result_ok: o.result_ok,
17535 impl Clone for CResult_FundingCreatedDecodeErrorZ {
17536 fn clone(&self) -> Self {
17537 if self.result_ok {
17538 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
17539 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
17542 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
17543 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17549 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
17550 /// but with all dynamically-allocated buffers duplicated in new buffers.
17551 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
17553 /// The contents of CResult_FundingSignedDecodeErrorZ
17554 pub union CResult_FundingSignedDecodeErrorZPtr {
17555 /// A pointer to the contents in the success state.
17556 /// Reading from this pointer when `result_ok` is not set is undefined.
17557 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
17558 /// A pointer to the contents in the error state.
17559 /// Reading from this pointer when `result_ok` is set is undefined.
17560 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17563 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
17564 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17565 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17566 pub struct CResult_FundingSignedDecodeErrorZ {
17567 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
17568 /// `err` or `result` depending on the state of `result_ok`.
17569 pub contents: CResult_FundingSignedDecodeErrorZPtr,
17570 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
17571 pub result_ok: bool,
17574 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
17575 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
17576 CResult_FundingSignedDecodeErrorZ {
17577 contents: CResult_FundingSignedDecodeErrorZPtr {
17578 result: Box::into_raw(Box::new(o)),
17584 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
17585 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
17586 CResult_FundingSignedDecodeErrorZ {
17587 contents: CResult_FundingSignedDecodeErrorZPtr {
17588 err: Box::into_raw(Box::new(e)),
17593 /// Checks if the given object is currently in the success state
17595 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
17599 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
17600 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
17601 impl Drop for CResult_FundingSignedDecodeErrorZ {
17602 fn drop(&mut self) {
17603 if self.result_ok {
17604 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17605 let _ = unsafe { Box::from_raw(self.contents.result) };
17608 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17609 let _ = unsafe { Box::from_raw(self.contents.err) };
17614 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
17615 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17616 let contents = if o.result_ok {
17617 let result = unsafe { o.contents.result };
17618 unsafe { o.contents.result = core::ptr::null_mut() };
17619 CResult_FundingSignedDecodeErrorZPtr { result }
17621 let err = unsafe { o.contents.err };
17622 unsafe { o.contents.err = core::ptr::null_mut(); }
17623 CResult_FundingSignedDecodeErrorZPtr { err }
17627 result_ok: o.result_ok,
17631 impl Clone for CResult_FundingSignedDecodeErrorZ {
17632 fn clone(&self) -> Self {
17633 if self.result_ok {
17634 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
17635 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
17638 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
17639 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17645 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
17646 /// but with all dynamically-allocated buffers duplicated in new buffers.
17647 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
17649 /// The contents of CResult_ChannelReadyDecodeErrorZ
17650 pub union CResult_ChannelReadyDecodeErrorZPtr {
17651 /// A pointer to the contents in the success state.
17652 /// Reading from this pointer when `result_ok` is not set is undefined.
17653 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
17654 /// A pointer to the contents in the error state.
17655 /// Reading from this pointer when `result_ok` is set is undefined.
17656 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17659 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
17660 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
17661 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17662 pub struct CResult_ChannelReadyDecodeErrorZ {
17663 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
17664 /// `err` or `result` depending on the state of `result_ok`.
17665 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
17666 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
17667 pub result_ok: bool,
17670 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
17671 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
17672 CResult_ChannelReadyDecodeErrorZ {
17673 contents: CResult_ChannelReadyDecodeErrorZPtr {
17674 result: Box::into_raw(Box::new(o)),
17680 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
17681 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
17682 CResult_ChannelReadyDecodeErrorZ {
17683 contents: CResult_ChannelReadyDecodeErrorZPtr {
17684 err: Box::into_raw(Box::new(e)),
17689 /// Checks if the given object is currently in the success state
17691 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
17695 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
17696 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
17697 impl Drop for CResult_ChannelReadyDecodeErrorZ {
17698 fn drop(&mut self) {
17699 if self.result_ok {
17700 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17701 let _ = unsafe { Box::from_raw(self.contents.result) };
17704 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17705 let _ = unsafe { Box::from_raw(self.contents.err) };
17710 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
17711 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
17712 let contents = if o.result_ok {
17713 let result = unsafe { o.contents.result };
17714 unsafe { o.contents.result = core::ptr::null_mut() };
17715 CResult_ChannelReadyDecodeErrorZPtr { result }
17717 let err = unsafe { o.contents.err };
17718 unsafe { o.contents.err = core::ptr::null_mut(); }
17719 CResult_ChannelReadyDecodeErrorZPtr { err }
17723 result_ok: o.result_ok,
17727 impl Clone for CResult_ChannelReadyDecodeErrorZ {
17728 fn clone(&self) -> Self {
17729 if self.result_ok {
17730 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
17731 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
17734 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
17735 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17741 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
17742 /// but with all dynamically-allocated buffers duplicated in new buffers.
17743 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
17745 /// The contents of CResult_InitDecodeErrorZ
17746 pub union CResult_InitDecodeErrorZPtr {
17747 /// A pointer to the contents in the success state.
17748 /// Reading from this pointer when `result_ok` is not set is undefined.
17749 pub result: *mut crate::lightning::ln::msgs::Init,
17750 /// A pointer to the contents in the error state.
17751 /// Reading from this pointer when `result_ok` is set is undefined.
17752 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17755 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
17756 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
17757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17758 pub struct CResult_InitDecodeErrorZ {
17759 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
17760 /// `err` or `result` depending on the state of `result_ok`.
17761 pub contents: CResult_InitDecodeErrorZPtr,
17762 /// Whether this CResult_InitDecodeErrorZ represents a success state.
17763 pub result_ok: bool,
17766 /// Creates a new CResult_InitDecodeErrorZ in the success state.
17767 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
17768 CResult_InitDecodeErrorZ {
17769 contents: CResult_InitDecodeErrorZPtr {
17770 result: Box::into_raw(Box::new(o)),
17776 /// Creates a new CResult_InitDecodeErrorZ in the error state.
17777 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
17778 CResult_InitDecodeErrorZ {
17779 contents: CResult_InitDecodeErrorZPtr {
17780 err: Box::into_raw(Box::new(e)),
17785 /// Checks if the given object is currently in the success state
17787 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
17791 /// Frees any resources used by the CResult_InitDecodeErrorZ.
17792 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
17793 impl Drop for CResult_InitDecodeErrorZ {
17794 fn drop(&mut self) {
17795 if self.result_ok {
17796 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17797 let _ = unsafe { Box::from_raw(self.contents.result) };
17800 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17801 let _ = unsafe { Box::from_raw(self.contents.err) };
17806 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
17807 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
17808 let contents = if o.result_ok {
17809 let result = unsafe { o.contents.result };
17810 unsafe { o.contents.result = core::ptr::null_mut() };
17811 CResult_InitDecodeErrorZPtr { result }
17813 let err = unsafe { o.contents.err };
17814 unsafe { o.contents.err = core::ptr::null_mut(); }
17815 CResult_InitDecodeErrorZPtr { err }
17819 result_ok: o.result_ok,
17823 impl Clone for CResult_InitDecodeErrorZ {
17824 fn clone(&self) -> Self {
17825 if self.result_ok {
17826 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
17827 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
17830 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
17831 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17837 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
17838 /// but with all dynamically-allocated buffers duplicated in new buffers.
17839 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
17841 /// The contents of CResult_OpenChannelDecodeErrorZ
17842 pub union CResult_OpenChannelDecodeErrorZPtr {
17843 /// A pointer to the contents in the success state.
17844 /// Reading from this pointer when `result_ok` is not set is undefined.
17845 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
17846 /// A pointer to the contents in the error state.
17847 /// Reading from this pointer when `result_ok` is set is undefined.
17848 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17851 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
17852 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
17853 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17854 pub struct CResult_OpenChannelDecodeErrorZ {
17855 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
17856 /// `err` or `result` depending on the state of `result_ok`.
17857 pub contents: CResult_OpenChannelDecodeErrorZPtr,
17858 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
17859 pub result_ok: bool,
17862 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
17863 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
17864 CResult_OpenChannelDecodeErrorZ {
17865 contents: CResult_OpenChannelDecodeErrorZPtr {
17866 result: Box::into_raw(Box::new(o)),
17872 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
17873 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
17874 CResult_OpenChannelDecodeErrorZ {
17875 contents: CResult_OpenChannelDecodeErrorZPtr {
17876 err: Box::into_raw(Box::new(e)),
17881 /// Checks if the given object is currently in the success state
17883 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
17887 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
17888 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
17889 impl Drop for CResult_OpenChannelDecodeErrorZ {
17890 fn drop(&mut self) {
17891 if self.result_ok {
17892 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17893 let _ = unsafe { Box::from_raw(self.contents.result) };
17896 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17897 let _ = unsafe { Box::from_raw(self.contents.err) };
17902 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
17903 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
17904 let contents = if o.result_ok {
17905 let result = unsafe { o.contents.result };
17906 unsafe { o.contents.result = core::ptr::null_mut() };
17907 CResult_OpenChannelDecodeErrorZPtr { result }
17909 let err = unsafe { o.contents.err };
17910 unsafe { o.contents.err = core::ptr::null_mut(); }
17911 CResult_OpenChannelDecodeErrorZPtr { err }
17915 result_ok: o.result_ok,
17919 impl Clone for CResult_OpenChannelDecodeErrorZ {
17920 fn clone(&self) -> Self {
17921 if self.result_ok {
17922 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
17923 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
17926 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
17927 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17933 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
17934 /// but with all dynamically-allocated buffers duplicated in new buffers.
17935 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
17937 /// The contents of CResult_OpenChannelV2DecodeErrorZ
17938 pub union CResult_OpenChannelV2DecodeErrorZPtr {
17939 /// A pointer to the contents in the success state.
17940 /// Reading from this pointer when `result_ok` is not set is undefined.
17941 pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
17942 /// A pointer to the contents in the error state.
17943 /// Reading from this pointer when `result_ok` is set is undefined.
17944 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17947 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
17948 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
17949 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17950 pub struct CResult_OpenChannelV2DecodeErrorZ {
17951 /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
17952 /// `err` or `result` depending on the state of `result_ok`.
17953 pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
17954 /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
17955 pub result_ok: bool,
17958 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
17959 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
17960 CResult_OpenChannelV2DecodeErrorZ {
17961 contents: CResult_OpenChannelV2DecodeErrorZPtr {
17962 result: Box::into_raw(Box::new(o)),
17968 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
17969 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
17970 CResult_OpenChannelV2DecodeErrorZ {
17971 contents: CResult_OpenChannelV2DecodeErrorZPtr {
17972 err: Box::into_raw(Box::new(e)),
17977 /// Checks if the given object is currently in the success state
17979 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
17983 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
17984 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
17985 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
17986 fn drop(&mut self) {
17987 if self.result_ok {
17988 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17989 let _ = unsafe { Box::from_raw(self.contents.result) };
17992 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17993 let _ = unsafe { Box::from_raw(self.contents.err) };
17998 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
17999 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
18000 let contents = if o.result_ok {
18001 let result = unsafe { o.contents.result };
18002 unsafe { o.contents.result = core::ptr::null_mut() };
18003 CResult_OpenChannelV2DecodeErrorZPtr { result }
18005 let err = unsafe { o.contents.err };
18006 unsafe { o.contents.err = core::ptr::null_mut(); }
18007 CResult_OpenChannelV2DecodeErrorZPtr { err }
18011 result_ok: o.result_ok,
18015 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
18016 fn clone(&self) -> Self {
18017 if self.result_ok {
18018 Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18019 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
18022 Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18023 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18029 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
18030 /// but with all dynamically-allocated buffers duplicated in new buffers.
18031 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
18033 /// The contents of CResult_RevokeAndACKDecodeErrorZ
18034 pub union CResult_RevokeAndACKDecodeErrorZPtr {
18035 /// A pointer to the contents in the success state.
18036 /// Reading from this pointer when `result_ok` is not set is undefined.
18037 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
18038 /// A pointer to the contents in the error state.
18039 /// Reading from this pointer when `result_ok` is set is undefined.
18040 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18043 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
18044 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
18045 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18046 pub struct CResult_RevokeAndACKDecodeErrorZ {
18047 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
18048 /// `err` or `result` depending on the state of `result_ok`.
18049 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
18050 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
18051 pub result_ok: bool,
18054 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
18055 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
18056 CResult_RevokeAndACKDecodeErrorZ {
18057 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18058 result: Box::into_raw(Box::new(o)),
18064 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
18065 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
18066 CResult_RevokeAndACKDecodeErrorZ {
18067 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18068 err: Box::into_raw(Box::new(e)),
18073 /// Checks if the given object is currently in the success state
18075 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
18079 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
18080 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
18081 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
18082 fn drop(&mut self) {
18083 if self.result_ok {
18084 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18085 let _ = unsafe { Box::from_raw(self.contents.result) };
18088 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18089 let _ = unsafe { Box::from_raw(self.contents.err) };
18094 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
18095 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
18096 let contents = if o.result_ok {
18097 let result = unsafe { o.contents.result };
18098 unsafe { o.contents.result = core::ptr::null_mut() };
18099 CResult_RevokeAndACKDecodeErrorZPtr { result }
18101 let err = unsafe { o.contents.err };
18102 unsafe { o.contents.err = core::ptr::null_mut(); }
18103 CResult_RevokeAndACKDecodeErrorZPtr { err }
18107 result_ok: o.result_ok,
18111 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
18112 fn clone(&self) -> Self {
18113 if self.result_ok {
18114 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18115 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
18118 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18119 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18125 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
18126 /// but with all dynamically-allocated buffers duplicated in new buffers.
18127 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
18129 /// The contents of CResult_ShutdownDecodeErrorZ
18130 pub union CResult_ShutdownDecodeErrorZPtr {
18131 /// A pointer to the contents in the success state.
18132 /// Reading from this pointer when `result_ok` is not set is undefined.
18133 pub result: *mut crate::lightning::ln::msgs::Shutdown,
18134 /// A pointer to the contents in the error state.
18135 /// Reading from this pointer when `result_ok` is set is undefined.
18136 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18139 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
18140 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
18141 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18142 pub struct CResult_ShutdownDecodeErrorZ {
18143 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
18144 /// `err` or `result` depending on the state of `result_ok`.
18145 pub contents: CResult_ShutdownDecodeErrorZPtr,
18146 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
18147 pub result_ok: bool,
18150 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
18151 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
18152 CResult_ShutdownDecodeErrorZ {
18153 contents: CResult_ShutdownDecodeErrorZPtr {
18154 result: Box::into_raw(Box::new(o)),
18160 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
18161 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
18162 CResult_ShutdownDecodeErrorZ {
18163 contents: CResult_ShutdownDecodeErrorZPtr {
18164 err: Box::into_raw(Box::new(e)),
18169 /// Checks if the given object is currently in the success state
18171 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
18175 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
18176 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
18177 impl Drop for CResult_ShutdownDecodeErrorZ {
18178 fn drop(&mut self) {
18179 if self.result_ok {
18180 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18181 let _ = unsafe { Box::from_raw(self.contents.result) };
18184 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18185 let _ = unsafe { Box::from_raw(self.contents.err) };
18190 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
18191 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
18192 let contents = if o.result_ok {
18193 let result = unsafe { o.contents.result };
18194 unsafe { o.contents.result = core::ptr::null_mut() };
18195 CResult_ShutdownDecodeErrorZPtr { result }
18197 let err = unsafe { o.contents.err };
18198 unsafe { o.contents.err = core::ptr::null_mut(); }
18199 CResult_ShutdownDecodeErrorZPtr { err }
18203 result_ok: o.result_ok,
18207 impl Clone for CResult_ShutdownDecodeErrorZ {
18208 fn clone(&self) -> Self {
18209 if self.result_ok {
18210 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
18211 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
18214 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
18215 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18221 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
18222 /// but with all dynamically-allocated buffers duplicated in new buffers.
18223 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
18225 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
18226 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
18227 /// A pointer to the contents in the success state.
18228 /// Reading from this pointer when `result_ok` is not set is undefined.
18229 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
18230 /// A pointer to the contents in the error state.
18231 /// Reading from this pointer when `result_ok` is set is undefined.
18232 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18235 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
18236 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18238 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
18239 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
18240 /// `err` or `result` depending on the state of `result_ok`.
18241 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
18242 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
18243 pub result_ok: bool,
18246 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
18247 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
18248 CResult_UpdateFailHTLCDecodeErrorZ {
18249 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18250 result: Box::into_raw(Box::new(o)),
18256 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
18257 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
18258 CResult_UpdateFailHTLCDecodeErrorZ {
18259 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18260 err: Box::into_raw(Box::new(e)),
18265 /// Checks if the given object is currently in the success state
18267 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
18271 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
18272 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
18273 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
18274 fn drop(&mut self) {
18275 if self.result_ok {
18276 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18277 let _ = unsafe { Box::from_raw(self.contents.result) };
18280 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18281 let _ = unsafe { Box::from_raw(self.contents.err) };
18286 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
18287 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18288 let contents = if o.result_ok {
18289 let result = unsafe { o.contents.result };
18290 unsafe { o.contents.result = core::ptr::null_mut() };
18291 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
18293 let err = unsafe { o.contents.err };
18294 unsafe { o.contents.err = core::ptr::null_mut(); }
18295 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
18299 result_ok: o.result_ok,
18303 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
18304 fn clone(&self) -> Self {
18305 if self.result_ok {
18306 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18307 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
18310 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18311 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18317 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
18318 /// but with all dynamically-allocated buffers duplicated in new buffers.
18319 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
18321 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
18322 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18323 /// A pointer to the contents in the success state.
18324 /// Reading from this pointer when `result_ok` is not set is undefined.
18325 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
18326 /// A pointer to the contents in the error state.
18327 /// Reading from this pointer when `result_ok` is set is undefined.
18328 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18331 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
18332 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18333 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18334 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18335 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
18336 /// `err` or `result` depending on the state of `result_ok`.
18337 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
18338 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
18339 pub result_ok: bool,
18342 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
18343 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18344 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18345 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18346 result: Box::into_raw(Box::new(o)),
18352 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
18353 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18354 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18355 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18356 err: Box::into_raw(Box::new(e)),
18361 /// Checks if the given object is currently in the success state
18363 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
18367 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
18368 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
18369 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18370 fn drop(&mut self) {
18371 if self.result_ok {
18372 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18373 let _ = unsafe { Box::from_raw(self.contents.result) };
18376 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18377 let _ = unsafe { Box::from_raw(self.contents.err) };
18382 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18383 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18384 let contents = if o.result_ok {
18385 let result = unsafe { o.contents.result };
18386 unsafe { o.contents.result = core::ptr::null_mut() };
18387 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
18389 let err = unsafe { o.contents.err };
18390 unsafe { o.contents.err = core::ptr::null_mut(); }
18391 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
18395 result_ok: o.result_ok,
18399 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18400 fn clone(&self) -> Self {
18401 if self.result_ok {
18402 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18403 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
18406 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18407 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18413 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
18414 /// but with all dynamically-allocated buffers duplicated in new buffers.
18415 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
18417 /// The contents of CResult_UpdateFeeDecodeErrorZ
18418 pub union CResult_UpdateFeeDecodeErrorZPtr {
18419 /// A pointer to the contents in the success state.
18420 /// Reading from this pointer when `result_ok` is not set is undefined.
18421 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
18422 /// A pointer to the contents in the error state.
18423 /// Reading from this pointer when `result_ok` is set is undefined.
18424 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18427 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
18428 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
18429 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18430 pub struct CResult_UpdateFeeDecodeErrorZ {
18431 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
18432 /// `err` or `result` depending on the state of `result_ok`.
18433 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
18434 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
18435 pub result_ok: bool,
18438 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
18439 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
18440 CResult_UpdateFeeDecodeErrorZ {
18441 contents: CResult_UpdateFeeDecodeErrorZPtr {
18442 result: Box::into_raw(Box::new(o)),
18448 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
18449 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
18450 CResult_UpdateFeeDecodeErrorZ {
18451 contents: CResult_UpdateFeeDecodeErrorZPtr {
18452 err: Box::into_raw(Box::new(e)),
18457 /// Checks if the given object is currently in the success state
18459 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
18463 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
18464 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
18465 impl Drop for CResult_UpdateFeeDecodeErrorZ {
18466 fn drop(&mut self) {
18467 if self.result_ok {
18468 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18469 let _ = unsafe { Box::from_raw(self.contents.result) };
18472 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18473 let _ = unsafe { Box::from_raw(self.contents.err) };
18478 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
18479 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
18480 let contents = if o.result_ok {
18481 let result = unsafe { o.contents.result };
18482 unsafe { o.contents.result = core::ptr::null_mut() };
18483 CResult_UpdateFeeDecodeErrorZPtr { result }
18485 let err = unsafe { o.contents.err };
18486 unsafe { o.contents.err = core::ptr::null_mut(); }
18487 CResult_UpdateFeeDecodeErrorZPtr { err }
18491 result_ok: o.result_ok,
18495 impl Clone for CResult_UpdateFeeDecodeErrorZ {
18496 fn clone(&self) -> Self {
18497 if self.result_ok {
18498 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
18499 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
18502 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
18503 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18509 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
18510 /// but with all dynamically-allocated buffers duplicated in new buffers.
18511 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
18513 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
18514 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18515 /// A pointer to the contents in the success state.
18516 /// Reading from this pointer when `result_ok` is not set is undefined.
18517 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
18518 /// A pointer to the contents in the error state.
18519 /// Reading from this pointer when `result_ok` is set is undefined.
18520 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18523 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
18524 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18526 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
18527 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
18528 /// `err` or `result` depending on the state of `result_ok`.
18529 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
18530 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
18531 pub result_ok: bool,
18534 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
18535 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18536 CResult_UpdateFulfillHTLCDecodeErrorZ {
18537 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18538 result: Box::into_raw(Box::new(o)),
18544 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
18545 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18546 CResult_UpdateFulfillHTLCDecodeErrorZ {
18547 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18548 err: Box::into_raw(Box::new(e)),
18553 /// Checks if the given object is currently in the success state
18555 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
18559 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
18560 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
18561 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
18562 fn drop(&mut self) {
18563 if self.result_ok {
18564 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18565 let _ = unsafe { Box::from_raw(self.contents.result) };
18568 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18569 let _ = unsafe { Box::from_raw(self.contents.err) };
18574 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
18575 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18576 let contents = if o.result_ok {
18577 let result = unsafe { o.contents.result };
18578 unsafe { o.contents.result = core::ptr::null_mut() };
18579 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
18581 let err = unsafe { o.contents.err };
18582 unsafe { o.contents.err = core::ptr::null_mut(); }
18583 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
18587 result_ok: o.result_ok,
18591 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
18592 fn clone(&self) -> Self {
18593 if self.result_ok {
18594 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18595 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
18598 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18599 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18605 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
18606 /// but with all dynamically-allocated buffers duplicated in new buffers.
18607 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
18609 /// The contents of CResult_OnionPacketDecodeErrorZ
18610 pub union CResult_OnionPacketDecodeErrorZPtr {
18611 /// A pointer to the contents in the success state.
18612 /// Reading from this pointer when `result_ok` is not set is undefined.
18613 pub result: *mut crate::lightning::ln::msgs::OnionPacket,
18614 /// A pointer to the contents in the error state.
18615 /// Reading from this pointer when `result_ok` is set is undefined.
18616 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18619 /// A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation,
18620 /// containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure.
18621 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18622 pub struct CResult_OnionPacketDecodeErrorZ {
18623 /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either
18624 /// `err` or `result` depending on the state of `result_ok`.
18625 pub contents: CResult_OnionPacketDecodeErrorZPtr,
18626 /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state.
18627 pub result_ok: bool,
18630 /// Creates a new CResult_OnionPacketDecodeErrorZ in the success state.
18631 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ {
18632 CResult_OnionPacketDecodeErrorZ {
18633 contents: CResult_OnionPacketDecodeErrorZPtr {
18634 result: Box::into_raw(Box::new(o)),
18640 /// Creates a new CResult_OnionPacketDecodeErrorZ in the error state.
18641 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ {
18642 CResult_OnionPacketDecodeErrorZ {
18643 contents: CResult_OnionPacketDecodeErrorZPtr {
18644 err: Box::into_raw(Box::new(e)),
18649 /// Checks if the given object is currently in the success state
18651 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool {
18655 /// Frees any resources used by the CResult_OnionPacketDecodeErrorZ.
18656 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { }
18657 impl Drop for CResult_OnionPacketDecodeErrorZ {
18658 fn drop(&mut self) {
18659 if self.result_ok {
18660 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18661 let _ = unsafe { Box::from_raw(self.contents.result) };
18664 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18665 let _ = unsafe { Box::from_raw(self.contents.err) };
18670 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionPacketDecodeErrorZ {
18671 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>) -> Self {
18672 let contents = if o.result_ok {
18673 let result = unsafe { o.contents.result };
18674 unsafe { o.contents.result = core::ptr::null_mut() };
18675 CResult_OnionPacketDecodeErrorZPtr { result }
18677 let err = unsafe { o.contents.err };
18678 unsafe { o.contents.err = core::ptr::null_mut(); }
18679 CResult_OnionPacketDecodeErrorZPtr { err }
18683 result_ok: o.result_ok,
18687 impl Clone for CResult_OnionPacketDecodeErrorZ {
18688 fn clone(&self) -> Self {
18689 if self.result_ok {
18690 Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr {
18691 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionPacket>::clone(unsafe { &*self.contents.result })))
18694 Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr {
18695 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18701 /// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig`
18702 /// but with all dynamically-allocated buffers duplicated in new buffers.
18703 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) }
18705 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
18706 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
18707 /// A pointer to the contents in the success state.
18708 /// Reading from this pointer when `result_ok` is not set is undefined.
18709 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
18710 /// A pointer to the contents in the error state.
18711 /// Reading from this pointer when `result_ok` is set is undefined.
18712 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18715 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
18716 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18718 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
18719 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
18720 /// `err` or `result` depending on the state of `result_ok`.
18721 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
18722 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
18723 pub result_ok: bool,
18726 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
18727 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
18728 CResult_UpdateAddHTLCDecodeErrorZ {
18729 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18730 result: Box::into_raw(Box::new(o)),
18736 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
18737 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
18738 CResult_UpdateAddHTLCDecodeErrorZ {
18739 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18740 err: Box::into_raw(Box::new(e)),
18745 /// Checks if the given object is currently in the success state
18747 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
18751 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
18752 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
18753 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
18754 fn drop(&mut self) {
18755 if self.result_ok {
18756 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18757 let _ = unsafe { Box::from_raw(self.contents.result) };
18760 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18761 let _ = unsafe { Box::from_raw(self.contents.err) };
18766 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
18767 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18768 let contents = if o.result_ok {
18769 let result = unsafe { o.contents.result };
18770 unsafe { o.contents.result = core::ptr::null_mut() };
18771 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
18773 let err = unsafe { o.contents.err };
18774 unsafe { o.contents.err = core::ptr::null_mut(); }
18775 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
18779 result_ok: o.result_ok,
18783 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
18784 fn clone(&self) -> Self {
18785 if self.result_ok {
18786 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18787 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
18790 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18791 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18797 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
18798 /// but with all dynamically-allocated buffers duplicated in new buffers.
18799 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
18801 /// The contents of CResult_OnionMessageDecodeErrorZ
18802 pub union CResult_OnionMessageDecodeErrorZPtr {
18803 /// A pointer to the contents in the success state.
18804 /// Reading from this pointer when `result_ok` is not set is undefined.
18805 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
18806 /// A pointer to the contents in the error state.
18807 /// Reading from this pointer when `result_ok` is set is undefined.
18808 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18811 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
18812 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
18813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18814 pub struct CResult_OnionMessageDecodeErrorZ {
18815 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
18816 /// `err` or `result` depending on the state of `result_ok`.
18817 pub contents: CResult_OnionMessageDecodeErrorZPtr,
18818 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
18819 pub result_ok: bool,
18822 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
18823 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
18824 CResult_OnionMessageDecodeErrorZ {
18825 contents: CResult_OnionMessageDecodeErrorZPtr {
18826 result: Box::into_raw(Box::new(o)),
18832 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
18833 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
18834 CResult_OnionMessageDecodeErrorZ {
18835 contents: CResult_OnionMessageDecodeErrorZPtr {
18836 err: Box::into_raw(Box::new(e)),
18841 /// Checks if the given object is currently in the success state
18843 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
18847 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
18848 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
18849 impl Drop for CResult_OnionMessageDecodeErrorZ {
18850 fn drop(&mut self) {
18851 if self.result_ok {
18852 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18853 let _ = unsafe { Box::from_raw(self.contents.result) };
18856 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18857 let _ = unsafe { Box::from_raw(self.contents.err) };
18862 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
18863 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
18864 let contents = if o.result_ok {
18865 let result = unsafe { o.contents.result };
18866 unsafe { o.contents.result = core::ptr::null_mut() };
18867 CResult_OnionMessageDecodeErrorZPtr { result }
18869 let err = unsafe { o.contents.err };
18870 unsafe { o.contents.err = core::ptr::null_mut(); }
18871 CResult_OnionMessageDecodeErrorZPtr { err }
18875 result_ok: o.result_ok,
18879 impl Clone for CResult_OnionMessageDecodeErrorZ {
18880 fn clone(&self) -> Self {
18881 if self.result_ok {
18882 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
18883 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
18886 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
18887 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18893 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
18894 /// but with all dynamically-allocated buffers duplicated in new buffers.
18895 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
18897 /// The contents of CResult_FinalOnionHopDataDecodeErrorZ
18898 pub union CResult_FinalOnionHopDataDecodeErrorZPtr {
18899 /// A pointer to the contents in the success state.
18900 /// Reading from this pointer when `result_ok` is not set is undefined.
18901 pub result: *mut crate::lightning::ln::msgs::FinalOnionHopData,
18902 /// A pointer to the contents in the error state.
18903 /// Reading from this pointer when `result_ok` is set is undefined.
18904 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18907 /// A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation,
18908 /// containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure.
18909 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18910 pub struct CResult_FinalOnionHopDataDecodeErrorZ {
18911 /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either
18912 /// `err` or `result` depending on the state of `result_ok`.
18913 pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr,
18914 /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state.
18915 pub result_ok: bool,
18918 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state.
18919 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ {
18920 CResult_FinalOnionHopDataDecodeErrorZ {
18921 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
18922 result: Box::into_raw(Box::new(o)),
18928 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state.
18929 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ {
18930 CResult_FinalOnionHopDataDecodeErrorZ {
18931 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
18932 err: Box::into_raw(Box::new(e)),
18937 /// Checks if the given object is currently in the success state
18939 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool {
18943 /// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ.
18944 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { }
18945 impl Drop for CResult_FinalOnionHopDataDecodeErrorZ {
18946 fn drop(&mut self) {
18947 if self.result_ok {
18948 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18949 let _ = unsafe { Box::from_raw(self.contents.result) };
18952 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18953 let _ = unsafe { Box::from_raw(self.contents.err) };
18958 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>> for CResult_FinalOnionHopDataDecodeErrorZ {
18959 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>) -> Self {
18960 let contents = if o.result_ok {
18961 let result = unsafe { o.contents.result };
18962 unsafe { o.contents.result = core::ptr::null_mut() };
18963 CResult_FinalOnionHopDataDecodeErrorZPtr { result }
18965 let err = unsafe { o.contents.err };
18966 unsafe { o.contents.err = core::ptr::null_mut(); }
18967 CResult_FinalOnionHopDataDecodeErrorZPtr { err }
18971 result_ok: o.result_ok,
18975 impl Clone for CResult_FinalOnionHopDataDecodeErrorZ {
18976 fn clone(&self) -> Self {
18977 if self.result_ok {
18978 Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
18979 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FinalOnionHopData>::clone(unsafe { &*self.contents.result })))
18982 Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
18983 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18989 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig`
18990 /// but with all dynamically-allocated buffers duplicated in new buffers.
18991 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) }
18993 /// The contents of CResult_PingDecodeErrorZ
18994 pub union CResult_PingDecodeErrorZPtr {
18995 /// A pointer to the contents in the success state.
18996 /// Reading from this pointer when `result_ok` is not set is undefined.
18997 pub result: *mut crate::lightning::ln::msgs::Ping,
18998 /// A pointer to the contents in the error state.
18999 /// Reading from this pointer when `result_ok` is set is undefined.
19000 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19003 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
19004 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
19005 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19006 pub struct CResult_PingDecodeErrorZ {
19007 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
19008 /// `err` or `result` depending on the state of `result_ok`.
19009 pub contents: CResult_PingDecodeErrorZPtr,
19010 /// Whether this CResult_PingDecodeErrorZ represents a success state.
19011 pub result_ok: bool,
19014 /// Creates a new CResult_PingDecodeErrorZ in the success state.
19015 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
19016 CResult_PingDecodeErrorZ {
19017 contents: CResult_PingDecodeErrorZPtr {
19018 result: Box::into_raw(Box::new(o)),
19024 /// Creates a new CResult_PingDecodeErrorZ in the error state.
19025 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
19026 CResult_PingDecodeErrorZ {
19027 contents: CResult_PingDecodeErrorZPtr {
19028 err: Box::into_raw(Box::new(e)),
19033 /// Checks if the given object is currently in the success state
19035 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
19039 /// Frees any resources used by the CResult_PingDecodeErrorZ.
19040 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
19041 impl Drop for CResult_PingDecodeErrorZ {
19042 fn drop(&mut self) {
19043 if self.result_ok {
19044 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19045 let _ = unsafe { Box::from_raw(self.contents.result) };
19048 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19049 let _ = unsafe { Box::from_raw(self.contents.err) };
19054 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
19055 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
19056 let contents = if o.result_ok {
19057 let result = unsafe { o.contents.result };
19058 unsafe { o.contents.result = core::ptr::null_mut() };
19059 CResult_PingDecodeErrorZPtr { result }
19061 let err = unsafe { o.contents.err };
19062 unsafe { o.contents.err = core::ptr::null_mut(); }
19063 CResult_PingDecodeErrorZPtr { err }
19067 result_ok: o.result_ok,
19071 impl Clone for CResult_PingDecodeErrorZ {
19072 fn clone(&self) -> Self {
19073 if self.result_ok {
19074 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
19075 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
19078 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
19079 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19085 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
19086 /// but with all dynamically-allocated buffers duplicated in new buffers.
19087 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
19089 /// The contents of CResult_PongDecodeErrorZ
19090 pub union CResult_PongDecodeErrorZPtr {
19091 /// A pointer to the contents in the success state.
19092 /// Reading from this pointer when `result_ok` is not set is undefined.
19093 pub result: *mut crate::lightning::ln::msgs::Pong,
19094 /// A pointer to the contents in the error state.
19095 /// Reading from this pointer when `result_ok` is set is undefined.
19096 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19099 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
19100 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
19101 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19102 pub struct CResult_PongDecodeErrorZ {
19103 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
19104 /// `err` or `result` depending on the state of `result_ok`.
19105 pub contents: CResult_PongDecodeErrorZPtr,
19106 /// Whether this CResult_PongDecodeErrorZ represents a success state.
19107 pub result_ok: bool,
19110 /// Creates a new CResult_PongDecodeErrorZ in the success state.
19111 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
19112 CResult_PongDecodeErrorZ {
19113 contents: CResult_PongDecodeErrorZPtr {
19114 result: Box::into_raw(Box::new(o)),
19120 /// Creates a new CResult_PongDecodeErrorZ in the error state.
19121 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
19122 CResult_PongDecodeErrorZ {
19123 contents: CResult_PongDecodeErrorZPtr {
19124 err: Box::into_raw(Box::new(e)),
19129 /// Checks if the given object is currently in the success state
19131 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
19135 /// Frees any resources used by the CResult_PongDecodeErrorZ.
19136 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
19137 impl Drop for CResult_PongDecodeErrorZ {
19138 fn drop(&mut self) {
19139 if self.result_ok {
19140 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19141 let _ = unsafe { Box::from_raw(self.contents.result) };
19144 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19145 let _ = unsafe { Box::from_raw(self.contents.err) };
19150 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
19151 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
19152 let contents = if o.result_ok {
19153 let result = unsafe { o.contents.result };
19154 unsafe { o.contents.result = core::ptr::null_mut() };
19155 CResult_PongDecodeErrorZPtr { result }
19157 let err = unsafe { o.contents.err };
19158 unsafe { o.contents.err = core::ptr::null_mut(); }
19159 CResult_PongDecodeErrorZPtr { err }
19163 result_ok: o.result_ok,
19167 impl Clone for CResult_PongDecodeErrorZ {
19168 fn clone(&self) -> Self {
19169 if self.result_ok {
19170 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
19171 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
19174 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
19175 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19181 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
19182 /// but with all dynamically-allocated buffers duplicated in new buffers.
19183 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
19185 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
19186 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19187 /// A pointer to the contents in the success state.
19188 /// Reading from this pointer when `result_ok` is not set is undefined.
19189 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
19190 /// A pointer to the contents in the error state.
19191 /// Reading from this pointer when `result_ok` is set is undefined.
19192 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19195 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19196 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19198 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19199 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
19200 /// `err` or `result` depending on the state of `result_ok`.
19201 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
19202 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
19203 pub result_ok: bool,
19206 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
19207 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19208 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19209 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19210 result: Box::into_raw(Box::new(o)),
19216 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
19217 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19218 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19219 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19220 err: Box::into_raw(Box::new(e)),
19225 /// Checks if the given object is currently in the success state
19227 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
19231 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
19232 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
19233 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19234 fn drop(&mut self) {
19235 if self.result_ok {
19236 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19237 let _ = unsafe { Box::from_raw(self.contents.result) };
19240 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19241 let _ = unsafe { Box::from_raw(self.contents.err) };
19246 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19247 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19248 let contents = if o.result_ok {
19249 let result = unsafe { o.contents.result };
19250 unsafe { o.contents.result = core::ptr::null_mut() };
19251 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
19253 let err = unsafe { o.contents.err };
19254 unsafe { o.contents.err = core::ptr::null_mut(); }
19255 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
19259 result_ok: o.result_ok,
19263 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19264 fn clone(&self) -> Self {
19265 if self.result_ok {
19266 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19267 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19270 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19271 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19277 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19278 /// but with all dynamically-allocated buffers duplicated in new buffers.
19279 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19281 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
19282 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
19283 /// A pointer to the contents in the success state.
19284 /// Reading from this pointer when `result_ok` is not set is undefined.
19285 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
19286 /// A pointer to the contents in the error state.
19287 /// Reading from this pointer when `result_ok` is set is undefined.
19288 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19291 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19292 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19294 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
19295 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
19296 /// `err` or `result` depending on the state of `result_ok`.
19297 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
19298 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
19299 pub result_ok: bool,
19302 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
19303 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
19304 CResult_ChannelAnnouncementDecodeErrorZ {
19305 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19306 result: Box::into_raw(Box::new(o)),
19312 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
19313 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
19314 CResult_ChannelAnnouncementDecodeErrorZ {
19315 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19316 err: Box::into_raw(Box::new(e)),
19321 /// Checks if the given object is currently in the success state
19323 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
19327 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
19328 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
19329 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
19330 fn drop(&mut self) {
19331 if self.result_ok {
19332 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19333 let _ = unsafe { Box::from_raw(self.contents.result) };
19336 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19337 let _ = unsafe { Box::from_raw(self.contents.err) };
19342 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
19343 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19344 let contents = if o.result_ok {
19345 let result = unsafe { o.contents.result };
19346 unsafe { o.contents.result = core::ptr::null_mut() };
19347 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
19349 let err = unsafe { o.contents.err };
19350 unsafe { o.contents.err = core::ptr::null_mut(); }
19351 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
19355 result_ok: o.result_ok,
19359 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
19360 fn clone(&self) -> Self {
19361 if self.result_ok {
19362 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19363 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19366 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19367 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19373 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19374 /// but with all dynamically-allocated buffers duplicated in new buffers.
19375 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19377 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
19378 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19379 /// A pointer to the contents in the success state.
19380 /// Reading from this pointer when `result_ok` is not set is undefined.
19381 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
19382 /// A pointer to the contents in the error state.
19383 /// Reading from this pointer when `result_ok` is set is undefined.
19384 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19387 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19388 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19389 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19390 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
19391 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
19392 /// `err` or `result` depending on the state of `result_ok`.
19393 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
19394 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
19395 pub result_ok: bool,
19398 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
19399 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19400 CResult_UnsignedChannelUpdateDecodeErrorZ {
19401 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19402 result: Box::into_raw(Box::new(o)),
19408 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
19409 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19410 CResult_UnsignedChannelUpdateDecodeErrorZ {
19411 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19412 err: Box::into_raw(Box::new(e)),
19417 /// Checks if the given object is currently in the success state
19419 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
19423 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
19424 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
19425 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
19426 fn drop(&mut self) {
19427 if self.result_ok {
19428 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19429 let _ = unsafe { Box::from_raw(self.contents.result) };
19432 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19433 let _ = unsafe { Box::from_raw(self.contents.err) };
19438 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
19439 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19440 let contents = if o.result_ok {
19441 let result = unsafe { o.contents.result };
19442 unsafe { o.contents.result = core::ptr::null_mut() };
19443 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
19445 let err = unsafe { o.contents.err };
19446 unsafe { o.contents.err = core::ptr::null_mut(); }
19447 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
19451 result_ok: o.result_ok,
19455 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
19456 fn clone(&self) -> Self {
19457 if self.result_ok {
19458 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19459 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
19462 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19463 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19469 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
19470 /// but with all dynamically-allocated buffers duplicated in new buffers.
19471 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19473 /// The contents of CResult_ChannelUpdateDecodeErrorZ
19474 pub union CResult_ChannelUpdateDecodeErrorZPtr {
19475 /// A pointer to the contents in the success state.
19476 /// Reading from this pointer when `result_ok` is not set is undefined.
19477 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
19478 /// A pointer to the contents in the error state.
19479 /// Reading from this pointer when `result_ok` is set is undefined.
19480 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19483 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19484 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19485 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19486 pub struct CResult_ChannelUpdateDecodeErrorZ {
19487 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
19488 /// `err` or `result` depending on the state of `result_ok`.
19489 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
19490 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
19491 pub result_ok: bool,
19494 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
19495 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
19496 CResult_ChannelUpdateDecodeErrorZ {
19497 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19498 result: Box::into_raw(Box::new(o)),
19504 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
19505 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
19506 CResult_ChannelUpdateDecodeErrorZ {
19507 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19508 err: Box::into_raw(Box::new(e)),
19513 /// Checks if the given object is currently in the success state
19515 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
19519 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
19520 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
19521 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
19522 fn drop(&mut self) {
19523 if self.result_ok {
19524 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19525 let _ = unsafe { Box::from_raw(self.contents.result) };
19528 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19529 let _ = unsafe { Box::from_raw(self.contents.err) };
19534 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
19535 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19536 let contents = if o.result_ok {
19537 let result = unsafe { o.contents.result };
19538 unsafe { o.contents.result = core::ptr::null_mut() };
19539 CResult_ChannelUpdateDecodeErrorZPtr { result }
19541 let err = unsafe { o.contents.err };
19542 unsafe { o.contents.err = core::ptr::null_mut(); }
19543 CResult_ChannelUpdateDecodeErrorZPtr { err }
19547 result_ok: o.result_ok,
19551 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
19552 fn clone(&self) -> Self {
19553 if self.result_ok {
19554 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19555 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
19558 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19559 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19565 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
19566 /// but with all dynamically-allocated buffers duplicated in new buffers.
19567 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19569 /// The contents of CResult_ErrorMessageDecodeErrorZ
19570 pub union CResult_ErrorMessageDecodeErrorZPtr {
19571 /// A pointer to the contents in the success state.
19572 /// Reading from this pointer when `result_ok` is not set is undefined.
19573 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
19574 /// A pointer to the contents in the error state.
19575 /// Reading from this pointer when `result_ok` is set is undefined.
19576 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19579 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
19580 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19582 pub struct CResult_ErrorMessageDecodeErrorZ {
19583 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
19584 /// `err` or `result` depending on the state of `result_ok`.
19585 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
19586 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
19587 pub result_ok: bool,
19590 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
19591 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
19592 CResult_ErrorMessageDecodeErrorZ {
19593 contents: CResult_ErrorMessageDecodeErrorZPtr {
19594 result: Box::into_raw(Box::new(o)),
19600 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
19601 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
19602 CResult_ErrorMessageDecodeErrorZ {
19603 contents: CResult_ErrorMessageDecodeErrorZPtr {
19604 err: Box::into_raw(Box::new(e)),
19609 /// Checks if the given object is currently in the success state
19611 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
19615 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
19616 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
19617 impl Drop for CResult_ErrorMessageDecodeErrorZ {
19618 fn drop(&mut self) {
19619 if self.result_ok {
19620 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19621 let _ = unsafe { Box::from_raw(self.contents.result) };
19624 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19625 let _ = unsafe { Box::from_raw(self.contents.err) };
19630 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
19631 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19632 let contents = if o.result_ok {
19633 let result = unsafe { o.contents.result };
19634 unsafe { o.contents.result = core::ptr::null_mut() };
19635 CResult_ErrorMessageDecodeErrorZPtr { result }
19637 let err = unsafe { o.contents.err };
19638 unsafe { o.contents.err = core::ptr::null_mut(); }
19639 CResult_ErrorMessageDecodeErrorZPtr { err }
19643 result_ok: o.result_ok,
19647 impl Clone for CResult_ErrorMessageDecodeErrorZ {
19648 fn clone(&self) -> Self {
19649 if self.result_ok {
19650 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
19651 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
19654 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
19655 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19661 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
19662 /// but with all dynamically-allocated buffers duplicated in new buffers.
19663 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
19665 /// The contents of CResult_WarningMessageDecodeErrorZ
19666 pub union CResult_WarningMessageDecodeErrorZPtr {
19667 /// A pointer to the contents in the success state.
19668 /// Reading from this pointer when `result_ok` is not set is undefined.
19669 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
19670 /// A pointer to the contents in the error state.
19671 /// Reading from this pointer when `result_ok` is set is undefined.
19672 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19675 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
19676 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19678 pub struct CResult_WarningMessageDecodeErrorZ {
19679 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
19680 /// `err` or `result` depending on the state of `result_ok`.
19681 pub contents: CResult_WarningMessageDecodeErrorZPtr,
19682 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
19683 pub result_ok: bool,
19686 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
19687 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
19688 CResult_WarningMessageDecodeErrorZ {
19689 contents: CResult_WarningMessageDecodeErrorZPtr {
19690 result: Box::into_raw(Box::new(o)),
19696 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
19697 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
19698 CResult_WarningMessageDecodeErrorZ {
19699 contents: CResult_WarningMessageDecodeErrorZPtr {
19700 err: Box::into_raw(Box::new(e)),
19705 /// Checks if the given object is currently in the success state
19707 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
19711 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
19712 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
19713 impl Drop for CResult_WarningMessageDecodeErrorZ {
19714 fn drop(&mut self) {
19715 if self.result_ok {
19716 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19717 let _ = unsafe { Box::from_raw(self.contents.result) };
19720 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19721 let _ = unsafe { Box::from_raw(self.contents.err) };
19726 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
19727 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19728 let contents = if o.result_ok {
19729 let result = unsafe { o.contents.result };
19730 unsafe { o.contents.result = core::ptr::null_mut() };
19731 CResult_WarningMessageDecodeErrorZPtr { result }
19733 let err = unsafe { o.contents.err };
19734 unsafe { o.contents.err = core::ptr::null_mut(); }
19735 CResult_WarningMessageDecodeErrorZPtr { err }
19739 result_ok: o.result_ok,
19743 impl Clone for CResult_WarningMessageDecodeErrorZ {
19744 fn clone(&self) -> Self {
19745 if self.result_ok {
19746 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
19747 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
19750 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
19751 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19757 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
19758 /// but with all dynamically-allocated buffers duplicated in new buffers.
19759 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
19761 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
19762 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19763 /// A pointer to the contents in the success state.
19764 /// Reading from this pointer when `result_ok` is not set is undefined.
19765 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
19766 /// A pointer to the contents in the error state.
19767 /// Reading from this pointer when `result_ok` is set is undefined.
19768 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19771 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
19772 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19774 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19775 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
19776 /// `err` or `result` depending on the state of `result_ok`.
19777 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
19778 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
19779 pub result_ok: bool,
19782 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
19783 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19784 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19785 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19786 result: Box::into_raw(Box::new(o)),
19792 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
19793 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19794 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19795 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19796 err: Box::into_raw(Box::new(e)),
19801 /// Checks if the given object is currently in the success state
19803 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
19807 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
19808 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
19809 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19810 fn drop(&mut self) {
19811 if self.result_ok {
19812 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19813 let _ = unsafe { Box::from_raw(self.contents.result) };
19816 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19817 let _ = unsafe { Box::from_raw(self.contents.err) };
19822 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19823 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19824 let contents = if o.result_ok {
19825 let result = unsafe { o.contents.result };
19826 unsafe { o.contents.result = core::ptr::null_mut() };
19827 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
19829 let err = unsafe { o.contents.err };
19830 unsafe { o.contents.err = core::ptr::null_mut(); }
19831 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
19835 result_ok: o.result_ok,
19839 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19840 fn clone(&self) -> Self {
19841 if self.result_ok {
19842 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19843 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
19846 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19847 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19853 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
19854 /// but with all dynamically-allocated buffers duplicated in new buffers.
19855 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19857 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
19858 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
19859 /// A pointer to the contents in the success state.
19860 /// Reading from this pointer when `result_ok` is not set is undefined.
19861 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
19862 /// A pointer to the contents in the error state.
19863 /// Reading from this pointer when `result_ok` is set is undefined.
19864 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19867 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
19868 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19869 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19870 pub struct CResult_NodeAnnouncementDecodeErrorZ {
19871 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
19872 /// `err` or `result` depending on the state of `result_ok`.
19873 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
19874 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
19875 pub result_ok: bool,
19878 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
19879 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
19880 CResult_NodeAnnouncementDecodeErrorZ {
19881 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
19882 result: Box::into_raw(Box::new(o)),
19888 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
19889 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
19890 CResult_NodeAnnouncementDecodeErrorZ {
19891 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
19892 err: Box::into_raw(Box::new(e)),
19897 /// Checks if the given object is currently in the success state
19899 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
19903 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
19904 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
19905 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
19906 fn drop(&mut self) {
19907 if self.result_ok {
19908 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19909 let _ = unsafe { Box::from_raw(self.contents.result) };
19912 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19913 let _ = unsafe { Box::from_raw(self.contents.err) };
19918 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
19919 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19920 let contents = if o.result_ok {
19921 let result = unsafe { o.contents.result };
19922 unsafe { o.contents.result = core::ptr::null_mut() };
19923 CResult_NodeAnnouncementDecodeErrorZPtr { result }
19925 let err = unsafe { o.contents.err };
19926 unsafe { o.contents.err = core::ptr::null_mut(); }
19927 CResult_NodeAnnouncementDecodeErrorZPtr { err }
19931 result_ok: o.result_ok,
19935 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
19936 fn clone(&self) -> Self {
19937 if self.result_ok {
19938 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
19939 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
19942 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
19943 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19949 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
19950 /// but with all dynamically-allocated buffers duplicated in new buffers.
19951 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19953 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
19954 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
19955 /// A pointer to the contents in the success state.
19956 /// Reading from this pointer when `result_ok` is not set is undefined.
19957 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
19958 /// A pointer to the contents in the error state.
19959 /// Reading from this pointer when `result_ok` is set is undefined.
19960 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19963 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
19964 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
19965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19966 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
19967 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
19968 /// `err` or `result` depending on the state of `result_ok`.
19969 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
19970 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
19971 pub result_ok: bool,
19974 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
19975 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
19976 CResult_QueryShortChannelIdsDecodeErrorZ {
19977 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
19978 result: Box::into_raw(Box::new(o)),
19984 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
19985 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
19986 CResult_QueryShortChannelIdsDecodeErrorZ {
19987 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
19988 err: Box::into_raw(Box::new(e)),
19993 /// Checks if the given object is currently in the success state
19995 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
19999 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
20000 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
20001 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
20002 fn drop(&mut self) {
20003 if self.result_ok {
20004 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20005 let _ = unsafe { Box::from_raw(self.contents.result) };
20008 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20009 let _ = unsafe { Box::from_raw(self.contents.err) };
20014 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
20015 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
20016 let contents = if o.result_ok {
20017 let result = unsafe { o.contents.result };
20018 unsafe { o.contents.result = core::ptr::null_mut() };
20019 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
20021 let err = unsafe { o.contents.err };
20022 unsafe { o.contents.err = core::ptr::null_mut(); }
20023 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
20027 result_ok: o.result_ok,
20031 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
20032 fn clone(&self) -> Self {
20033 if self.result_ok {
20034 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20035 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
20038 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20039 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20045 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
20046 /// but with all dynamically-allocated buffers duplicated in new buffers.
20047 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
20049 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
20050 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20051 /// A pointer to the contents in the success state.
20052 /// Reading from this pointer when `result_ok` is not set is undefined.
20053 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
20054 /// A pointer to the contents in the error state.
20055 /// Reading from this pointer when `result_ok` is set is undefined.
20056 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20059 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
20060 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
20061 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20062 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20063 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
20064 /// `err` or `result` depending on the state of `result_ok`.
20065 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
20066 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
20067 pub result_ok: bool,
20070 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
20071 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20072 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20073 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20074 result: Box::into_raw(Box::new(o)),
20080 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
20081 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20082 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20083 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20084 err: Box::into_raw(Box::new(e)),
20089 /// Checks if the given object is currently in the success state
20091 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
20095 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
20096 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
20097 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20098 fn drop(&mut self) {
20099 if self.result_ok {
20100 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20101 let _ = unsafe { Box::from_raw(self.contents.result) };
20104 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20105 let _ = unsafe { Box::from_raw(self.contents.err) };
20110 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20111 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
20112 let contents = if o.result_ok {
20113 let result = unsafe { o.contents.result };
20114 unsafe { o.contents.result = core::ptr::null_mut() };
20115 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
20117 let err = unsafe { o.contents.err };
20118 unsafe { o.contents.err = core::ptr::null_mut(); }
20119 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
20123 result_ok: o.result_ok,
20127 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20128 fn clone(&self) -> Self {
20129 if self.result_ok {
20130 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20131 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
20134 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20135 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20141 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
20142 /// but with all dynamically-allocated buffers duplicated in new buffers.
20143 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
20145 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
20146 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
20147 /// A pointer to the contents in the success state.
20148 /// Reading from this pointer when `result_ok` is not set is undefined.
20149 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
20150 /// A pointer to the contents in the error state.
20151 /// Reading from this pointer when `result_ok` is set is undefined.
20152 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20155 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
20156 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20158 pub struct CResult_QueryChannelRangeDecodeErrorZ {
20159 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
20160 /// `err` or `result` depending on the state of `result_ok`.
20161 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
20162 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
20163 pub result_ok: bool,
20166 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
20167 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
20168 CResult_QueryChannelRangeDecodeErrorZ {
20169 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20170 result: Box::into_raw(Box::new(o)),
20176 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
20177 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
20178 CResult_QueryChannelRangeDecodeErrorZ {
20179 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20180 err: Box::into_raw(Box::new(e)),
20185 /// Checks if the given object is currently in the success state
20187 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
20191 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
20192 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
20193 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
20194 fn drop(&mut self) {
20195 if self.result_ok {
20196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20197 let _ = unsafe { Box::from_raw(self.contents.result) };
20200 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20201 let _ = unsafe { Box::from_raw(self.contents.err) };
20206 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
20207 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20208 let contents = if o.result_ok {
20209 let result = unsafe { o.contents.result };
20210 unsafe { o.contents.result = core::ptr::null_mut() };
20211 CResult_QueryChannelRangeDecodeErrorZPtr { result }
20213 let err = unsafe { o.contents.err };
20214 unsafe { o.contents.err = core::ptr::null_mut(); }
20215 CResult_QueryChannelRangeDecodeErrorZPtr { err }
20219 result_ok: o.result_ok,
20223 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
20224 fn clone(&self) -> Self {
20225 if self.result_ok {
20226 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20227 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
20230 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20231 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20237 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
20238 /// but with all dynamically-allocated buffers duplicated in new buffers.
20239 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20241 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
20242 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
20243 /// A pointer to the contents in the success state.
20244 /// Reading from this pointer when `result_ok` is not set is undefined.
20245 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
20246 /// A pointer to the contents in the error state.
20247 /// Reading from this pointer when `result_ok` is set is undefined.
20248 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20251 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
20252 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20254 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
20255 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
20256 /// `err` or `result` depending on the state of `result_ok`.
20257 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
20258 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
20259 pub result_ok: bool,
20262 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
20263 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
20264 CResult_ReplyChannelRangeDecodeErrorZ {
20265 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20266 result: Box::into_raw(Box::new(o)),
20272 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
20273 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
20274 CResult_ReplyChannelRangeDecodeErrorZ {
20275 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20276 err: Box::into_raw(Box::new(e)),
20281 /// Checks if the given object is currently in the success state
20283 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
20287 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
20288 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
20289 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
20290 fn drop(&mut self) {
20291 if self.result_ok {
20292 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20293 let _ = unsafe { Box::from_raw(self.contents.result) };
20296 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20297 let _ = unsafe { Box::from_raw(self.contents.err) };
20302 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
20303 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20304 let contents = if o.result_ok {
20305 let result = unsafe { o.contents.result };
20306 unsafe { o.contents.result = core::ptr::null_mut() };
20307 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
20309 let err = unsafe { o.contents.err };
20310 unsafe { o.contents.err = core::ptr::null_mut(); }
20311 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
20315 result_ok: o.result_ok,
20319 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
20320 fn clone(&self) -> Self {
20321 if self.result_ok {
20322 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20323 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
20326 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20327 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20333 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
20334 /// but with all dynamically-allocated buffers duplicated in new buffers.
20335 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20337 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
20338 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
20339 /// A pointer to the contents in the success state.
20340 /// Reading from this pointer when `result_ok` is not set is undefined.
20341 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
20342 /// A pointer to the contents in the error state.
20343 /// Reading from this pointer when `result_ok` is set is undefined.
20344 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20347 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
20348 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
20349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20350 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
20351 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
20352 /// `err` or `result` depending on the state of `result_ok`.
20353 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
20354 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
20355 pub result_ok: bool,
20358 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
20359 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
20360 CResult_GossipTimestampFilterDecodeErrorZ {
20361 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20362 result: Box::into_raw(Box::new(o)),
20368 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
20369 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
20370 CResult_GossipTimestampFilterDecodeErrorZ {
20371 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20372 err: Box::into_raw(Box::new(e)),
20377 /// Checks if the given object is currently in the success state
20379 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
20383 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
20384 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
20385 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
20386 fn drop(&mut self) {
20387 if self.result_ok {
20388 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20389 let _ = unsafe { Box::from_raw(self.contents.result) };
20392 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20393 let _ = unsafe { Box::from_raw(self.contents.err) };
20398 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
20399 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
20400 let contents = if o.result_ok {
20401 let result = unsafe { o.contents.result };
20402 unsafe { o.contents.result = core::ptr::null_mut() };
20403 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
20405 let err = unsafe { o.contents.err };
20406 unsafe { o.contents.err = core::ptr::null_mut(); }
20407 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
20411 result_ok: o.result_ok,
20415 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
20416 fn clone(&self) -> Self {
20417 if self.result_ok {
20418 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20419 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
20422 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20423 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20429 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
20430 /// but with all dynamically-allocated buffers duplicated in new buffers.
20431 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
20433 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
20434 /// This corresponds to std::vector in C++
20435 pub struct CVec_PhantomRouteHintsZ {
20436 /// The elements in the array.
20437 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20438 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
20439 /// The number of elements pointed to by `data`.
20442 impl CVec_PhantomRouteHintsZ {
20443 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
20444 if self.datalen == 0 { return Vec::new(); }
20445 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20446 self.data = core::ptr::null_mut();
20450 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
20451 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20454 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
20455 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
20456 let datalen = v.len();
20457 let data = Box::into_raw(v.into_boxed_slice());
20458 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20462 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20463 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
20464 impl Drop for CVec_PhantomRouteHintsZ {
20465 fn drop(&mut self) {
20466 if self.datalen == 0 { return; }
20467 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20470 impl Clone for CVec_PhantomRouteHintsZ {
20471 fn clone(&self) -> Self {
20472 let mut res = Vec::new();
20473 if self.datalen == 0 { return Self::from(res); }
20474 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20479 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
20480 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20481 /// A pointer to the contents in the success state.
20482 /// Reading from this pointer when `result_ok` is not set is undefined.
20483 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20484 /// A pointer to the contents in the error state.
20485 /// Reading from this pointer when `result_ok` is set is undefined.
20486 pub err: *mut crate::lightning_invoice::SignOrCreationError,
20489 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
20490 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
20491 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20492 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
20493 /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
20494 /// `err` or `result` depending on the state of `result_ok`.
20495 pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
20496 /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
20497 pub result_ok: bool,
20500 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
20501 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20502 CResult_Bolt11InvoiceSignOrCreationErrorZ {
20503 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20504 result: Box::into_raw(Box::new(o)),
20510 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
20511 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20512 CResult_Bolt11InvoiceSignOrCreationErrorZ {
20513 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20514 err: Box::into_raw(Box::new(e)),
20519 /// Checks if the given object is currently in the success state
20521 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
20525 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
20526 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
20527 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20528 fn drop(&mut self) {
20529 if self.result_ok {
20530 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20531 let _ = unsafe { Box::from_raw(self.contents.result) };
20534 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20535 let _ = unsafe { Box::from_raw(self.contents.err) };
20540 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20541 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
20542 let contents = if o.result_ok {
20543 let result = unsafe { o.contents.result };
20544 unsafe { o.contents.result = core::ptr::null_mut() };
20545 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
20547 let err = unsafe { o.contents.err };
20548 unsafe { o.contents.err = core::ptr::null_mut(); }
20549 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
20553 result_ok: o.result_ok,
20557 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20558 fn clone(&self) -> Self {
20559 if self.result_ok {
20560 Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20561 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20564 Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20565 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
20571 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
20572 /// but with all dynamically-allocated buffers duplicated in new buffers.
20573 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
20576 /// An enum which can either contain a crate::lightning::ln::channel_state::InboundHTLCStateDetails or not
20577 pub enum COption_InboundHTLCStateDetailsZ {
20578 /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::InboundHTLCStateDetails
20579 Some(crate::lightning::ln::channel_state::InboundHTLCStateDetails),
20580 /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains nothing
20583 impl COption_InboundHTLCStateDetailsZ {
20584 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20585 if let Self::None = self { false } else { true }
20587 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20590 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channel_state::InboundHTLCStateDetails {
20591 if let Self::Some(v) = self { v } else { unreachable!() }
20595 /// Constructs a new COption_InboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::InboundHTLCStateDetails
20596 pub extern "C" fn COption_InboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::InboundHTLCStateDetails) -> COption_InboundHTLCStateDetailsZ {
20597 COption_InboundHTLCStateDetailsZ::Some(o)
20600 /// Constructs a new COption_InboundHTLCStateDetailsZ containing nothing
20601 pub extern "C" fn COption_InboundHTLCStateDetailsZ_none() -> COption_InboundHTLCStateDetailsZ {
20602 COption_InboundHTLCStateDetailsZ::None
20605 /// Frees any resources associated with the crate::lightning::ln::channel_state::InboundHTLCStateDetails, if we are in the Some state
20606 pub extern "C" fn COption_InboundHTLCStateDetailsZ_free(_res: COption_InboundHTLCStateDetailsZ) { }
20608 /// Creates a new COption_InboundHTLCStateDetailsZ which has the same data as `orig`
20609 /// but with all dynamically-allocated buffers duplicated in new buffers.
20610 pub extern "C" fn COption_InboundHTLCStateDetailsZ_clone(orig: &COption_InboundHTLCStateDetailsZ) -> COption_InboundHTLCStateDetailsZ { Clone::clone(&orig) }
20612 /// The contents of CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ
20613 pub union CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr {
20614 /// A pointer to the contents in the success state.
20615 /// Reading from this pointer when `result_ok` is not set is undefined.
20616 pub result: *mut crate::c_types::derived::COption_InboundHTLCStateDetailsZ,
20617 /// A pointer to the contents in the error state.
20618 /// Reading from this pointer when `result_ok` is set is undefined.
20619 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20622 /// A CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation,
20623 /// containing a crate::c_types::derived::COption_InboundHTLCStateDetailsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
20624 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20625 pub struct CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20626 /// The contents of this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ, accessible via either
20627 /// `err` or `result` depending on the state of `result_ok`.
20628 pub contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr,
20629 /// Whether this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents a success state.
20630 pub result_ok: bool,
20633 /// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the success state.
20634 pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_InboundHTLCStateDetailsZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20635 CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20636 contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr {
20637 result: Box::into_raw(Box::new(o)),
20643 /// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the error state.
20644 pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20645 CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20646 contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr {
20647 err: Box::into_raw(Box::new(e)),
20652 /// Checks if the given object is currently in the success state
20654 pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> bool {
20658 /// Frees any resources used by the CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ.
20659 pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) { }
20660 impl Drop for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20661 fn drop(&mut self) {
20662 if self.result_ok {
20663 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20664 let _ = unsafe { Box::from_raw(self.contents.result) };
20667 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20668 let _ = unsafe { Box::from_raw(self.contents.err) };
20673 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_InboundHTLCStateDetailsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20674 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_InboundHTLCStateDetailsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
20675 let contents = if o.result_ok {
20676 let result = unsafe { o.contents.result };
20677 unsafe { o.contents.result = core::ptr::null_mut() };
20678 CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { result }
20680 let err = unsafe { o.contents.err };
20681 unsafe { o.contents.err = core::ptr::null_mut(); }
20682 CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { err }
20686 result_ok: o.result_ok,
20690 impl Clone for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20691 fn clone(&self) -> Self {
20692 if self.result_ok {
20693 Self { result_ok: true, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr {
20694 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_InboundHTLCStateDetailsZ>::clone(unsafe { &*self.contents.result })))
20697 Self { result_ok: false, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr {
20698 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20704 /// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig`
20705 /// but with all dynamically-allocated buffers duplicated in new buffers.
20706 pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) }
20708 /// The contents of CResult_InboundHTLCDetailsDecodeErrorZ
20709 pub union CResult_InboundHTLCDetailsDecodeErrorZPtr {
20710 /// A pointer to the contents in the success state.
20711 /// Reading from this pointer when `result_ok` is not set is undefined.
20712 pub result: *mut crate::lightning::ln::channel_state::InboundHTLCDetails,
20713 /// A pointer to the contents in the error state.
20714 /// Reading from this pointer when `result_ok` is set is undefined.
20715 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20718 /// A CResult_InboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation,
20719 /// containing a crate::lightning::ln::channel_state::InboundHTLCDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
20720 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20721 pub struct CResult_InboundHTLCDetailsDecodeErrorZ {
20722 /// The contents of this CResult_InboundHTLCDetailsDecodeErrorZ, accessible via either
20723 /// `err` or `result` depending on the state of `result_ok`.
20724 pub contents: CResult_InboundHTLCDetailsDecodeErrorZPtr,
20725 /// Whether this CResult_InboundHTLCDetailsDecodeErrorZ represents a success state.
20726 pub result_ok: bool,
20729 /// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the success state.
20730 pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::InboundHTLCDetails) -> CResult_InboundHTLCDetailsDecodeErrorZ {
20731 CResult_InboundHTLCDetailsDecodeErrorZ {
20732 contents: CResult_InboundHTLCDetailsDecodeErrorZPtr {
20733 result: Box::into_raw(Box::new(o)),
20739 /// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the error state.
20740 pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InboundHTLCDetailsDecodeErrorZ {
20741 CResult_InboundHTLCDetailsDecodeErrorZ {
20742 contents: CResult_InboundHTLCDetailsDecodeErrorZPtr {
20743 err: Box::into_raw(Box::new(e)),
20748 /// Checks if the given object is currently in the success state
20750 pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_InboundHTLCDetailsDecodeErrorZ) -> bool {
20754 /// Frees any resources used by the CResult_InboundHTLCDetailsDecodeErrorZ.
20755 pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_free(_res: CResult_InboundHTLCDetailsDecodeErrorZ) { }
20756 impl Drop for CResult_InboundHTLCDetailsDecodeErrorZ {
20757 fn drop(&mut self) {
20758 if self.result_ok {
20759 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20760 let _ = unsafe { Box::from_raw(self.contents.result) };
20763 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20764 let _ = unsafe { Box::from_raw(self.contents.err) };
20769 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_state::InboundHTLCDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_InboundHTLCDetailsDecodeErrorZ {
20770 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::InboundHTLCDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
20771 let contents = if o.result_ok {
20772 let result = unsafe { o.contents.result };
20773 unsafe { o.contents.result = core::ptr::null_mut() };
20774 CResult_InboundHTLCDetailsDecodeErrorZPtr { result }
20776 let err = unsafe { o.contents.err };
20777 unsafe { o.contents.err = core::ptr::null_mut(); }
20778 CResult_InboundHTLCDetailsDecodeErrorZPtr { err }
20782 result_ok: o.result_ok,
20786 impl Clone for CResult_InboundHTLCDetailsDecodeErrorZ {
20787 fn clone(&self) -> Self {
20788 if self.result_ok {
20789 Self { result_ok: true, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr {
20790 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::InboundHTLCDetails>::clone(unsafe { &*self.contents.result })))
20793 Self { result_ok: false, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr {
20794 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20800 /// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ which has the same data as `orig`
20801 /// but with all dynamically-allocated buffers duplicated in new buffers.
20802 pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_InboundHTLCDetailsDecodeErrorZ) -> CResult_InboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) }
20805 /// An enum which can either contain a crate::lightning::ln::channel_state::OutboundHTLCStateDetails or not
20806 pub enum COption_OutboundHTLCStateDetailsZ {
20807 /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::OutboundHTLCStateDetails
20808 Some(crate::lightning::ln::channel_state::OutboundHTLCStateDetails),
20809 /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains nothing
20812 impl COption_OutboundHTLCStateDetailsZ {
20813 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20814 if let Self::None = self { false } else { true }
20816 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20819 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channel_state::OutboundHTLCStateDetails {
20820 if let Self::Some(v) = self { v } else { unreachable!() }
20824 /// Constructs a new COption_OutboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::OutboundHTLCStateDetails
20825 pub extern "C" fn COption_OutboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::OutboundHTLCStateDetails) -> COption_OutboundHTLCStateDetailsZ {
20826 COption_OutboundHTLCStateDetailsZ::Some(o)
20829 /// Constructs a new COption_OutboundHTLCStateDetailsZ containing nothing
20830 pub extern "C" fn COption_OutboundHTLCStateDetailsZ_none() -> COption_OutboundHTLCStateDetailsZ {
20831 COption_OutboundHTLCStateDetailsZ::None
20834 /// Frees any resources associated with the crate::lightning::ln::channel_state::OutboundHTLCStateDetails, if we are in the Some state
20835 pub extern "C" fn COption_OutboundHTLCStateDetailsZ_free(_res: COption_OutboundHTLCStateDetailsZ) { }
20837 /// Creates a new COption_OutboundHTLCStateDetailsZ which has the same data as `orig`
20838 /// but with all dynamically-allocated buffers duplicated in new buffers.
20839 pub extern "C" fn COption_OutboundHTLCStateDetailsZ_clone(orig: &COption_OutboundHTLCStateDetailsZ) -> COption_OutboundHTLCStateDetailsZ { Clone::clone(&orig) }
20841 /// The contents of CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ
20842 pub union CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr {
20843 /// A pointer to the contents in the success state.
20844 /// Reading from this pointer when `result_ok` is not set is undefined.
20845 pub result: *mut crate::c_types::derived::COption_OutboundHTLCStateDetailsZ,
20846 /// A pointer to the contents in the error state.
20847 /// Reading from this pointer when `result_ok` is set is undefined.
20848 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20851 /// A CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation,
20852 /// containing a crate::c_types::derived::COption_OutboundHTLCStateDetailsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
20853 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20854 pub struct CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20855 /// The contents of this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ, accessible via either
20856 /// `err` or `result` depending on the state of `result_ok`.
20857 pub contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr,
20858 /// Whether this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents a success state.
20859 pub result_ok: bool,
20862 /// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the success state.
20863 pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OutboundHTLCStateDetailsZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20864 CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20865 contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr {
20866 result: Box::into_raw(Box::new(o)),
20872 /// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the error state.
20873 pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20874 CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20875 contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr {
20876 err: Box::into_raw(Box::new(e)),
20881 /// Checks if the given object is currently in the success state
20883 pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> bool {
20887 /// Frees any resources used by the CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ.
20888 pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) { }
20889 impl Drop for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20890 fn drop(&mut self) {
20891 if self.result_ok {
20892 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20893 let _ = unsafe { Box::from_raw(self.contents.result) };
20896 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20897 let _ = unsafe { Box::from_raw(self.contents.err) };
20902 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OutboundHTLCStateDetailsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20903 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OutboundHTLCStateDetailsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
20904 let contents = if o.result_ok {
20905 let result = unsafe { o.contents.result };
20906 unsafe { o.contents.result = core::ptr::null_mut() };
20907 CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { result }
20909 let err = unsafe { o.contents.err };
20910 unsafe { o.contents.err = core::ptr::null_mut(); }
20911 CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { err }
20915 result_ok: o.result_ok,
20919 impl Clone for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20920 fn clone(&self) -> Self {
20921 if self.result_ok {
20922 Self { result_ok: true, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr {
20923 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OutboundHTLCStateDetailsZ>::clone(unsafe { &*self.contents.result })))
20926 Self { result_ok: false, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr {
20927 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20933 /// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig`
20934 /// but with all dynamically-allocated buffers duplicated in new buffers.
20935 pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) }
20937 /// The contents of CResult_OutboundHTLCDetailsDecodeErrorZ
20938 pub union CResult_OutboundHTLCDetailsDecodeErrorZPtr {
20939 /// A pointer to the contents in the success state.
20940 /// Reading from this pointer when `result_ok` is not set is undefined.
20941 pub result: *mut crate::lightning::ln::channel_state::OutboundHTLCDetails,
20942 /// A pointer to the contents in the error state.
20943 /// Reading from this pointer when `result_ok` is set is undefined.
20944 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20947 /// A CResult_OutboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation,
20948 /// containing a crate::lightning::ln::channel_state::OutboundHTLCDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
20949 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20950 pub struct CResult_OutboundHTLCDetailsDecodeErrorZ {
20951 /// The contents of this CResult_OutboundHTLCDetailsDecodeErrorZ, accessible via either
20952 /// `err` or `result` depending on the state of `result_ok`.
20953 pub contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr,
20954 /// Whether this CResult_OutboundHTLCDetailsDecodeErrorZ represents a success state.
20955 pub result_ok: bool,
20958 /// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the success state.
20959 pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::OutboundHTLCDetails) -> CResult_OutboundHTLCDetailsDecodeErrorZ {
20960 CResult_OutboundHTLCDetailsDecodeErrorZ {
20961 contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr {
20962 result: Box::into_raw(Box::new(o)),
20968 /// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the error state.
20969 pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutboundHTLCDetailsDecodeErrorZ {
20970 CResult_OutboundHTLCDetailsDecodeErrorZ {
20971 contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr {
20972 err: Box::into_raw(Box::new(e)),
20977 /// Checks if the given object is currently in the success state
20979 pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> bool {
20983 /// Frees any resources used by the CResult_OutboundHTLCDetailsDecodeErrorZ.
20984 pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_free(_res: CResult_OutboundHTLCDetailsDecodeErrorZ) { }
20985 impl Drop for CResult_OutboundHTLCDetailsDecodeErrorZ {
20986 fn drop(&mut self) {
20987 if self.result_ok {
20988 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20989 let _ = unsafe { Box::from_raw(self.contents.result) };
20992 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20993 let _ = unsafe { Box::from_raw(self.contents.err) };
20998 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_state::OutboundHTLCDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_OutboundHTLCDetailsDecodeErrorZ {
20999 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::OutboundHTLCDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
21000 let contents = if o.result_ok {
21001 let result = unsafe { o.contents.result };
21002 unsafe { o.contents.result = core::ptr::null_mut() };
21003 CResult_OutboundHTLCDetailsDecodeErrorZPtr { result }
21005 let err = unsafe { o.contents.err };
21006 unsafe { o.contents.err = core::ptr::null_mut(); }
21007 CResult_OutboundHTLCDetailsDecodeErrorZPtr { err }
21011 result_ok: o.result_ok,
21015 impl Clone for CResult_OutboundHTLCDetailsDecodeErrorZ {
21016 fn clone(&self) -> Self {
21017 if self.result_ok {
21018 Self { result_ok: true, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr {
21019 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::OutboundHTLCDetails>::clone(unsafe { &*self.contents.result })))
21022 Self { result_ok: false, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr {
21023 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21029 /// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ which has the same data as `orig`
21030 /// but with all dynamically-allocated buffers duplicated in new buffers.
21031 pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> CResult_OutboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) }
21033 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
21034 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
21035 /// A pointer to the contents in the success state.
21036 /// Reading from this pointer when `result_ok` is not set is undefined.
21037 pub result: *mut crate::lightning::ln::channel_state::CounterpartyForwardingInfo,
21038 /// A pointer to the contents in the error state.
21039 /// Reading from this pointer when `result_ok` is set is undefined.
21040 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21043 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
21044 /// containing a crate::lightning::ln::channel_state::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
21045 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21046 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
21047 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
21048 /// `err` or `result` depending on the state of `result_ok`.
21049 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
21050 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
21051 pub result_ok: bool,
21054 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
21055 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
21056 CResult_CounterpartyForwardingInfoDecodeErrorZ {
21057 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
21058 result: Box::into_raw(Box::new(o)),
21064 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
21065 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
21066 CResult_CounterpartyForwardingInfoDecodeErrorZ {
21067 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
21068 err: Box::into_raw(Box::new(e)),
21073 /// Checks if the given object is currently in the success state
21075 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
21079 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
21080 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
21081 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
21082 fn drop(&mut self) {
21083 if self.result_ok {
21084 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21085 let _ = unsafe { Box::from_raw(self.contents.result) };
21088 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21089 let _ = unsafe { Box::from_raw(self.contents.err) };
21094 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_state::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
21095 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
21096 let contents = if o.result_ok {
21097 let result = unsafe { o.contents.result };
21098 unsafe { o.contents.result = core::ptr::null_mut() };
21099 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
21101 let err = unsafe { o.contents.err };
21102 unsafe { o.contents.err = core::ptr::null_mut(); }
21103 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
21107 result_ok: o.result_ok,
21111 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
21112 fn clone(&self) -> Self {
21113 if self.result_ok {
21114 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
21115 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
21118 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
21119 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21125 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
21126 /// but with all dynamically-allocated buffers duplicated in new buffers.
21127 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
21129 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
21130 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
21131 /// A pointer to the contents in the success state.
21132 /// Reading from this pointer when `result_ok` is not set is undefined.
21133 pub result: *mut crate::lightning::ln::channel_state::ChannelCounterparty,
21134 /// A pointer to the contents in the error state.
21135 /// Reading from this pointer when `result_ok` is set is undefined.
21136 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21139 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
21140 /// containing a crate::lightning::ln::channel_state::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
21141 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21142 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
21143 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
21144 /// `err` or `result` depending on the state of `result_ok`.
21145 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
21146 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
21147 pub result_ok: bool,
21150 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
21151 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
21152 CResult_ChannelCounterpartyDecodeErrorZ {
21153 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
21154 result: Box::into_raw(Box::new(o)),
21160 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
21161 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
21162 CResult_ChannelCounterpartyDecodeErrorZ {
21163 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
21164 err: Box::into_raw(Box::new(e)),
21169 /// Checks if the given object is currently in the success state
21171 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
21175 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
21176 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
21177 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
21178 fn drop(&mut self) {
21179 if self.result_ok {
21180 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21181 let _ = unsafe { Box::from_raw(self.contents.result) };
21184 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21185 let _ = unsafe { Box::from_raw(self.contents.err) };
21190 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_state::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
21191 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
21192 let contents = if o.result_ok {
21193 let result = unsafe { o.contents.result };
21194 unsafe { o.contents.result = core::ptr::null_mut() };
21195 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
21197 let err = unsafe { o.contents.err };
21198 unsafe { o.contents.err = core::ptr::null_mut(); }
21199 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
21203 result_ok: o.result_ok,
21207 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
21208 fn clone(&self) -> Self {
21209 if self.result_ok {
21210 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
21211 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
21214 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
21215 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21221 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
21222 /// but with all dynamically-allocated buffers duplicated in new buffers.
21223 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
21226 /// An enum which can either contain a crate::lightning::ln::channel_state::ChannelShutdownState or not
21227 pub enum COption_ChannelShutdownStateZ {
21228 /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channel_state::ChannelShutdownState
21229 Some(crate::lightning::ln::channel_state::ChannelShutdownState),
21230 /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
21233 impl COption_ChannelShutdownStateZ {
21234 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21235 if let Self::None = self { false } else { true }
21237 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21240 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channel_state::ChannelShutdownState {
21241 if let Self::Some(v) = self { v } else { unreachable!() }
21245 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channel_state::ChannelShutdownState
21246 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
21247 COption_ChannelShutdownStateZ::Some(o)
21250 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
21251 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
21252 COption_ChannelShutdownStateZ::None
21255 /// Frees any resources associated with the crate::lightning::ln::channel_state::ChannelShutdownState, if we are in the Some state
21256 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
21258 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
21259 /// but with all dynamically-allocated buffers duplicated in new buffers.
21260 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
21262 /// A dynamically-allocated array of crate::lightning::ln::channel_state::InboundHTLCDetailss of arbitrary size.
21263 /// This corresponds to std::vector in C++
21264 pub struct CVec_InboundHTLCDetailsZ {
21265 /// The elements in the array.
21266 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21267 pub data: *mut crate::lightning::ln::channel_state::InboundHTLCDetails,
21268 /// The number of elements pointed to by `data`.
21271 impl CVec_InboundHTLCDetailsZ {
21272 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channel_state::InboundHTLCDetails> {
21273 if self.datalen == 0 { return Vec::new(); }
21274 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21275 self.data = core::ptr::null_mut();
21279 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channel_state::InboundHTLCDetails] {
21280 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21283 impl From<Vec<crate::lightning::ln::channel_state::InboundHTLCDetails>> for CVec_InboundHTLCDetailsZ {
21284 fn from(v: Vec<crate::lightning::ln::channel_state::InboundHTLCDetails>) -> Self {
21285 let datalen = v.len();
21286 let data = Box::into_raw(v.into_boxed_slice());
21287 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21291 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21292 pub extern "C" fn CVec_InboundHTLCDetailsZ_free(_res: CVec_InboundHTLCDetailsZ) { }
21293 impl Drop for CVec_InboundHTLCDetailsZ {
21294 fn drop(&mut self) {
21295 if self.datalen == 0 { return; }
21296 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21299 impl Clone for CVec_InboundHTLCDetailsZ {
21300 fn clone(&self) -> Self {
21301 let mut res = Vec::new();
21302 if self.datalen == 0 { return Self::from(res); }
21303 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
21308 /// A dynamically-allocated array of crate::lightning::ln::channel_state::OutboundHTLCDetailss of arbitrary size.
21309 /// This corresponds to std::vector in C++
21310 pub struct CVec_OutboundHTLCDetailsZ {
21311 /// The elements in the array.
21312 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21313 pub data: *mut crate::lightning::ln::channel_state::OutboundHTLCDetails,
21314 /// The number of elements pointed to by `data`.
21317 impl CVec_OutboundHTLCDetailsZ {
21318 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channel_state::OutboundHTLCDetails> {
21319 if self.datalen == 0 { return Vec::new(); }
21320 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21321 self.data = core::ptr::null_mut();
21325 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channel_state::OutboundHTLCDetails] {
21326 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21329 impl From<Vec<crate::lightning::ln::channel_state::OutboundHTLCDetails>> for CVec_OutboundHTLCDetailsZ {
21330 fn from(v: Vec<crate::lightning::ln::channel_state::OutboundHTLCDetails>) -> Self {
21331 let datalen = v.len();
21332 let data = Box::into_raw(v.into_boxed_slice());
21333 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21337 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21338 pub extern "C" fn CVec_OutboundHTLCDetailsZ_free(_res: CVec_OutboundHTLCDetailsZ) { }
21339 impl Drop for CVec_OutboundHTLCDetailsZ {
21340 fn drop(&mut self) {
21341 if self.datalen == 0 { return; }
21342 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21345 impl Clone for CVec_OutboundHTLCDetailsZ {
21346 fn clone(&self) -> Self {
21347 let mut res = Vec::new();
21348 if self.datalen == 0 { return Self::from(res); }
21349 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
21354 /// The contents of CResult_ChannelDetailsDecodeErrorZ
21355 pub union CResult_ChannelDetailsDecodeErrorZPtr {
21356 /// A pointer to the contents in the success state.
21357 /// Reading from this pointer when `result_ok` is not set is undefined.
21358 pub result: *mut crate::lightning::ln::channel_state::ChannelDetails,
21359 /// A pointer to the contents in the error state.
21360 /// Reading from this pointer when `result_ok` is set is undefined.
21361 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21364 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
21365 /// containing a crate::lightning::ln::channel_state::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
21366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21367 pub struct CResult_ChannelDetailsDecodeErrorZ {
21368 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
21369 /// `err` or `result` depending on the state of `result_ok`.
21370 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
21371 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
21372 pub result_ok: bool,
21375 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
21376 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
21377 CResult_ChannelDetailsDecodeErrorZ {
21378 contents: CResult_ChannelDetailsDecodeErrorZPtr {
21379 result: Box::into_raw(Box::new(o)),
21385 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
21386 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
21387 CResult_ChannelDetailsDecodeErrorZ {
21388 contents: CResult_ChannelDetailsDecodeErrorZPtr {
21389 err: Box::into_raw(Box::new(e)),
21394 /// Checks if the given object is currently in the success state
21396 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
21400 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
21401 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
21402 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
21403 fn drop(&mut self) {
21404 if self.result_ok {
21405 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21406 let _ = unsafe { Box::from_raw(self.contents.result) };
21409 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21410 let _ = unsafe { Box::from_raw(self.contents.err) };
21415 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_state::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
21416 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
21417 let contents = if o.result_ok {
21418 let result = unsafe { o.contents.result };
21419 unsafe { o.contents.result = core::ptr::null_mut() };
21420 CResult_ChannelDetailsDecodeErrorZPtr { result }
21422 let err = unsafe { o.contents.err };
21423 unsafe { o.contents.err = core::ptr::null_mut(); }
21424 CResult_ChannelDetailsDecodeErrorZPtr { err }
21428 result_ok: o.result_ok,
21432 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
21433 fn clone(&self) -> Self {
21434 if self.result_ok {
21435 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
21436 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::ChannelDetails>::clone(unsafe { &*self.contents.result })))
21439 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
21440 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21446 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
21447 /// but with all dynamically-allocated buffers duplicated in new buffers.
21448 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
21450 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
21451 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
21452 /// A pointer to the contents in the success state.
21453 /// Reading from this pointer when `result_ok` is not set is undefined.
21454 pub result: *mut crate::lightning::ln::channel_state::ChannelShutdownState,
21455 /// A pointer to the contents in the error state.
21456 /// Reading from this pointer when `result_ok` is set is undefined.
21457 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21460 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
21461 /// containing a crate::lightning::ln::channel_state::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
21462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21463 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
21464 /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
21465 /// `err` or `result` depending on the state of `result_ok`.
21466 pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
21467 /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
21468 pub result_ok: bool,
21471 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
21472 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
21473 CResult_ChannelShutdownStateDecodeErrorZ {
21474 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
21475 result: Box::into_raw(Box::new(o)),
21481 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
21482 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
21483 CResult_ChannelShutdownStateDecodeErrorZ {
21484 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
21485 err: Box::into_raw(Box::new(e)),
21490 /// Checks if the given object is currently in the success state
21492 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
21496 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
21497 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
21498 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
21499 fn drop(&mut self) {
21500 if self.result_ok {
21501 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21502 let _ = unsafe { Box::from_raw(self.contents.result) };
21505 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21506 let _ = unsafe { Box::from_raw(self.contents.err) };
21511 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_state::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
21512 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
21513 let contents = if o.result_ok {
21514 let result = unsafe { o.contents.result };
21515 unsafe { o.contents.result = core::ptr::null_mut() };
21516 CResult_ChannelShutdownStateDecodeErrorZPtr { result }
21518 let err = unsafe { o.contents.err };
21519 unsafe { o.contents.err = core::ptr::null_mut(); }
21520 CResult_ChannelShutdownStateDecodeErrorZPtr { err }
21524 result_ok: o.result_ok,
21528 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
21529 fn clone(&self) -> Self {
21530 if self.result_ok {
21531 Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
21532 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
21535 Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
21536 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21542 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
21543 /// but with all dynamically-allocated buffers duplicated in new buffers.
21544 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
21546 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
21547 /// This corresponds to std::vector in C++
21548 pub struct CVec_FutureZ {
21549 /// The elements in the array.
21550 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21551 pub data: *mut crate::lightning::util::wakers::Future,
21552 /// The number of elements pointed to by `data`.
21555 impl CVec_FutureZ {
21556 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
21557 if self.datalen == 0 { return Vec::new(); }
21558 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21559 self.data = core::ptr::null_mut();
21563 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
21564 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21567 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
21568 fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
21569 let datalen = v.len();
21570 let data = Box::into_raw(v.into_boxed_slice());
21571 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21575 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21576 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
21577 impl Drop for CVec_FutureZ {
21578 fn drop(&mut self) {
21579 if self.datalen == 0 { return; }
21580 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21584 /// The contents of CResult_OffersMessageDecodeErrorZ
21585 pub union CResult_OffersMessageDecodeErrorZPtr {
21586 /// A pointer to the contents in the success state.
21587 /// Reading from this pointer when `result_ok` is not set is undefined.
21588 pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
21589 /// A pointer to the contents in the error state.
21590 /// Reading from this pointer when `result_ok` is set is undefined.
21591 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21594 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
21595 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
21596 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21597 pub struct CResult_OffersMessageDecodeErrorZ {
21598 /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
21599 /// `err` or `result` depending on the state of `result_ok`.
21600 pub contents: CResult_OffersMessageDecodeErrorZPtr,
21601 /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
21602 pub result_ok: bool,
21605 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
21606 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
21607 CResult_OffersMessageDecodeErrorZ {
21608 contents: CResult_OffersMessageDecodeErrorZPtr {
21609 result: Box::into_raw(Box::new(o)),
21615 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
21616 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
21617 CResult_OffersMessageDecodeErrorZ {
21618 contents: CResult_OffersMessageDecodeErrorZPtr {
21619 err: Box::into_raw(Box::new(e)),
21624 /// Checks if the given object is currently in the success state
21626 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
21630 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
21631 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
21632 impl Drop for CResult_OffersMessageDecodeErrorZ {
21633 fn drop(&mut self) {
21634 if self.result_ok {
21635 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21636 let _ = unsafe { Box::from_raw(self.contents.result) };
21639 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21640 let _ = unsafe { Box::from_raw(self.contents.err) };
21645 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
21646 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
21647 let contents = if o.result_ok {
21648 let result = unsafe { o.contents.result };
21649 unsafe { o.contents.result = core::ptr::null_mut() };
21650 CResult_OffersMessageDecodeErrorZPtr { result }
21652 let err = unsafe { o.contents.err };
21653 unsafe { o.contents.err = core::ptr::null_mut(); }
21654 CResult_OffersMessageDecodeErrorZPtr { err }
21658 result_ok: o.result_ok,
21662 impl Clone for CResult_OffersMessageDecodeErrorZ {
21663 fn clone(&self) -> Self {
21664 if self.result_ok {
21665 Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
21666 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
21669 Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
21670 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21676 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
21677 /// but with all dynamically-allocated buffers duplicated in new buffers.
21678 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
21680 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
21681 pub enum COption_HTLCClaimZ {
21682 /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
21683 Some(crate::lightning::ln::chan_utils::HTLCClaim),
21684 /// When we're in this state, this COption_HTLCClaimZ contains nothing
21687 impl COption_HTLCClaimZ {
21688 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21689 if let Self::None = self { false } else { true }
21691 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21694 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
21695 if let Self::Some(v) = self { v } else { unreachable!() }
21699 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
21700 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
21701 COption_HTLCClaimZ::Some(o)
21704 /// Constructs a new COption_HTLCClaimZ containing nothing
21705 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
21706 COption_HTLCClaimZ::None
21709 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
21710 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
21712 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
21713 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21714 /// A pointer to the contents in the success state.
21715 /// Reading from this pointer when `result_ok` is not set is undefined.
21716 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
21717 /// A pointer to the contents in the error state.
21718 /// Reading from this pointer when `result_ok` is set is undefined.
21719 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21722 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
21723 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
21724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21725 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21726 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
21727 /// `err` or `result` depending on the state of `result_ok`.
21728 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
21729 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
21730 pub result_ok: bool,
21733 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
21734 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21735 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21736 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21737 result: Box::into_raw(Box::new(o)),
21743 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
21744 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21745 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21746 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21747 err: Box::into_raw(Box::new(e)),
21752 /// Checks if the given object is currently in the success state
21754 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
21758 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
21759 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
21760 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21761 fn drop(&mut self) {
21762 if self.result_ok {
21763 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21764 let _ = unsafe { Box::from_raw(self.contents.result) };
21767 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21768 let _ = unsafe { Box::from_raw(self.contents.err) };
21773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21774 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
21775 let contents = if o.result_ok {
21776 let result = unsafe { o.contents.result };
21777 unsafe { o.contents.result = core::ptr::null_mut() };
21778 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
21780 let err = unsafe { o.contents.err };
21781 unsafe { o.contents.err = core::ptr::null_mut(); }
21782 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
21786 result_ok: o.result_ok,
21790 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21791 fn clone(&self) -> Self {
21792 if self.result_ok {
21793 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21794 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
21797 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21798 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21804 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
21805 /// but with all dynamically-allocated buffers duplicated in new buffers.
21806 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
21808 /// The contents of CResult_TxCreationKeysDecodeErrorZ
21809 pub union CResult_TxCreationKeysDecodeErrorZPtr {
21810 /// A pointer to the contents in the success state.
21811 /// Reading from this pointer when `result_ok` is not set is undefined.
21812 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
21813 /// A pointer to the contents in the error state.
21814 /// Reading from this pointer when `result_ok` is set is undefined.
21815 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21818 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
21819 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
21820 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21821 pub struct CResult_TxCreationKeysDecodeErrorZ {
21822 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
21823 /// `err` or `result` depending on the state of `result_ok`.
21824 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
21825 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
21826 pub result_ok: bool,
21829 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
21830 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
21831 CResult_TxCreationKeysDecodeErrorZ {
21832 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21833 result: Box::into_raw(Box::new(o)),
21839 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
21840 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
21841 CResult_TxCreationKeysDecodeErrorZ {
21842 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21843 err: Box::into_raw(Box::new(e)),
21848 /// Checks if the given object is currently in the success state
21850 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
21854 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
21855 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
21856 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
21857 fn drop(&mut self) {
21858 if self.result_ok {
21859 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21860 let _ = unsafe { Box::from_raw(self.contents.result) };
21863 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21864 let _ = unsafe { Box::from_raw(self.contents.err) };
21869 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
21870 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
21871 let contents = if o.result_ok {
21872 let result = unsafe { o.contents.result };
21873 unsafe { o.contents.result = core::ptr::null_mut() };
21874 CResult_TxCreationKeysDecodeErrorZPtr { result }
21876 let err = unsafe { o.contents.err };
21877 unsafe { o.contents.err = core::ptr::null_mut(); }
21878 CResult_TxCreationKeysDecodeErrorZPtr { err }
21882 result_ok: o.result_ok,
21886 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
21887 fn clone(&self) -> Self {
21888 if self.result_ok {
21889 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21890 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
21893 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21894 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21900 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
21901 /// but with all dynamically-allocated buffers duplicated in new buffers.
21902 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
21904 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
21905 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
21906 /// A pointer to the contents in the success state.
21907 /// Reading from this pointer when `result_ok` is not set is undefined.
21908 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
21909 /// A pointer to the contents in the error state.
21910 /// Reading from this pointer when `result_ok` is set is undefined.
21911 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21914 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
21915 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
21916 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21917 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
21918 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
21919 /// `err` or `result` depending on the state of `result_ok`.
21920 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
21921 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
21922 pub result_ok: bool,
21925 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
21926 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
21927 CResult_ChannelPublicKeysDecodeErrorZ {
21928 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21929 result: Box::into_raw(Box::new(o)),
21935 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
21936 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
21937 CResult_ChannelPublicKeysDecodeErrorZ {
21938 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21939 err: Box::into_raw(Box::new(e)),
21944 /// Checks if the given object is currently in the success state
21946 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
21950 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
21951 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
21952 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
21953 fn drop(&mut self) {
21954 if self.result_ok {
21955 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21956 let _ = unsafe { Box::from_raw(self.contents.result) };
21959 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21960 let _ = unsafe { Box::from_raw(self.contents.err) };
21965 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
21966 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
21967 let contents = if o.result_ok {
21968 let result = unsafe { o.contents.result };
21969 unsafe { o.contents.result = core::ptr::null_mut() };
21970 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
21972 let err = unsafe { o.contents.err };
21973 unsafe { o.contents.err = core::ptr::null_mut(); }
21974 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
21978 result_ok: o.result_ok,
21982 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
21983 fn clone(&self) -> Self {
21984 if self.result_ok {
21985 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21986 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
21989 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21990 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21996 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
21997 /// but with all dynamically-allocated buffers duplicated in new buffers.
21998 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
22000 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
22001 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
22002 /// A pointer to the contents in the success state.
22003 /// Reading from this pointer when `result_ok` is not set is undefined.
22004 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
22005 /// A pointer to the contents in the error state.
22006 /// Reading from this pointer when `result_ok` is set is undefined.
22007 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22010 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
22011 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
22012 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22013 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
22014 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
22015 /// `err` or `result` depending on the state of `result_ok`.
22016 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
22017 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
22018 pub result_ok: bool,
22021 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
22022 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
22023 CResult_HTLCOutputInCommitmentDecodeErrorZ {
22024 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
22025 result: Box::into_raw(Box::new(o)),
22031 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
22032 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
22033 CResult_HTLCOutputInCommitmentDecodeErrorZ {
22034 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
22035 err: Box::into_raw(Box::new(e)),
22040 /// Checks if the given object is currently in the success state
22042 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
22046 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
22047 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
22048 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
22049 fn drop(&mut self) {
22050 if self.result_ok {
22051 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22052 let _ = unsafe { Box::from_raw(self.contents.result) };
22055 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22056 let _ = unsafe { Box::from_raw(self.contents.err) };
22061 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
22062 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
22063 let contents = if o.result_ok {
22064 let result = unsafe { o.contents.result };
22065 unsafe { o.contents.result = core::ptr::null_mut() };
22066 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
22068 let err = unsafe { o.contents.err };
22069 unsafe { o.contents.err = core::ptr::null_mut(); }
22070 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
22074 result_ok: o.result_ok,
22078 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
22079 fn clone(&self) -> Self {
22080 if self.result_ok {
22081 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
22082 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
22085 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
22086 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22092 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
22093 /// but with all dynamically-allocated buffers duplicated in new buffers.
22094 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
22096 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
22097 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
22098 /// A pointer to the contents in the success state.
22099 /// Reading from this pointer when `result_ok` is not set is undefined.
22100 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
22101 /// A pointer to the contents in the error state.
22102 /// Reading from this pointer when `result_ok` is set is undefined.
22103 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22106 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
22107 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
22108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22109 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22110 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
22111 /// `err` or `result` depending on the state of `result_ok`.
22112 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
22113 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
22114 pub result_ok: bool,
22117 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
22118 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22119 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22120 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
22121 result: Box::into_raw(Box::new(o)),
22127 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
22128 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22129 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22130 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
22131 err: Box::into_raw(Box::new(e)),
22136 /// Checks if the given object is currently in the success state
22138 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
22142 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
22143 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
22144 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22145 fn drop(&mut self) {
22146 if self.result_ok {
22147 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22148 let _ = unsafe { Box::from_raw(self.contents.result) };
22151 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22152 let _ = unsafe { Box::from_raw(self.contents.err) };
22157 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22158 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
22159 let contents = if o.result_ok {
22160 let result = unsafe { o.contents.result };
22161 unsafe { o.contents.result = core::ptr::null_mut() };
22162 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
22164 let err = unsafe { o.contents.err };
22165 unsafe { o.contents.err = core::ptr::null_mut(); }
22166 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
22170 result_ok: o.result_ok,
22174 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22175 fn clone(&self) -> Self {
22176 if self.result_ok {
22177 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
22178 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
22181 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
22182 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22188 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
22189 /// but with all dynamically-allocated buffers duplicated in new buffers.
22190 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
22192 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
22193 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
22194 /// A pointer to the contents in the success state.
22195 /// Reading from this pointer when `result_ok` is not set is undefined.
22196 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
22197 /// A pointer to the contents in the error state.
22198 /// Reading from this pointer when `result_ok` is set is undefined.
22199 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22202 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
22203 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
22204 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22205 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
22206 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
22207 /// `err` or `result` depending on the state of `result_ok`.
22208 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
22209 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
22210 pub result_ok: bool,
22213 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
22214 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
22215 CResult_ChannelTransactionParametersDecodeErrorZ {
22216 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
22217 result: Box::into_raw(Box::new(o)),
22223 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
22224 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
22225 CResult_ChannelTransactionParametersDecodeErrorZ {
22226 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
22227 err: Box::into_raw(Box::new(e)),
22232 /// Checks if the given object is currently in the success state
22234 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
22238 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
22239 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
22240 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
22241 fn drop(&mut self) {
22242 if self.result_ok {
22243 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22244 let _ = unsafe { Box::from_raw(self.contents.result) };
22247 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22248 let _ = unsafe { Box::from_raw(self.contents.err) };
22253 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
22254 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
22255 let contents = if o.result_ok {
22256 let result = unsafe { o.contents.result };
22257 unsafe { o.contents.result = core::ptr::null_mut() };
22258 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
22260 let err = unsafe { o.contents.err };
22261 unsafe { o.contents.err = core::ptr::null_mut(); }
22262 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
22266 result_ok: o.result_ok,
22270 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
22271 fn clone(&self) -> Self {
22272 if self.result_ok {
22273 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
22274 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
22277 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
22278 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22284 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
22285 /// but with all dynamically-allocated buffers duplicated in new buffers.
22286 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
22288 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
22289 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
22290 /// A pointer to the contents in the success state.
22291 /// Reading from this pointer when `result_ok` is not set is undefined.
22292 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
22293 /// A pointer to the contents in the error state.
22294 /// Reading from this pointer when `result_ok` is set is undefined.
22295 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22298 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
22299 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
22300 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22301 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
22302 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
22303 /// `err` or `result` depending on the state of `result_ok`.
22304 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
22305 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
22306 pub result_ok: bool,
22309 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
22310 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
22311 CResult_HolderCommitmentTransactionDecodeErrorZ {
22312 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
22313 result: Box::into_raw(Box::new(o)),
22319 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
22320 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
22321 CResult_HolderCommitmentTransactionDecodeErrorZ {
22322 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
22323 err: Box::into_raw(Box::new(e)),
22328 /// Checks if the given object is currently in the success state
22330 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
22334 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
22335 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
22336 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
22337 fn drop(&mut self) {
22338 if self.result_ok {
22339 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22340 let _ = unsafe { Box::from_raw(self.contents.result) };
22343 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22344 let _ = unsafe { Box::from_raw(self.contents.err) };
22349 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
22350 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
22351 let contents = if o.result_ok {
22352 let result = unsafe { o.contents.result };
22353 unsafe { o.contents.result = core::ptr::null_mut() };
22354 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
22356 let err = unsafe { o.contents.err };
22357 unsafe { o.contents.err = core::ptr::null_mut(); }
22358 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
22362 result_ok: o.result_ok,
22366 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
22367 fn clone(&self) -> Self {
22368 if self.result_ok {
22369 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
22370 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
22373 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
22374 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22380 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
22381 /// but with all dynamically-allocated buffers duplicated in new buffers.
22382 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
22384 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
22385 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
22386 /// A pointer to the contents in the success state.
22387 /// Reading from this pointer when `result_ok` is not set is undefined.
22388 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
22389 /// A pointer to the contents in the error state.
22390 /// Reading from this pointer when `result_ok` is set is undefined.
22391 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22394 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
22395 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
22396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22397 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
22398 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
22399 /// `err` or `result` depending on the state of `result_ok`.
22400 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
22401 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
22402 pub result_ok: bool,
22405 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
22406 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
22407 CResult_BuiltCommitmentTransactionDecodeErrorZ {
22408 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
22409 result: Box::into_raw(Box::new(o)),
22415 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
22416 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
22417 CResult_BuiltCommitmentTransactionDecodeErrorZ {
22418 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
22419 err: Box::into_raw(Box::new(e)),
22424 /// Checks if the given object is currently in the success state
22426 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
22430 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
22431 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
22432 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
22433 fn drop(&mut self) {
22434 if self.result_ok {
22435 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22436 let _ = unsafe { Box::from_raw(self.contents.result) };
22439 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22440 let _ = unsafe { Box::from_raw(self.contents.err) };
22445 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
22446 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
22447 let contents = if o.result_ok {
22448 let result = unsafe { o.contents.result };
22449 unsafe { o.contents.result = core::ptr::null_mut() };
22450 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
22452 let err = unsafe { o.contents.err };
22453 unsafe { o.contents.err = core::ptr::null_mut(); }
22454 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
22458 result_ok: o.result_ok,
22462 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
22463 fn clone(&self) -> Self {
22464 if self.result_ok {
22465 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
22466 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
22469 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
22470 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22476 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
22477 /// but with all dynamically-allocated buffers duplicated in new buffers.
22478 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
22480 /// The contents of CResult_TrustedClosingTransactionNoneZ
22481 pub union CResult_TrustedClosingTransactionNoneZPtr {
22482 /// A pointer to the contents in the success state.
22483 /// Reading from this pointer when `result_ok` is not set is undefined.
22484 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
22485 /// Note that this value is always NULL, as there are no contents in the Err variant
22486 pub err: *mut core::ffi::c_void,
22489 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
22490 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
22491 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22492 pub struct CResult_TrustedClosingTransactionNoneZ {
22493 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
22494 /// `err` or `result` depending on the state of `result_ok`.
22495 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
22496 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
22497 pub result_ok: bool,
22500 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
22501 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
22502 CResult_TrustedClosingTransactionNoneZ {
22503 contents: CResult_TrustedClosingTransactionNoneZPtr {
22504 result: Box::into_raw(Box::new(o)),
22510 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
22511 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
22512 CResult_TrustedClosingTransactionNoneZ {
22513 contents: CResult_TrustedClosingTransactionNoneZPtr {
22514 err: core::ptr::null_mut(),
22519 /// Checks if the given object is currently in the success state
22521 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
22525 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
22526 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
22527 impl Drop for CResult_TrustedClosingTransactionNoneZ {
22528 fn drop(&mut self) {
22529 if self.result_ok {
22530 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22531 let _ = unsafe { Box::from_raw(self.contents.result) };
22537 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
22538 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
22539 let contents = if o.result_ok {
22540 let result = unsafe { o.contents.result };
22541 unsafe { o.contents.result = core::ptr::null_mut() };
22542 CResult_TrustedClosingTransactionNoneZPtr { result }
22544 let _ = unsafe { Box::from_raw(o.contents.err) };
22545 o.contents.err = core::ptr::null_mut();
22546 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
22550 result_ok: o.result_ok,
22555 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
22556 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
22557 /// A pointer to the contents in the success state.
22558 /// Reading from this pointer when `result_ok` is not set is undefined.
22559 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
22560 /// A pointer to the contents in the error state.
22561 /// Reading from this pointer when `result_ok` is set is undefined.
22562 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22565 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
22566 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
22567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22568 pub struct CResult_CommitmentTransactionDecodeErrorZ {
22569 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
22570 /// `err` or `result` depending on the state of `result_ok`.
22571 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
22572 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
22573 pub result_ok: bool,
22576 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
22577 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
22578 CResult_CommitmentTransactionDecodeErrorZ {
22579 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22580 result: Box::into_raw(Box::new(o)),
22586 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
22587 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
22588 CResult_CommitmentTransactionDecodeErrorZ {
22589 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22590 err: Box::into_raw(Box::new(e)),
22595 /// Checks if the given object is currently in the success state
22597 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
22601 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
22602 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
22603 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
22604 fn drop(&mut self) {
22605 if self.result_ok {
22606 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22607 let _ = unsafe { Box::from_raw(self.contents.result) };
22610 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22611 let _ = unsafe { Box::from_raw(self.contents.err) };
22616 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
22617 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
22618 let contents = if o.result_ok {
22619 let result = unsafe { o.contents.result };
22620 unsafe { o.contents.result = core::ptr::null_mut() };
22621 CResult_CommitmentTransactionDecodeErrorZPtr { result }
22623 let err = unsafe { o.contents.err };
22624 unsafe { o.contents.err = core::ptr::null_mut(); }
22625 CResult_CommitmentTransactionDecodeErrorZPtr { err }
22629 result_ok: o.result_ok,
22633 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
22634 fn clone(&self) -> Self {
22635 if self.result_ok {
22636 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22637 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
22640 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22641 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22647 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
22648 /// but with all dynamically-allocated buffers duplicated in new buffers.
22649 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
22651 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
22652 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
22653 /// A pointer to the contents in the success state.
22654 /// Reading from this pointer when `result_ok` is not set is undefined.
22655 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
22656 /// Note that this value is always NULL, as there are no contents in the Err variant
22657 pub err: *mut core::ffi::c_void,
22660 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
22661 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
22662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22663 pub struct CResult_TrustedCommitmentTransactionNoneZ {
22664 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
22665 /// `err` or `result` depending on the state of `result_ok`.
22666 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
22667 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
22668 pub result_ok: bool,
22671 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
22672 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
22673 CResult_TrustedCommitmentTransactionNoneZ {
22674 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
22675 result: Box::into_raw(Box::new(o)),
22681 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
22682 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
22683 CResult_TrustedCommitmentTransactionNoneZ {
22684 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
22685 err: core::ptr::null_mut(),
22690 /// Checks if the given object is currently in the success state
22692 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
22696 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
22697 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
22698 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
22699 fn drop(&mut self) {
22700 if self.result_ok {
22701 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22702 let _ = unsafe { Box::from_raw(self.contents.result) };
22708 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
22709 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
22710 let contents = if o.result_ok {
22711 let result = unsafe { o.contents.result };
22712 unsafe { o.contents.result = core::ptr::null_mut() };
22713 CResult_TrustedCommitmentTransactionNoneZPtr { result }
22715 let _ = unsafe { Box::from_raw(o.contents.err) };
22716 o.contents.err = core::ptr::null_mut();
22717 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
22721 result_ok: o.result_ok,
22726 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
22727 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
22728 /// A pointer to the contents in the success state.
22729 /// Reading from this pointer when `result_ok` is not set is undefined.
22730 pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
22731 /// Note that this value is always NULL, as there are no contents in the Err variant
22732 pub err: *mut core::ffi::c_void,
22735 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
22736 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
22737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22738 pub struct CResult_CVec_ECDSASignatureZNoneZ {
22739 /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
22740 /// `err` or `result` depending on the state of `result_ok`.
22741 pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
22742 /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
22743 pub result_ok: bool,
22746 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
22747 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
22748 CResult_CVec_ECDSASignatureZNoneZ {
22749 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22750 result: Box::into_raw(Box::new(o)),
22756 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
22757 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
22758 CResult_CVec_ECDSASignatureZNoneZ {
22759 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22760 err: core::ptr::null_mut(),
22765 /// Checks if the given object is currently in the success state
22767 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
22771 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
22772 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
22773 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
22774 fn drop(&mut self) {
22775 if self.result_ok {
22776 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22777 let _ = unsafe { Box::from_raw(self.contents.result) };
22783 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
22784 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> Self {
22785 let contents = if o.result_ok {
22786 let result = unsafe { o.contents.result };
22787 unsafe { o.contents.result = core::ptr::null_mut() };
22788 CResult_CVec_ECDSASignatureZNoneZPtr { result }
22790 let _ = unsafe { Box::from_raw(o.contents.err) };
22791 o.contents.err = core::ptr::null_mut();
22792 CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
22796 result_ok: o.result_ok,
22800 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
22801 fn clone(&self) -> Self {
22802 if self.result_ok {
22803 Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22804 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
22807 Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22808 err: core::ptr::null_mut()
22814 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
22815 /// but with all dynamically-allocated buffers duplicated in new buffers.
22816 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
22819 /// An enum which can either contain a usize or not
22820 pub enum COption_usizeZ {
22821 /// When we're in this state, this COption_usizeZ contains a usize
22823 /// When we're in this state, this COption_usizeZ contains nothing
22826 impl COption_usizeZ {
22827 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22828 if let Self::None = self { false } else { true }
22830 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22833 #[allow(unused)] pub(crate) fn take(mut self) -> usize {
22834 if let Self::Some(v) = self { v } else { unreachable!() }
22838 /// Constructs a new COption_usizeZ containing a usize
22839 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
22840 COption_usizeZ::Some(o)
22843 /// Constructs a new COption_usizeZ containing nothing
22844 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
22845 COption_usizeZ::None
22848 /// Frees any resources associated with the usize, if we are in the Some state
22849 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
22851 /// Creates a new COption_usizeZ which has the same data as `orig`
22852 /// but with all dynamically-allocated buffers duplicated in new buffers.
22853 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
22855 /// The contents of CResult_ShutdownScriptDecodeErrorZ
22856 pub union CResult_ShutdownScriptDecodeErrorZPtr {
22857 /// A pointer to the contents in the success state.
22858 /// Reading from this pointer when `result_ok` is not set is undefined.
22859 pub result: *mut crate::lightning::ln::script::ShutdownScript,
22860 /// A pointer to the contents in the error state.
22861 /// Reading from this pointer when `result_ok` is set is undefined.
22862 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22865 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
22866 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
22867 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22868 pub struct CResult_ShutdownScriptDecodeErrorZ {
22869 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
22870 /// `err` or `result` depending on the state of `result_ok`.
22871 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
22872 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
22873 pub result_ok: bool,
22876 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
22877 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
22878 CResult_ShutdownScriptDecodeErrorZ {
22879 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22880 result: Box::into_raw(Box::new(o)),
22886 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
22887 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
22888 CResult_ShutdownScriptDecodeErrorZ {
22889 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22890 err: Box::into_raw(Box::new(e)),
22895 /// Checks if the given object is currently in the success state
22897 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
22901 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
22902 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
22903 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
22904 fn drop(&mut self) {
22905 if self.result_ok {
22906 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22907 let _ = unsafe { Box::from_raw(self.contents.result) };
22910 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22911 let _ = unsafe { Box::from_raw(self.contents.err) };
22916 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
22917 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
22918 let contents = if o.result_ok {
22919 let result = unsafe { o.contents.result };
22920 unsafe { o.contents.result = core::ptr::null_mut() };
22921 CResult_ShutdownScriptDecodeErrorZPtr { result }
22923 let err = unsafe { o.contents.err };
22924 unsafe { o.contents.err = core::ptr::null_mut(); }
22925 CResult_ShutdownScriptDecodeErrorZPtr { err }
22929 result_ok: o.result_ok,
22933 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
22934 fn clone(&self) -> Self {
22935 if self.result_ok {
22936 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22937 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
22940 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22941 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22947 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
22948 /// but with all dynamically-allocated buffers duplicated in new buffers.
22949 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
22951 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
22952 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22953 /// A pointer to the contents in the success state.
22954 /// Reading from this pointer when `result_ok` is not set is undefined.
22955 pub result: *mut crate::lightning::ln::script::ShutdownScript,
22956 /// A pointer to the contents in the error state.
22957 /// Reading from this pointer when `result_ok` is set is undefined.
22958 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
22961 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
22962 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
22963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22964 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
22965 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
22966 /// `err` or `result` depending on the state of `result_ok`.
22967 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
22968 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
22969 pub result_ok: bool,
22972 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
22973 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22974 CResult_ShutdownScriptInvalidShutdownScriptZ {
22975 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22976 result: Box::into_raw(Box::new(o)),
22982 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
22983 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22984 CResult_ShutdownScriptInvalidShutdownScriptZ {
22985 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22986 err: Box::into_raw(Box::new(e)),
22991 /// Checks if the given object is currently in the success state
22993 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
22997 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
22998 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
22999 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
23000 fn drop(&mut self) {
23001 if self.result_ok {
23002 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23003 let _ = unsafe { Box::from_raw(self.contents.result) };
23006 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23007 let _ = unsafe { Box::from_raw(self.contents.err) };
23012 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
23013 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
23014 let contents = if o.result_ok {
23015 let result = unsafe { o.contents.result };
23016 unsafe { o.contents.result = core::ptr::null_mut() };
23017 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
23019 let err = unsafe { o.contents.err };
23020 unsafe { o.contents.err = core::ptr::null_mut(); }
23021 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
23025 result_ok: o.result_ok,
23029 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
23030 fn clone(&self) -> Self {
23031 if self.result_ok {
23032 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
23033 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
23036 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
23037 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
23043 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
23044 /// but with all dynamically-allocated buffers duplicated in new buffers.
23045 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
23047 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
23048 /// This corresponds to std::vector in C++
23049 pub struct CVec_TransactionZ {
23050 /// The elements in the array.
23051 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23052 pub data: *mut crate::c_types::Transaction,
23053 /// The number of elements pointed to by `data`.
23056 impl CVec_TransactionZ {
23057 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
23058 if self.datalen == 0 { return Vec::new(); }
23059 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23060 self.data = core::ptr::null_mut();
23064 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
23065 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23068 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
23069 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
23070 let datalen = v.len();
23071 let data = Box::into_raw(v.into_boxed_slice());
23072 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23076 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23077 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
23078 impl Drop for CVec_TransactionZ {
23079 fn drop(&mut self) {
23080 if self.datalen == 0 { return; }
23081 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23084 impl Clone for CVec_TransactionZ {
23085 fn clone(&self) -> Self {
23086 let mut res = Vec::new();
23087 if self.datalen == 0 { return Self::from(res); }
23088 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23093 /// The contents of CResult_PaymentPurposeDecodeErrorZ
23094 pub union CResult_PaymentPurposeDecodeErrorZPtr {
23095 /// A pointer to the contents in the success state.
23096 /// Reading from this pointer when `result_ok` is not set is undefined.
23097 pub result: *mut crate::lightning::events::PaymentPurpose,
23098 /// A pointer to the contents in the error state.
23099 /// Reading from this pointer when `result_ok` is set is undefined.
23100 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23103 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
23104 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
23105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23106 pub struct CResult_PaymentPurposeDecodeErrorZ {
23107 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
23108 /// `err` or `result` depending on the state of `result_ok`.
23109 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
23110 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
23111 pub result_ok: bool,
23114 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
23115 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
23116 CResult_PaymentPurposeDecodeErrorZ {
23117 contents: CResult_PaymentPurposeDecodeErrorZPtr {
23118 result: Box::into_raw(Box::new(o)),
23124 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
23125 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
23126 CResult_PaymentPurposeDecodeErrorZ {
23127 contents: CResult_PaymentPurposeDecodeErrorZPtr {
23128 err: Box::into_raw(Box::new(e)),
23133 /// Checks if the given object is currently in the success state
23135 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
23139 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
23140 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
23141 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
23142 fn drop(&mut self) {
23143 if self.result_ok {
23144 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23145 let _ = unsafe { Box::from_raw(self.contents.result) };
23148 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23149 let _ = unsafe { Box::from_raw(self.contents.err) };
23154 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
23155 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
23156 let contents = if o.result_ok {
23157 let result = unsafe { o.contents.result };
23158 unsafe { o.contents.result = core::ptr::null_mut() };
23159 CResult_PaymentPurposeDecodeErrorZPtr { result }
23161 let err = unsafe { o.contents.err };
23162 unsafe { o.contents.err = core::ptr::null_mut(); }
23163 CResult_PaymentPurposeDecodeErrorZPtr { err }
23167 result_ok: o.result_ok,
23171 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
23172 fn clone(&self) -> Self {
23173 if self.result_ok {
23174 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
23175 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
23178 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
23179 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23185 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
23186 /// but with all dynamically-allocated buffers duplicated in new buffers.
23187 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
23189 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
23190 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
23191 /// A pointer to the contents in the success state.
23192 /// Reading from this pointer when `result_ok` is not set is undefined.
23193 pub result: *mut crate::lightning::events::ClaimedHTLC,
23194 /// A pointer to the contents in the error state.
23195 /// Reading from this pointer when `result_ok` is set is undefined.
23196 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23199 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
23200 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
23201 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23202 pub struct CResult_ClaimedHTLCDecodeErrorZ {
23203 /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
23204 /// `err` or `result` depending on the state of `result_ok`.
23205 pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
23206 /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
23207 pub result_ok: bool,
23210 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
23211 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
23212 CResult_ClaimedHTLCDecodeErrorZ {
23213 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
23214 result: Box::into_raw(Box::new(o)),
23220 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
23221 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
23222 CResult_ClaimedHTLCDecodeErrorZ {
23223 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
23224 err: Box::into_raw(Box::new(e)),
23229 /// Checks if the given object is currently in the success state
23231 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
23235 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
23236 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
23237 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
23238 fn drop(&mut self) {
23239 if self.result_ok {
23240 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23241 let _ = unsafe { Box::from_raw(self.contents.result) };
23244 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23245 let _ = unsafe { Box::from_raw(self.contents.err) };
23250 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
23251 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
23252 let contents = if o.result_ok {
23253 let result = unsafe { o.contents.result };
23254 unsafe { o.contents.result = core::ptr::null_mut() };
23255 CResult_ClaimedHTLCDecodeErrorZPtr { result }
23257 let err = unsafe { o.contents.err };
23258 unsafe { o.contents.err = core::ptr::null_mut(); }
23259 CResult_ClaimedHTLCDecodeErrorZPtr { err }
23263 result_ok: o.result_ok,
23267 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
23268 fn clone(&self) -> Self {
23269 if self.result_ok {
23270 Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
23271 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
23274 Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
23275 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23281 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
23282 /// but with all dynamically-allocated buffers duplicated in new buffers.
23283 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
23286 /// An enum which can either contain a crate::lightning::events::PathFailure or not
23287 pub enum COption_PathFailureZ {
23288 /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
23289 Some(crate::lightning::events::PathFailure),
23290 /// When we're in this state, this COption_PathFailureZ contains nothing
23293 impl COption_PathFailureZ {
23294 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23295 if let Self::None = self { false } else { true }
23297 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23300 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
23301 if let Self::Some(v) = self { v } else { unreachable!() }
23305 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
23306 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
23307 COption_PathFailureZ::Some(o)
23310 /// Constructs a new COption_PathFailureZ containing nothing
23311 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
23312 COption_PathFailureZ::None
23315 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
23316 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
23318 /// Creates a new COption_PathFailureZ which has the same data as `orig`
23319 /// but with all dynamically-allocated buffers duplicated in new buffers.
23320 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
23322 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
23323 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
23324 /// A pointer to the contents in the success state.
23325 /// Reading from this pointer when `result_ok` is not set is undefined.
23326 pub result: *mut crate::c_types::derived::COption_PathFailureZ,
23327 /// A pointer to the contents in the error state.
23328 /// Reading from this pointer when `result_ok` is set is undefined.
23329 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23332 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
23333 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23335 pub struct CResult_COption_PathFailureZDecodeErrorZ {
23336 /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
23337 /// `err` or `result` depending on the state of `result_ok`.
23338 pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
23339 /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
23340 pub result_ok: bool,
23343 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
23344 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
23345 CResult_COption_PathFailureZDecodeErrorZ {
23346 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
23347 result: Box::into_raw(Box::new(o)),
23353 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
23354 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
23355 CResult_COption_PathFailureZDecodeErrorZ {
23356 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
23357 err: Box::into_raw(Box::new(e)),
23362 /// Checks if the given object is currently in the success state
23364 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
23368 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
23369 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
23370 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
23371 fn drop(&mut self) {
23372 if self.result_ok {
23373 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23374 let _ = unsafe { Box::from_raw(self.contents.result) };
23377 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23378 let _ = unsafe { Box::from_raw(self.contents.err) };
23383 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
23384 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23385 let contents = if o.result_ok {
23386 let result = unsafe { o.contents.result };
23387 unsafe { o.contents.result = core::ptr::null_mut() };
23388 CResult_COption_PathFailureZDecodeErrorZPtr { result }
23390 let err = unsafe { o.contents.err };
23391 unsafe { o.contents.err = core::ptr::null_mut(); }
23392 CResult_COption_PathFailureZDecodeErrorZPtr { err }
23396 result_ok: o.result_ok,
23400 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
23401 fn clone(&self) -> Self {
23402 if self.result_ok {
23403 Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
23404 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
23407 Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
23408 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23414 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
23415 /// but with all dynamically-allocated buffers duplicated in new buffers.
23416 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
23419 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
23420 pub enum COption_ClosureReasonZ {
23421 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
23422 Some(crate::lightning::events::ClosureReason),
23423 /// When we're in this state, this COption_ClosureReasonZ contains nothing
23426 impl COption_ClosureReasonZ {
23427 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23428 if let Self::None = self { false } else { true }
23430 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23433 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
23434 if let Self::Some(v) = self { v } else { unreachable!() }
23438 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
23439 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
23440 COption_ClosureReasonZ::Some(o)
23443 /// Constructs a new COption_ClosureReasonZ containing nothing
23444 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
23445 COption_ClosureReasonZ::None
23448 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
23449 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
23451 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
23452 /// but with all dynamically-allocated buffers duplicated in new buffers.
23453 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
23455 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
23456 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
23457 /// A pointer to the contents in the success state.
23458 /// Reading from this pointer when `result_ok` is not set is undefined.
23459 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
23460 /// A pointer to the contents in the error state.
23461 /// Reading from this pointer when `result_ok` is set is undefined.
23462 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23465 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
23466 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23467 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23468 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
23469 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
23470 /// `err` or `result` depending on the state of `result_ok`.
23471 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
23472 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
23473 pub result_ok: bool,
23476 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
23477 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
23478 CResult_COption_ClosureReasonZDecodeErrorZ {
23479 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
23480 result: Box::into_raw(Box::new(o)),
23486 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
23487 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
23488 CResult_COption_ClosureReasonZDecodeErrorZ {
23489 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
23490 err: Box::into_raw(Box::new(e)),
23495 /// Checks if the given object is currently in the success state
23497 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
23501 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
23502 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
23503 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
23504 fn drop(&mut self) {
23505 if self.result_ok {
23506 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23507 let _ = unsafe { Box::from_raw(self.contents.result) };
23510 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23511 let _ = unsafe { Box::from_raw(self.contents.err) };
23516 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
23517 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23518 let contents = if o.result_ok {
23519 let result = unsafe { o.contents.result };
23520 unsafe { o.contents.result = core::ptr::null_mut() };
23521 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
23523 let err = unsafe { o.contents.err };
23524 unsafe { o.contents.err = core::ptr::null_mut(); }
23525 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
23529 result_ok: o.result_ok,
23533 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
23534 fn clone(&self) -> Self {
23535 if self.result_ok {
23536 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
23537 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
23540 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
23541 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23547 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
23548 /// but with all dynamically-allocated buffers duplicated in new buffers.
23549 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
23552 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
23553 pub enum COption_HTLCDestinationZ {
23554 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
23555 Some(crate::lightning::events::HTLCDestination),
23556 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
23559 impl COption_HTLCDestinationZ {
23560 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23561 if let Self::None = self { false } else { true }
23563 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23566 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
23567 if let Self::Some(v) = self { v } else { unreachable!() }
23571 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
23572 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
23573 COption_HTLCDestinationZ::Some(o)
23576 /// Constructs a new COption_HTLCDestinationZ containing nothing
23577 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
23578 COption_HTLCDestinationZ::None
23581 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
23582 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
23584 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
23585 /// but with all dynamically-allocated buffers duplicated in new buffers.
23586 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
23588 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
23589 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23590 /// A pointer to the contents in the success state.
23591 /// Reading from this pointer when `result_ok` is not set is undefined.
23592 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
23593 /// A pointer to the contents in the error state.
23594 /// Reading from this pointer when `result_ok` is set is undefined.
23595 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23598 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
23599 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23600 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23601 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
23602 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
23603 /// `err` or `result` depending on the state of `result_ok`.
23604 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
23605 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
23606 pub result_ok: bool,
23609 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
23610 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
23611 CResult_COption_HTLCDestinationZDecodeErrorZ {
23612 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23613 result: Box::into_raw(Box::new(o)),
23619 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
23620 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
23621 CResult_COption_HTLCDestinationZDecodeErrorZ {
23622 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23623 err: Box::into_raw(Box::new(e)),
23628 /// Checks if the given object is currently in the success state
23630 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
23634 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
23635 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
23636 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
23637 fn drop(&mut self) {
23638 if self.result_ok {
23639 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23640 let _ = unsafe { Box::from_raw(self.contents.result) };
23643 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23644 let _ = unsafe { Box::from_raw(self.contents.err) };
23649 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
23650 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23651 let contents = if o.result_ok {
23652 let result = unsafe { o.contents.result };
23653 unsafe { o.contents.result = core::ptr::null_mut() };
23654 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
23656 let err = unsafe { o.contents.err };
23657 unsafe { o.contents.err = core::ptr::null_mut(); }
23658 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
23662 result_ok: o.result_ok,
23666 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
23667 fn clone(&self) -> Self {
23668 if self.result_ok {
23669 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23670 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
23673 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23674 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23680 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
23681 /// but with all dynamically-allocated buffers duplicated in new buffers.
23682 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
23684 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
23685 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
23686 /// A pointer to the contents in the success state.
23687 /// Reading from this pointer when `result_ok` is not set is undefined.
23688 pub result: *mut crate::lightning::events::PaymentFailureReason,
23689 /// A pointer to the contents in the error state.
23690 /// Reading from this pointer when `result_ok` is set is undefined.
23691 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23694 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
23695 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
23696 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23697 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
23698 /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
23699 /// `err` or `result` depending on the state of `result_ok`.
23700 pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
23701 /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
23702 pub result_ok: bool,
23705 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
23706 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
23707 CResult_PaymentFailureReasonDecodeErrorZ {
23708 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23709 result: Box::into_raw(Box::new(o)),
23715 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
23716 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
23717 CResult_PaymentFailureReasonDecodeErrorZ {
23718 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23719 err: Box::into_raw(Box::new(e)),
23724 /// Checks if the given object is currently in the success state
23726 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
23730 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
23731 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
23732 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
23733 fn drop(&mut self) {
23734 if self.result_ok {
23735 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23736 let _ = unsafe { Box::from_raw(self.contents.result) };
23739 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23740 let _ = unsafe { Box::from_raw(self.contents.err) };
23745 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
23746 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
23747 let contents = if o.result_ok {
23748 let result = unsafe { o.contents.result };
23749 unsafe { o.contents.result = core::ptr::null_mut() };
23750 CResult_PaymentFailureReasonDecodeErrorZPtr { result }
23752 let err = unsafe { o.contents.err };
23753 unsafe { o.contents.err = core::ptr::null_mut(); }
23754 CResult_PaymentFailureReasonDecodeErrorZPtr { err }
23758 result_ok: o.result_ok,
23762 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
23763 fn clone(&self) -> Self {
23764 if self.result_ok {
23765 Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23766 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
23769 Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23770 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23776 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
23777 /// but with all dynamically-allocated buffers duplicated in new buffers.
23778 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
23781 /// An enum which can either contain a crate::c_types::U128 or not
23782 pub enum COption_U128Z {
23783 /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
23784 Some(crate::c_types::U128),
23785 /// When we're in this state, this COption_U128Z contains nothing
23788 impl COption_U128Z {
23789 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23790 if let Self::None = self { false } else { true }
23792 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23795 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
23796 if let Self::Some(v) = self { v } else { unreachable!() }
23800 /// Constructs a new COption_U128Z containing a crate::c_types::U128
23801 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
23802 COption_U128Z::Some(o)
23805 /// Constructs a new COption_U128Z containing nothing
23806 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
23807 COption_U128Z::None
23810 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
23811 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
23813 /// Creates a new COption_U128Z which has the same data as `orig`
23814 /// but with all dynamically-allocated buffers duplicated in new buffers.
23815 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
23817 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
23818 /// This corresponds to std::vector in C++
23819 pub struct CVec_ClaimedHTLCZ {
23820 /// The elements in the array.
23821 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23822 pub data: *mut crate::lightning::events::ClaimedHTLC,
23823 /// The number of elements pointed to by `data`.
23826 impl CVec_ClaimedHTLCZ {
23827 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
23828 if self.datalen == 0 { return Vec::new(); }
23829 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23830 self.data = core::ptr::null_mut();
23834 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
23835 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23838 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
23839 fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
23840 let datalen = v.len();
23841 let data = Box::into_raw(v.into_boxed_slice());
23842 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23846 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23847 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
23848 impl Drop for CVec_ClaimedHTLCZ {
23849 fn drop(&mut self) {
23850 if self.datalen == 0 { return; }
23851 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23854 impl Clone for CVec_ClaimedHTLCZ {
23855 fn clone(&self) -> Self {
23856 let mut res = Vec::new();
23857 if self.datalen == 0 { return Self::from(res); }
23858 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23864 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
23865 pub enum COption_PaymentFailureReasonZ {
23866 /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
23867 Some(crate::lightning::events::PaymentFailureReason),
23868 /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
23871 impl COption_PaymentFailureReasonZ {
23872 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23873 if let Self::None = self { false } else { true }
23875 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23878 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
23879 if let Self::Some(v) = self { v } else { unreachable!() }
23883 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
23884 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
23885 COption_PaymentFailureReasonZ::Some(o)
23888 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
23889 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
23890 COption_PaymentFailureReasonZ::None
23893 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
23894 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
23896 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
23897 /// but with all dynamically-allocated buffers duplicated in new buffers.
23898 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
23901 /// An enum which can either contain a crate::lightning::events::Event or not
23902 pub enum COption_EventZ {
23903 /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
23904 Some(crate::lightning::events::Event),
23905 /// When we're in this state, this COption_EventZ contains nothing
23908 impl COption_EventZ {
23909 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23910 if let Self::None = self { false } else { true }
23912 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23915 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
23916 if let Self::Some(v) = self { v } else { unreachable!() }
23920 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
23921 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
23922 COption_EventZ::Some(o)
23925 /// Constructs a new COption_EventZ containing nothing
23926 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
23927 COption_EventZ::None
23930 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
23931 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
23933 /// Creates a new COption_EventZ which has the same data as `orig`
23934 /// but with all dynamically-allocated buffers duplicated in new buffers.
23935 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
23937 /// The contents of CResult_COption_EventZDecodeErrorZ
23938 pub union CResult_COption_EventZDecodeErrorZPtr {
23939 /// A pointer to the contents in the success state.
23940 /// Reading from this pointer when `result_ok` is not set is undefined.
23941 pub result: *mut crate::c_types::derived::COption_EventZ,
23942 /// A pointer to the contents in the error state.
23943 /// Reading from this pointer when `result_ok` is set is undefined.
23944 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23947 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
23948 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23949 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23950 pub struct CResult_COption_EventZDecodeErrorZ {
23951 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
23952 /// `err` or `result` depending on the state of `result_ok`.
23953 pub contents: CResult_COption_EventZDecodeErrorZPtr,
23954 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
23955 pub result_ok: bool,
23958 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
23959 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
23960 CResult_COption_EventZDecodeErrorZ {
23961 contents: CResult_COption_EventZDecodeErrorZPtr {
23962 result: Box::into_raw(Box::new(o)),
23968 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
23969 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
23970 CResult_COption_EventZDecodeErrorZ {
23971 contents: CResult_COption_EventZDecodeErrorZPtr {
23972 err: Box::into_raw(Box::new(e)),
23977 /// Checks if the given object is currently in the success state
23979 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
23983 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
23984 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
23985 impl Drop for CResult_COption_EventZDecodeErrorZ {
23986 fn drop(&mut self) {
23987 if self.result_ok {
23988 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23989 let _ = unsafe { Box::from_raw(self.contents.result) };
23992 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23993 let _ = unsafe { Box::from_raw(self.contents.err) };
23998 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
23999 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
24000 let contents = if o.result_ok {
24001 let result = unsafe { o.contents.result };
24002 unsafe { o.contents.result = core::ptr::null_mut() };
24003 CResult_COption_EventZDecodeErrorZPtr { result }
24005 let err = unsafe { o.contents.err };
24006 unsafe { o.contents.err = core::ptr::null_mut(); }
24007 CResult_COption_EventZDecodeErrorZPtr { err }
24011 result_ok: o.result_ok,
24015 impl Clone for CResult_COption_EventZDecodeErrorZ {
24016 fn clone(&self) -> Self {
24017 if self.result_ok {
24018 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
24019 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
24022 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
24023 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24029 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
24030 /// but with all dynamically-allocated buffers duplicated in new buffers.
24031 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
24033 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
24034 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
24035 /// A pointer to the contents in the success state.
24036 /// Reading from this pointer when `result_ok` is not set is undefined.
24037 pub result: *mut crate::lightning_invoice::SiPrefix,
24038 /// A pointer to the contents in the error state.
24039 /// Reading from this pointer when `result_ok` is set is undefined.
24040 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
24043 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
24044 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
24045 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24046 pub struct CResult_SiPrefixBolt11ParseErrorZ {
24047 /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
24048 /// `err` or `result` depending on the state of `result_ok`.
24049 pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
24050 /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
24051 pub result_ok: bool,
24054 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
24055 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
24056 CResult_SiPrefixBolt11ParseErrorZ {
24057 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
24058 result: Box::into_raw(Box::new(o)),
24064 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
24065 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
24066 CResult_SiPrefixBolt11ParseErrorZ {
24067 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
24068 err: Box::into_raw(Box::new(e)),
24073 /// Checks if the given object is currently in the success state
24075 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
24079 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
24080 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
24081 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
24082 fn drop(&mut self) {
24083 if self.result_ok {
24084 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24085 let _ = unsafe { Box::from_raw(self.contents.result) };
24088 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24089 let _ = unsafe { Box::from_raw(self.contents.err) };
24094 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
24095 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
24096 let contents = if o.result_ok {
24097 let result = unsafe { o.contents.result };
24098 unsafe { o.contents.result = core::ptr::null_mut() };
24099 CResult_SiPrefixBolt11ParseErrorZPtr { result }
24101 let err = unsafe { o.contents.err };
24102 unsafe { o.contents.err = core::ptr::null_mut(); }
24103 CResult_SiPrefixBolt11ParseErrorZPtr { err }
24107 result_ok: o.result_ok,
24111 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
24112 fn clone(&self) -> Self {
24113 if self.result_ok {
24114 Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
24115 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
24118 Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
24119 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
24125 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
24126 /// but with all dynamically-allocated buffers duplicated in new buffers.
24127 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
24129 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
24130 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
24131 /// A pointer to the contents in the success state.
24132 /// Reading from this pointer when `result_ok` is not set is undefined.
24133 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
24134 /// A pointer to the contents in the error state.
24135 /// Reading from this pointer when `result_ok` is set is undefined.
24136 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
24139 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
24140 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
24141 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24142 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24143 /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
24144 /// `err` or `result` depending on the state of `result_ok`.
24145 pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
24146 /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
24147 pub result_ok: bool,
24150 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
24151 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24152 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24153 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
24154 result: Box::into_raw(Box::new(o)),
24160 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
24161 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24162 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24163 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
24164 err: Box::into_raw(Box::new(e)),
24169 /// Checks if the given object is currently in the success state
24171 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
24175 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
24176 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
24177 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24178 fn drop(&mut self) {
24179 if self.result_ok {
24180 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24181 let _ = unsafe { Box::from_raw(self.contents.result) };
24184 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24185 let _ = unsafe { Box::from_raw(self.contents.err) };
24190 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24191 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
24192 let contents = if o.result_ok {
24193 let result = unsafe { o.contents.result };
24194 unsafe { o.contents.result = core::ptr::null_mut() };
24195 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
24197 let err = unsafe { o.contents.err };
24198 unsafe { o.contents.err = core::ptr::null_mut(); }
24199 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
24203 result_ok: o.result_ok,
24207 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24208 fn clone(&self) -> Self {
24209 if self.result_ok {
24210 Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
24211 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
24214 Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
24215 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
24221 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
24222 /// but with all dynamically-allocated buffers duplicated in new buffers.
24223 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
24225 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
24226 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
24227 /// A pointer to the contents in the success state.
24228 /// Reading from this pointer when `result_ok` is not set is undefined.
24229 pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
24230 /// A pointer to the contents in the error state.
24231 /// Reading from this pointer when `result_ok` is set is undefined.
24232 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
24235 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
24236 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
24237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24238 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24239 /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
24240 /// `err` or `result` depending on the state of `result_ok`.
24241 pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
24242 /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
24243 pub result_ok: bool,
24246 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
24247 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24248 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24249 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
24250 result: Box::into_raw(Box::new(o)),
24256 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
24257 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24258 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24259 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
24260 err: Box::into_raw(Box::new(e)),
24265 /// Checks if the given object is currently in the success state
24267 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
24271 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
24272 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
24273 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24274 fn drop(&mut self) {
24275 if self.result_ok {
24276 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24277 let _ = unsafe { Box::from_raw(self.contents.result) };
24280 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24281 let _ = unsafe { Box::from_raw(self.contents.err) };
24286 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24287 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
24288 let contents = if o.result_ok {
24289 let result = unsafe { o.contents.result };
24290 unsafe { o.contents.result = core::ptr::null_mut() };
24291 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
24293 let err = unsafe { o.contents.err };
24294 unsafe { o.contents.err = core::ptr::null_mut(); }
24295 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
24299 result_ok: o.result_ok,
24303 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24304 fn clone(&self) -> Self {
24305 if self.result_ok {
24306 Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
24307 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
24310 Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
24311 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
24317 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
24318 /// but with all dynamically-allocated buffers duplicated in new buffers.
24319 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
24321 /// A tuple of 3 elements. See the individual fields for the types contained.
24322 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
24323 /// The element at position 0
24324 pub a: crate::lightning_invoice::RawBolt11Invoice,
24325 /// The element at position 1
24326 pub b: crate::c_types::ThirtyTwoBytes,
24327 /// The element at position 2
24328 pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
24330 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
24331 fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
24339 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
24340 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
24341 (self.a, self.b, self.c)
24344 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
24345 fn clone(&self) -> Self {
24347 a: Clone::clone(&self.a),
24348 b: Clone::clone(&self.b),
24349 c: Clone::clone(&self.c),
24354 /// Creates a new tuple which has the same data as `orig`
24355 /// but with all dynamically-allocated buffers duplicated in new buffers.
24356 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
24357 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
24359 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 {
24360 C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
24364 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
24365 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
24367 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
24368 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
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_invoice::PayeePubKey,
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::c_types::Secp256k1Error,
24377 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
24378 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
24379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24380 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
24381 /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
24382 /// `err` or `result` depending on the state of `result_ok`.
24383 pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
24384 /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
24385 pub result_ok: bool,
24388 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
24389 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
24390 CResult_PayeePubKeySecp256k1ErrorZ {
24391 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
24392 result: Box::into_raw(Box::new(o)),
24398 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
24399 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
24400 CResult_PayeePubKeySecp256k1ErrorZ {
24401 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
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_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
24413 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
24414 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
24415 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
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_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
24429 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> 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_PayeePubKeySecp256k1ErrorZPtr { result }
24435 let err = unsafe { o.contents.err };
24436 unsafe { o.contents.err = core::ptr::null_mut(); }
24437 CResult_PayeePubKeySecp256k1ErrorZPtr { err }
24441 result_ok: o.result_ok,
24445 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
24446 fn clone(&self) -> Self {
24447 if self.result_ok {
24448 Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
24449 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
24452 Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
24453 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
24459 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
24460 /// but with all dynamically-allocated buffers duplicated in new buffers.
24461 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
24463 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
24464 /// This corresponds to std::vector in C++
24465 pub struct CVec_PrivateRouteZ {
24466 /// The elements in the array.
24467 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
24468 pub data: *mut crate::lightning_invoice::PrivateRoute,
24469 /// The number of elements pointed to by `data`.
24472 impl CVec_PrivateRouteZ {
24473 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
24474 if self.datalen == 0 { return Vec::new(); }
24475 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
24476 self.data = core::ptr::null_mut();
24480 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
24481 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
24484 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
24485 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
24486 let datalen = v.len();
24487 let data = Box::into_raw(v.into_boxed_slice());
24488 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
24492 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
24493 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
24494 impl Drop for CVec_PrivateRouteZ {
24495 fn drop(&mut self) {
24496 if self.datalen == 0 { return; }
24497 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
24500 impl Clone for CVec_PrivateRouteZ {
24501 fn clone(&self) -> Self {
24502 let mut res = Vec::new();
24503 if self.datalen == 0 { return Self::from(res); }
24504 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
24509 /// The contents of CResult_PositiveTimestampCreationErrorZ
24510 pub union CResult_PositiveTimestampCreationErrorZPtr {
24511 /// A pointer to the contents in the success state.
24512 /// Reading from this pointer when `result_ok` is not set is undefined.
24513 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
24514 /// A pointer to the contents in the error state.
24515 /// Reading from this pointer when `result_ok` is set is undefined.
24516 pub err: *mut crate::lightning_invoice::CreationError,
24519 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
24520 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
24521 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24522 pub struct CResult_PositiveTimestampCreationErrorZ {
24523 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
24524 /// `err` or `result` depending on the state of `result_ok`.
24525 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
24526 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
24527 pub result_ok: bool,
24530 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
24531 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
24532 CResult_PositiveTimestampCreationErrorZ {
24533 contents: CResult_PositiveTimestampCreationErrorZPtr {
24534 result: Box::into_raw(Box::new(o)),
24540 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
24541 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
24542 CResult_PositiveTimestampCreationErrorZ {
24543 contents: CResult_PositiveTimestampCreationErrorZPtr {
24544 err: Box::into_raw(Box::new(e)),
24549 /// Checks if the given object is currently in the success state
24551 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
24555 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
24556 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
24557 impl Drop for CResult_PositiveTimestampCreationErrorZ {
24558 fn drop(&mut self) {
24559 if self.result_ok {
24560 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24561 let _ = unsafe { Box::from_raw(self.contents.result) };
24564 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24565 let _ = unsafe { Box::from_raw(self.contents.err) };
24570 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
24571 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
24572 let contents = if o.result_ok {
24573 let result = unsafe { o.contents.result };
24574 unsafe { o.contents.result = core::ptr::null_mut() };
24575 CResult_PositiveTimestampCreationErrorZPtr { result }
24577 let err = unsafe { o.contents.err };
24578 unsafe { o.contents.err = core::ptr::null_mut(); }
24579 CResult_PositiveTimestampCreationErrorZPtr { err }
24583 result_ok: o.result_ok,
24587 impl Clone for CResult_PositiveTimestampCreationErrorZ {
24588 fn clone(&self) -> Self {
24589 if self.result_ok {
24590 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
24591 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
24594 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
24595 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24601 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
24602 /// but with all dynamically-allocated buffers duplicated in new buffers.
24603 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
24605 /// The contents of CResult_NoneBolt11SemanticErrorZ
24606 pub union CResult_NoneBolt11SemanticErrorZPtr {
24607 /// Note that this value is always NULL, as there are no contents in the OK variant
24608 pub result: *mut core::ffi::c_void,
24609 /// A pointer to the contents in the error state.
24610 /// Reading from this pointer when `result_ok` is set is undefined.
24611 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
24614 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
24615 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
24616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24617 pub struct CResult_NoneBolt11SemanticErrorZ {
24618 /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
24619 /// `err` or `result` depending on the state of `result_ok`.
24620 pub contents: CResult_NoneBolt11SemanticErrorZPtr,
24621 /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
24622 pub result_ok: bool,
24625 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
24626 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
24627 CResult_NoneBolt11SemanticErrorZ {
24628 contents: CResult_NoneBolt11SemanticErrorZPtr {
24629 result: core::ptr::null_mut(),
24635 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
24636 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
24637 CResult_NoneBolt11SemanticErrorZ {
24638 contents: CResult_NoneBolt11SemanticErrorZPtr {
24639 err: Box::into_raw(Box::new(e)),
24644 /// Checks if the given object is currently in the success state
24646 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
24650 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
24651 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
24652 impl Drop for CResult_NoneBolt11SemanticErrorZ {
24653 fn drop(&mut self) {
24654 if self.result_ok {
24656 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24657 let _ = unsafe { Box::from_raw(self.contents.err) };
24662 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
24663 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
24664 let contents = if o.result_ok {
24665 let _ = unsafe { Box::from_raw(o.contents.result) };
24666 o.contents.result = core::ptr::null_mut();
24667 CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
24669 let err = unsafe { o.contents.err };
24670 unsafe { o.contents.err = core::ptr::null_mut(); }
24671 CResult_NoneBolt11SemanticErrorZPtr { err }
24675 result_ok: o.result_ok,
24679 impl Clone for CResult_NoneBolt11SemanticErrorZ {
24680 fn clone(&self) -> Self {
24681 if self.result_ok {
24682 Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
24683 result: core::ptr::null_mut()
24686 Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
24687 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
24693 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
24694 /// but with all dynamically-allocated buffers duplicated in new buffers.
24695 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
24697 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
24698 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24699 /// A pointer to the contents in the success state.
24700 /// Reading from this pointer when `result_ok` is not set is undefined.
24701 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
24702 /// A pointer to the contents in the error state.
24703 /// Reading from this pointer when `result_ok` is set is undefined.
24704 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
24707 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
24708 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
24709 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24710 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24711 /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
24712 /// `err` or `result` depending on the state of `result_ok`.
24713 pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
24714 /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
24715 pub result_ok: bool,
24718 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
24719 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24720 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24721 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24722 result: Box::into_raw(Box::new(o)),
24728 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
24729 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24730 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24731 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24732 err: Box::into_raw(Box::new(e)),
24737 /// Checks if the given object is currently in the success state
24739 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
24743 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
24744 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
24745 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24746 fn drop(&mut self) {
24747 if self.result_ok {
24748 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24749 let _ = unsafe { Box::from_raw(self.contents.result) };
24752 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24753 let _ = unsafe { Box::from_raw(self.contents.err) };
24758 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24759 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
24760 let contents = if o.result_ok {
24761 let result = unsafe { o.contents.result };
24762 unsafe { o.contents.result = core::ptr::null_mut() };
24763 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
24765 let err = unsafe { o.contents.err };
24766 unsafe { o.contents.err = core::ptr::null_mut(); }
24767 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
24771 result_ok: o.result_ok,
24775 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24776 fn clone(&self) -> Self {
24777 if self.result_ok {
24778 Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24779 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
24782 Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24783 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
24789 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
24790 /// but with all dynamically-allocated buffers duplicated in new buffers.
24791 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
24793 /// The contents of CResult_DescriptionCreationErrorZ
24794 pub union CResult_DescriptionCreationErrorZPtr {
24795 /// A pointer to the contents in the success state.
24796 /// Reading from this pointer when `result_ok` is not set is undefined.
24797 pub result: *mut crate::lightning_invoice::Description,
24798 /// A pointer to the contents in the error state.
24799 /// Reading from this pointer when `result_ok` is set is undefined.
24800 pub err: *mut crate::lightning_invoice::CreationError,
24803 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
24804 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
24805 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24806 pub struct CResult_DescriptionCreationErrorZ {
24807 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
24808 /// `err` or `result` depending on the state of `result_ok`.
24809 pub contents: CResult_DescriptionCreationErrorZPtr,
24810 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
24811 pub result_ok: bool,
24814 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
24815 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
24816 CResult_DescriptionCreationErrorZ {
24817 contents: CResult_DescriptionCreationErrorZPtr {
24818 result: Box::into_raw(Box::new(o)),
24824 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
24825 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
24826 CResult_DescriptionCreationErrorZ {
24827 contents: CResult_DescriptionCreationErrorZPtr {
24828 err: Box::into_raw(Box::new(e)),
24833 /// Checks if the given object is currently in the success state
24835 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
24839 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
24840 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
24841 impl Drop for CResult_DescriptionCreationErrorZ {
24842 fn drop(&mut self) {
24843 if self.result_ok {
24844 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24845 let _ = unsafe { Box::from_raw(self.contents.result) };
24848 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24849 let _ = unsafe { Box::from_raw(self.contents.err) };
24854 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
24855 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
24856 let contents = if o.result_ok {
24857 let result = unsafe { o.contents.result };
24858 unsafe { o.contents.result = core::ptr::null_mut() };
24859 CResult_DescriptionCreationErrorZPtr { result }
24861 let err = unsafe { o.contents.err };
24862 unsafe { o.contents.err = core::ptr::null_mut(); }
24863 CResult_DescriptionCreationErrorZPtr { err }
24867 result_ok: o.result_ok,
24871 impl Clone for CResult_DescriptionCreationErrorZ {
24872 fn clone(&self) -> Self {
24873 if self.result_ok {
24874 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
24875 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
24878 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
24879 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24885 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
24886 /// but with all dynamically-allocated buffers duplicated in new buffers.
24887 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
24889 /// The contents of CResult_PrivateRouteCreationErrorZ
24890 pub union CResult_PrivateRouteCreationErrorZPtr {
24891 /// A pointer to the contents in the success state.
24892 /// Reading from this pointer when `result_ok` is not set is undefined.
24893 pub result: *mut crate::lightning_invoice::PrivateRoute,
24894 /// A pointer to the contents in the error state.
24895 /// Reading from this pointer when `result_ok` is set is undefined.
24896 pub err: *mut crate::lightning_invoice::CreationError,
24899 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
24900 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
24901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24902 pub struct CResult_PrivateRouteCreationErrorZ {
24903 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
24904 /// `err` or `result` depending on the state of `result_ok`.
24905 pub contents: CResult_PrivateRouteCreationErrorZPtr,
24906 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
24907 pub result_ok: bool,
24910 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
24911 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
24912 CResult_PrivateRouteCreationErrorZ {
24913 contents: CResult_PrivateRouteCreationErrorZPtr {
24914 result: Box::into_raw(Box::new(o)),
24920 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
24921 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
24922 CResult_PrivateRouteCreationErrorZ {
24923 contents: CResult_PrivateRouteCreationErrorZPtr {
24924 err: Box::into_raw(Box::new(e)),
24929 /// Checks if the given object is currently in the success state
24931 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
24935 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
24936 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
24937 impl Drop for CResult_PrivateRouteCreationErrorZ {
24938 fn drop(&mut self) {
24939 if self.result_ok {
24940 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24941 let _ = unsafe { Box::from_raw(self.contents.result) };
24944 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24945 let _ = unsafe { Box::from_raw(self.contents.err) };
24950 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
24951 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
24952 let contents = if o.result_ok {
24953 let result = unsafe { o.contents.result };
24954 unsafe { o.contents.result = core::ptr::null_mut() };
24955 CResult_PrivateRouteCreationErrorZPtr { result }
24957 let err = unsafe { o.contents.err };
24958 unsafe { o.contents.err = core::ptr::null_mut(); }
24959 CResult_PrivateRouteCreationErrorZPtr { err }
24963 result_ok: o.result_ok,
24967 impl Clone for CResult_PrivateRouteCreationErrorZ {
24968 fn clone(&self) -> Self {
24969 if self.result_ok {
24970 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
24971 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
24974 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
24975 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24981 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
24982 /// but with all dynamically-allocated buffers duplicated in new buffers.
24983 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
24985 /// The contents of CResult_OutPointDecodeErrorZ
24986 pub union CResult_OutPointDecodeErrorZPtr {
24987 /// A pointer to the contents in the success state.
24988 /// Reading from this pointer when `result_ok` is not set is undefined.
24989 pub result: *mut crate::lightning::chain::transaction::OutPoint,
24990 /// A pointer to the contents in the error state.
24991 /// Reading from this pointer when `result_ok` is set is undefined.
24992 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24995 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
24996 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
24997 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24998 pub struct CResult_OutPointDecodeErrorZ {
24999 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
25000 /// `err` or `result` depending on the state of `result_ok`.
25001 pub contents: CResult_OutPointDecodeErrorZPtr,
25002 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
25003 pub result_ok: bool,
25006 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
25007 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
25008 CResult_OutPointDecodeErrorZ {
25009 contents: CResult_OutPointDecodeErrorZPtr {
25010 result: Box::into_raw(Box::new(o)),
25016 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
25017 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
25018 CResult_OutPointDecodeErrorZ {
25019 contents: CResult_OutPointDecodeErrorZPtr {
25020 err: Box::into_raw(Box::new(e)),
25025 /// Checks if the given object is currently in the success state
25027 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
25031 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
25032 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
25033 impl Drop for CResult_OutPointDecodeErrorZ {
25034 fn drop(&mut self) {
25035 if self.result_ok {
25036 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25037 let _ = unsafe { Box::from_raw(self.contents.result) };
25040 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25041 let _ = unsafe { Box::from_raw(self.contents.err) };
25046 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
25047 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
25048 let contents = if o.result_ok {
25049 let result = unsafe { o.contents.result };
25050 unsafe { o.contents.result = core::ptr::null_mut() };
25051 CResult_OutPointDecodeErrorZPtr { result }
25053 let err = unsafe { o.contents.err };
25054 unsafe { o.contents.err = core::ptr::null_mut(); }
25055 CResult_OutPointDecodeErrorZPtr { err }
25059 result_ok: o.result_ok,
25063 impl Clone for CResult_OutPointDecodeErrorZ {
25064 fn clone(&self) -> Self {
25065 if self.result_ok {
25066 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
25067 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
25070 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
25071 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25077 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
25078 /// but with all dynamically-allocated buffers duplicated in new buffers.
25079 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
25081 /// The contents of CResult_BigSizeDecodeErrorZ
25082 pub union CResult_BigSizeDecodeErrorZPtr {
25083 /// A pointer to the contents in the success state.
25084 /// Reading from this pointer when `result_ok` is not set is undefined.
25085 pub result: *mut crate::lightning::util::ser::BigSize,
25086 /// A pointer to the contents in the error state.
25087 /// Reading from this pointer when `result_ok` is set is undefined.
25088 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25091 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
25092 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
25093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25094 pub struct CResult_BigSizeDecodeErrorZ {
25095 /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
25096 /// `err` or `result` depending on the state of `result_ok`.
25097 pub contents: CResult_BigSizeDecodeErrorZPtr,
25098 /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
25099 pub result_ok: bool,
25102 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
25103 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
25104 CResult_BigSizeDecodeErrorZ {
25105 contents: CResult_BigSizeDecodeErrorZPtr {
25106 result: Box::into_raw(Box::new(o)),
25112 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
25113 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
25114 CResult_BigSizeDecodeErrorZ {
25115 contents: CResult_BigSizeDecodeErrorZPtr {
25116 err: Box::into_raw(Box::new(e)),
25121 /// Checks if the given object is currently in the success state
25123 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
25127 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
25128 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
25129 impl Drop for CResult_BigSizeDecodeErrorZ {
25130 fn drop(&mut self) {
25131 if self.result_ok {
25132 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25133 let _ = unsafe { Box::from_raw(self.contents.result) };
25136 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25137 let _ = unsafe { Box::from_raw(self.contents.err) };
25142 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
25143 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
25144 let contents = if o.result_ok {
25145 let result = unsafe { o.contents.result };
25146 unsafe { o.contents.result = core::ptr::null_mut() };
25147 CResult_BigSizeDecodeErrorZPtr { result }
25149 let err = unsafe { o.contents.err };
25150 unsafe { o.contents.err = core::ptr::null_mut(); }
25151 CResult_BigSizeDecodeErrorZPtr { err }
25155 result_ok: o.result_ok,
25159 impl Clone for CResult_BigSizeDecodeErrorZ {
25160 fn clone(&self) -> Self {
25161 if self.result_ok {
25162 Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
25163 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
25166 Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
25167 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25173 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
25174 /// but with all dynamically-allocated buffers duplicated in new buffers.
25175 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
25177 /// The contents of CResult_HostnameDecodeErrorZ
25178 pub union CResult_HostnameDecodeErrorZPtr {
25179 /// A pointer to the contents in the success state.
25180 /// Reading from this pointer when `result_ok` is not set is undefined.
25181 pub result: *mut crate::lightning::util::ser::Hostname,
25182 /// A pointer to the contents in the error state.
25183 /// Reading from this pointer when `result_ok` is set is undefined.
25184 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25187 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
25188 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
25189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25190 pub struct CResult_HostnameDecodeErrorZ {
25191 /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
25192 /// `err` or `result` depending on the state of `result_ok`.
25193 pub contents: CResult_HostnameDecodeErrorZPtr,
25194 /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
25195 pub result_ok: bool,
25198 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
25199 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
25200 CResult_HostnameDecodeErrorZ {
25201 contents: CResult_HostnameDecodeErrorZPtr {
25202 result: Box::into_raw(Box::new(o)),
25208 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
25209 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
25210 CResult_HostnameDecodeErrorZ {
25211 contents: CResult_HostnameDecodeErrorZPtr {
25212 err: Box::into_raw(Box::new(e)),
25217 /// Checks if the given object is currently in the success state
25219 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
25223 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
25224 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
25225 impl Drop for CResult_HostnameDecodeErrorZ {
25226 fn drop(&mut self) {
25227 if self.result_ok {
25228 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25229 let _ = unsafe { Box::from_raw(self.contents.result) };
25232 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25233 let _ = unsafe { Box::from_raw(self.contents.err) };
25238 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
25239 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
25240 let contents = if o.result_ok {
25241 let result = unsafe { o.contents.result };
25242 unsafe { o.contents.result = core::ptr::null_mut() };
25243 CResult_HostnameDecodeErrorZPtr { result }
25245 let err = unsafe { o.contents.err };
25246 unsafe { o.contents.err = core::ptr::null_mut(); }
25247 CResult_HostnameDecodeErrorZPtr { err }
25251 result_ok: o.result_ok,
25255 impl Clone for CResult_HostnameDecodeErrorZ {
25256 fn clone(&self) -> Self {
25257 if self.result_ok {
25258 Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
25259 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
25262 Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
25263 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25269 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
25270 /// but with all dynamically-allocated buffers duplicated in new buffers.
25271 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
25273 /// The contents of CResult_TransactionU16LenLimitedNoneZ
25274 pub union CResult_TransactionU16LenLimitedNoneZPtr {
25275 /// A pointer to the contents in the success state.
25276 /// Reading from this pointer when `result_ok` is not set is undefined.
25277 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
25278 /// Note that this value is always NULL, as there are no contents in the Err variant
25279 pub err: *mut core::ffi::c_void,
25282 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
25283 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
25284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25285 pub struct CResult_TransactionU16LenLimitedNoneZ {
25286 /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
25287 /// `err` or `result` depending on the state of `result_ok`.
25288 pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
25289 /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
25290 pub result_ok: bool,
25293 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
25294 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
25295 CResult_TransactionU16LenLimitedNoneZ {
25296 contents: CResult_TransactionU16LenLimitedNoneZPtr {
25297 result: Box::into_raw(Box::new(o)),
25303 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
25304 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
25305 CResult_TransactionU16LenLimitedNoneZ {
25306 contents: CResult_TransactionU16LenLimitedNoneZPtr {
25307 err: core::ptr::null_mut(),
25312 /// Checks if the given object is currently in the success state
25314 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
25318 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
25319 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
25320 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
25321 fn drop(&mut self) {
25322 if self.result_ok {
25323 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25324 let _ = unsafe { Box::from_raw(self.contents.result) };
25330 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
25331 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> 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_TransactionU16LenLimitedNoneZPtr { result }
25337 let _ = unsafe { Box::from_raw(o.contents.err) };
25338 o.contents.err = core::ptr::null_mut();
25339 CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
25343 result_ok: o.result_ok,
25347 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
25348 fn clone(&self) -> Self {
25349 if self.result_ok {
25350 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
25351 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
25354 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
25355 err: core::ptr::null_mut()
25361 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
25362 /// but with all dynamically-allocated buffers duplicated in new buffers.
25363 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
25365 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
25366 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
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::util::ser::TransactionU16LenLimited,
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_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
25376 /// containing a crate::lightning::util::ser::TransactionU16LenLimited 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_TransactionU16LenLimitedDecodeErrorZ {
25379 /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
25380 /// `err` or `result` depending on the state of `result_ok`.
25381 pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
25382 /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
25383 pub result_ok: bool,
25386 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
25387 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
25388 CResult_TransactionU16LenLimitedDecodeErrorZ {
25389 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
25390 result: Box::into_raw(Box::new(o)),
25396 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
25397 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
25398 CResult_TransactionU16LenLimitedDecodeErrorZ {
25399 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
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_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
25411 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
25412 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
25413 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
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::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
25427 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, 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_TransactionU16LenLimitedDecodeErrorZPtr { result }
25433 let err = unsafe { o.contents.err };
25434 unsafe { o.contents.err = core::ptr::null_mut(); }
25435 CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
25439 result_ok: o.result_ok,
25443 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
25444 fn clone(&self) -> Self {
25445 if self.result_ok {
25446 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
25447 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
25450 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
25451 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25457 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
25458 /// but with all dynamically-allocated buffers duplicated in new buffers.
25459 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
25461 /// The contents of CResult_UntrustedStringDecodeErrorZ
25462 pub union CResult_UntrustedStringDecodeErrorZPtr {
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::lightning::util::string::UntrustedString,
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::lightning::ln::msgs::DecodeError,
25471 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
25472 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
25473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25474 pub struct CResult_UntrustedStringDecodeErrorZ {
25475 /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
25476 /// `err` or `result` depending on the state of `result_ok`.
25477 pub contents: CResult_UntrustedStringDecodeErrorZPtr,
25478 /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
25479 pub result_ok: bool,
25482 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
25483 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
25484 CResult_UntrustedStringDecodeErrorZ {
25485 contents: CResult_UntrustedStringDecodeErrorZPtr {
25486 result: Box::into_raw(Box::new(o)),
25492 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
25493 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
25494 CResult_UntrustedStringDecodeErrorZ {
25495 contents: CResult_UntrustedStringDecodeErrorZPtr {
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_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
25507 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
25508 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
25509 impl Drop for CResult_UntrustedStringDecodeErrorZ {
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::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
25523 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> 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_UntrustedStringDecodeErrorZPtr { result }
25529 let err = unsafe { o.contents.err };
25530 unsafe { o.contents.err = core::ptr::null_mut(); }
25531 CResult_UntrustedStringDecodeErrorZPtr { err }
25535 result_ok: o.result_ok,
25539 impl Clone for CResult_UntrustedStringDecodeErrorZ {
25540 fn clone(&self) -> Self {
25541 if self.result_ok {
25542 Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
25543 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
25546 Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
25547 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25553 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
25554 /// but with all dynamically-allocated buffers duplicated in new buffers.
25555 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
25557 /// The contents of CResult_ChannelIdDecodeErrorZ
25558 pub union CResult_ChannelIdDecodeErrorZPtr {
25559 /// A pointer to the contents in the success state.
25560 /// Reading from this pointer when `result_ok` is not set is undefined.
25561 pub result: *mut crate::lightning::ln::types::ChannelId,
25562 /// A pointer to the contents in the error state.
25563 /// Reading from this pointer when `result_ok` is set is undefined.
25564 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25567 /// A CResult_ChannelIdDecodeErrorZ represents the result of a fallible operation,
25568 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::ln::msgs::DecodeError on failure.
25569 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25570 pub struct CResult_ChannelIdDecodeErrorZ {
25571 /// The contents of this CResult_ChannelIdDecodeErrorZ, accessible via either
25572 /// `err` or `result` depending on the state of `result_ok`.
25573 pub contents: CResult_ChannelIdDecodeErrorZPtr,
25574 /// Whether this CResult_ChannelIdDecodeErrorZ represents a success state.
25575 pub result_ok: bool,
25578 /// Creates a new CResult_ChannelIdDecodeErrorZ in the success state.
25579 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdDecodeErrorZ {
25580 CResult_ChannelIdDecodeErrorZ {
25581 contents: CResult_ChannelIdDecodeErrorZPtr {
25582 result: Box::into_raw(Box::new(o)),
25588 /// Creates a new CResult_ChannelIdDecodeErrorZ in the error state.
25589 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelIdDecodeErrorZ {
25590 CResult_ChannelIdDecodeErrorZ {
25591 contents: CResult_ChannelIdDecodeErrorZPtr {
25592 err: Box::into_raw(Box::new(e)),
25597 /// Checks if the given object is currently in the success state
25599 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_is_ok(o: &CResult_ChannelIdDecodeErrorZ) -> bool {
25603 /// Frees any resources used by the CResult_ChannelIdDecodeErrorZ.
25604 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_free(_res: CResult_ChannelIdDecodeErrorZ) { }
25605 impl Drop for CResult_ChannelIdDecodeErrorZ {
25606 fn drop(&mut self) {
25607 if self.result_ok {
25608 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25609 let _ = unsafe { Box::from_raw(self.contents.result) };
25612 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25613 let _ = unsafe { Box::from_raw(self.contents.err) };
25618 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelIdDecodeErrorZ {
25619 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>) -> Self {
25620 let contents = if o.result_ok {
25621 let result = unsafe { o.contents.result };
25622 unsafe { o.contents.result = core::ptr::null_mut() };
25623 CResult_ChannelIdDecodeErrorZPtr { result }
25625 let err = unsafe { o.contents.err };
25626 unsafe { o.contents.err = core::ptr::null_mut(); }
25627 CResult_ChannelIdDecodeErrorZPtr { err }
25631 result_ok: o.result_ok,
25635 impl Clone for CResult_ChannelIdDecodeErrorZ {
25636 fn clone(&self) -> Self {
25637 if self.result_ok {
25638 Self { result_ok: true, contents: CResult_ChannelIdDecodeErrorZPtr {
25639 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
25642 Self { result_ok: false, contents: CResult_ChannelIdDecodeErrorZPtr {
25643 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25649 /// Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig`
25650 /// but with all dynamically-allocated buffers duplicated in new buffers.
25651 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_clone(orig: &CResult_ChannelIdDecodeErrorZ) -> CResult_ChannelIdDecodeErrorZ { Clone::clone(&orig) }
25653 /// A tuple of 2 elements. See the individual fields for the types contained.
25654 pub struct C2Tuple__u832u16Z {
25655 /// The element at position 0
25656 pub a: crate::c_types::ThirtyTwoBytes,
25657 /// The element at position 1
25660 impl From<(crate::c_types::ThirtyTwoBytes, u16)> for C2Tuple__u832u16Z {
25661 fn from (tup: (crate::c_types::ThirtyTwoBytes, u16)) -> Self {
25668 impl C2Tuple__u832u16Z {
25669 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u16) {
25673 impl Clone for C2Tuple__u832u16Z {
25674 fn clone(&self) -> Self {
25676 a: Clone::clone(&self.a),
25677 b: Clone::clone(&self.b),
25682 /// Creates a new tuple which has the same data as `orig`
25683 /// but with all dynamically-allocated buffers duplicated in new buffers.
25684 pub extern "C" fn C2Tuple__u832u16Z_clone(orig: &C2Tuple__u832u16Z) -> C2Tuple__u832u16Z { Clone::clone(&orig) }
25685 /// Creates a new C2Tuple__u832u16Z from the contained elements.
25687 pub extern "C" fn C2Tuple__u832u16Z_new(a: crate::c_types::ThirtyTwoBytes, b: u16) -> C2Tuple__u832u16Z {
25688 C2Tuple__u832u16Z { a, b, }
25692 /// Frees any resources used by the C2Tuple__u832u16Z.
25693 pub extern "C" fn C2Tuple__u832u16Z_free(_res: C2Tuple__u832u16Z) { }
25695 /// The contents of CResult_PaymentRelayDecodeErrorZ
25696 pub union CResult_PaymentRelayDecodeErrorZPtr {
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::lightning::blinded_path::payment::PaymentRelay,
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::ln::msgs::DecodeError,
25705 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
25706 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
25707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25708 pub struct CResult_PaymentRelayDecodeErrorZ {
25709 /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
25710 /// `err` or `result` depending on the state of `result_ok`.
25711 pub contents: CResult_PaymentRelayDecodeErrorZPtr,
25712 /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
25713 pub result_ok: bool,
25716 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
25717 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
25718 CResult_PaymentRelayDecodeErrorZ {
25719 contents: CResult_PaymentRelayDecodeErrorZPtr {
25720 result: Box::into_raw(Box::new(o)),
25726 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
25727 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
25728 CResult_PaymentRelayDecodeErrorZ {
25729 contents: CResult_PaymentRelayDecodeErrorZPtr {
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_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
25741 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
25742 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
25743 impl Drop for CResult_PaymentRelayDecodeErrorZ {
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::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
25757 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> 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_PaymentRelayDecodeErrorZPtr { result }
25763 let err = unsafe { o.contents.err };
25764 unsafe { o.contents.err = core::ptr::null_mut(); }
25765 CResult_PaymentRelayDecodeErrorZPtr { err }
25769 result_ok: o.result_ok,
25773 impl Clone for CResult_PaymentRelayDecodeErrorZ {
25774 fn clone(&self) -> Self {
25775 if self.result_ok {
25776 Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
25777 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
25780 Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
25781 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25787 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
25788 /// but with all dynamically-allocated buffers duplicated in new buffers.
25789 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
25791 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
25792 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
25793 /// A pointer to the contents in the success state.
25794 /// Reading from this pointer when `result_ok` is not set is undefined.
25795 pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
25796 /// A pointer to the contents in the error state.
25797 /// Reading from this pointer when `result_ok` is set is undefined.
25798 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25801 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
25802 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
25803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25804 pub struct CResult_PaymentConstraintsDecodeErrorZ {
25805 /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
25806 /// `err` or `result` depending on the state of `result_ok`.
25807 pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
25808 /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
25809 pub result_ok: bool,
25812 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
25813 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
25814 CResult_PaymentConstraintsDecodeErrorZ {
25815 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25816 result: Box::into_raw(Box::new(o)),
25822 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
25823 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
25824 CResult_PaymentConstraintsDecodeErrorZ {
25825 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25826 err: Box::into_raw(Box::new(e)),
25831 /// Checks if the given object is currently in the success state
25833 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
25837 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
25838 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
25839 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
25840 fn drop(&mut self) {
25841 if self.result_ok {
25842 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25843 let _ = unsafe { Box::from_raw(self.contents.result) };
25846 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25847 let _ = unsafe { Box::from_raw(self.contents.err) };
25852 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
25853 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
25854 let contents = if o.result_ok {
25855 let result = unsafe { o.contents.result };
25856 unsafe { o.contents.result = core::ptr::null_mut() };
25857 CResult_PaymentConstraintsDecodeErrorZPtr { result }
25859 let err = unsafe { o.contents.err };
25860 unsafe { o.contents.err = core::ptr::null_mut(); }
25861 CResult_PaymentConstraintsDecodeErrorZPtr { err }
25865 result_ok: o.result_ok,
25869 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
25870 fn clone(&self) -> Self {
25871 if self.result_ok {
25872 Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25873 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
25876 Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25877 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25883 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
25884 /// but with all dynamically-allocated buffers duplicated in new buffers.
25885 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
25887 /// The contents of CResult_PaymentContextDecodeErrorZ
25888 pub union CResult_PaymentContextDecodeErrorZPtr {
25889 /// A pointer to the contents in the success state.
25890 /// Reading from this pointer when `result_ok` is not set is undefined.
25891 pub result: *mut crate::lightning::blinded_path::payment::PaymentContext,
25892 /// A pointer to the contents in the error state.
25893 /// Reading from this pointer when `result_ok` is set is undefined.
25894 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25897 /// A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation,
25898 /// containing a crate::lightning::blinded_path::payment::PaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25899 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25900 pub struct CResult_PaymentContextDecodeErrorZ {
25901 /// The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either
25902 /// `err` or `result` depending on the state of `result_ok`.
25903 pub contents: CResult_PaymentContextDecodeErrorZPtr,
25904 /// Whether this CResult_PaymentContextDecodeErrorZ represents a success state.
25905 pub result_ok: bool,
25908 /// Creates a new CResult_PaymentContextDecodeErrorZ in the success state.
25909 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentContext) -> CResult_PaymentContextDecodeErrorZ {
25910 CResult_PaymentContextDecodeErrorZ {
25911 contents: CResult_PaymentContextDecodeErrorZPtr {
25912 result: Box::into_raw(Box::new(o)),
25918 /// Creates a new CResult_PaymentContextDecodeErrorZ in the error state.
25919 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentContextDecodeErrorZ {
25920 CResult_PaymentContextDecodeErrorZ {
25921 contents: CResult_PaymentContextDecodeErrorZPtr {
25922 err: Box::into_raw(Box::new(e)),
25927 /// Checks if the given object is currently in the success state
25929 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_is_ok(o: &CResult_PaymentContextDecodeErrorZ) -> bool {
25933 /// Frees any resources used by the CResult_PaymentContextDecodeErrorZ.
25934 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_free(_res: CResult_PaymentContextDecodeErrorZ) { }
25935 impl Drop for CResult_PaymentContextDecodeErrorZ {
25936 fn drop(&mut self) {
25937 if self.result_ok {
25938 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25939 let _ = unsafe { Box::from_raw(self.contents.result) };
25942 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25943 let _ = unsafe { Box::from_raw(self.contents.err) };
25948 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentContextDecodeErrorZ {
25949 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25950 let contents = if o.result_ok {
25951 let result = unsafe { o.contents.result };
25952 unsafe { o.contents.result = core::ptr::null_mut() };
25953 CResult_PaymentContextDecodeErrorZPtr { result }
25955 let err = unsafe { o.contents.err };
25956 unsafe { o.contents.err = core::ptr::null_mut(); }
25957 CResult_PaymentContextDecodeErrorZPtr { err }
25961 result_ok: o.result_ok,
25965 impl Clone for CResult_PaymentContextDecodeErrorZ {
25966 fn clone(&self) -> Self {
25967 if self.result_ok {
25968 Self { result_ok: true, contents: CResult_PaymentContextDecodeErrorZPtr {
25969 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentContext>::clone(unsafe { &*self.contents.result })))
25972 Self { result_ok: false, contents: CResult_PaymentContextDecodeErrorZPtr {
25973 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25979 /// Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig`
25980 /// but with all dynamically-allocated buffers duplicated in new buffers.
25981 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_clone(orig: &CResult_PaymentContextDecodeErrorZ) -> CResult_PaymentContextDecodeErrorZ { Clone::clone(&orig) }
25983 /// The contents of CResult_UnknownPaymentContextDecodeErrorZ
25984 pub union CResult_UnknownPaymentContextDecodeErrorZPtr {
25985 /// A pointer to the contents in the success state.
25986 /// Reading from this pointer when `result_ok` is not set is undefined.
25987 pub result: *mut crate::lightning::blinded_path::payment::UnknownPaymentContext,
25988 /// A pointer to the contents in the error state.
25989 /// Reading from this pointer when `result_ok` is set is undefined.
25990 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25993 /// A CResult_UnknownPaymentContextDecodeErrorZ represents the result of a fallible operation,
25994 /// containing a crate::lightning::blinded_path::payment::UnknownPaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25995 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25996 pub struct CResult_UnknownPaymentContextDecodeErrorZ {
25997 /// The contents of this CResult_UnknownPaymentContextDecodeErrorZ, accessible via either
25998 /// `err` or `result` depending on the state of `result_ok`.
25999 pub contents: CResult_UnknownPaymentContextDecodeErrorZPtr,
26000 /// Whether this CResult_UnknownPaymentContextDecodeErrorZ represents a success state.
26001 pub result_ok: bool,
26004 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the success state.
26005 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::UnknownPaymentContext) -> CResult_UnknownPaymentContextDecodeErrorZ {
26006 CResult_UnknownPaymentContextDecodeErrorZ {
26007 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
26008 result: Box::into_raw(Box::new(o)),
26014 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the error state.
26015 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnknownPaymentContextDecodeErrorZ {
26016 CResult_UnknownPaymentContextDecodeErrorZ {
26017 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
26018 err: Box::into_raw(Box::new(e)),
26023 /// Checks if the given object is currently in the success state
26025 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o: &CResult_UnknownPaymentContextDecodeErrorZ) -> bool {
26029 /// Frees any resources used by the CResult_UnknownPaymentContextDecodeErrorZ.
26030 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_free(_res: CResult_UnknownPaymentContextDecodeErrorZ) { }
26031 impl Drop for CResult_UnknownPaymentContextDecodeErrorZ {
26032 fn drop(&mut self) {
26033 if self.result_ok {
26034 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26035 let _ = unsafe { Box::from_raw(self.contents.result) };
26038 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26039 let _ = unsafe { Box::from_raw(self.contents.err) };
26044 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_UnknownPaymentContextDecodeErrorZ {
26045 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
26046 let contents = if o.result_ok {
26047 let result = unsafe { o.contents.result };
26048 unsafe { o.contents.result = core::ptr::null_mut() };
26049 CResult_UnknownPaymentContextDecodeErrorZPtr { result }
26051 let err = unsafe { o.contents.err };
26052 unsafe { o.contents.err = core::ptr::null_mut(); }
26053 CResult_UnknownPaymentContextDecodeErrorZPtr { err }
26057 result_ok: o.result_ok,
26061 impl Clone for CResult_UnknownPaymentContextDecodeErrorZ {
26062 fn clone(&self) -> Self {
26063 if self.result_ok {
26064 Self { result_ok: true, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
26065 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::UnknownPaymentContext>::clone(unsafe { &*self.contents.result })))
26068 Self { result_ok: false, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
26069 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26075 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ which has the same data as `orig`
26076 /// but with all dynamically-allocated buffers duplicated in new buffers.
26077 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_clone(orig: &CResult_UnknownPaymentContextDecodeErrorZ) -> CResult_UnknownPaymentContextDecodeErrorZ { Clone::clone(&orig) }
26079 /// The contents of CResult_Bolt12OfferContextDecodeErrorZ
26080 pub union CResult_Bolt12OfferContextDecodeErrorZPtr {
26081 /// A pointer to the contents in the success state.
26082 /// Reading from this pointer when `result_ok` is not set is undefined.
26083 pub result: *mut crate::lightning::blinded_path::payment::Bolt12OfferContext,
26084 /// A pointer to the contents in the error state.
26085 /// Reading from this pointer when `result_ok` is set is undefined.
26086 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26089 /// A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation,
26090 /// containing a crate::lightning::blinded_path::payment::Bolt12OfferContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
26091 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26092 pub struct CResult_Bolt12OfferContextDecodeErrorZ {
26093 /// The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either
26094 /// `err` or `result` depending on the state of `result_ok`.
26095 pub contents: CResult_Bolt12OfferContextDecodeErrorZPtr,
26096 /// Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state.
26097 pub result_ok: bool,
26100 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state.
26101 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12OfferContext) -> CResult_Bolt12OfferContextDecodeErrorZ {
26102 CResult_Bolt12OfferContextDecodeErrorZ {
26103 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
26104 result: Box::into_raw(Box::new(o)),
26110 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state.
26111 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12OfferContextDecodeErrorZ {
26112 CResult_Bolt12OfferContextDecodeErrorZ {
26113 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
26114 err: Box::into_raw(Box::new(e)),
26119 /// Checks if the given object is currently in the success state
26121 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o: &CResult_Bolt12OfferContextDecodeErrorZ) -> bool {
26125 /// Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ.
26126 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_free(_res: CResult_Bolt12OfferContextDecodeErrorZ) { }
26127 impl Drop for CResult_Bolt12OfferContextDecodeErrorZ {
26128 fn drop(&mut self) {
26129 if self.result_ok {
26130 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26131 let _ = unsafe { Box::from_raw(self.contents.result) };
26134 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26135 let _ = unsafe { Box::from_raw(self.contents.err) };
26140 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12OfferContextDecodeErrorZ {
26141 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
26142 let contents = if o.result_ok {
26143 let result = unsafe { o.contents.result };
26144 unsafe { o.contents.result = core::ptr::null_mut() };
26145 CResult_Bolt12OfferContextDecodeErrorZPtr { result }
26147 let err = unsafe { o.contents.err };
26148 unsafe { o.contents.err = core::ptr::null_mut(); }
26149 CResult_Bolt12OfferContextDecodeErrorZPtr { err }
26153 result_ok: o.result_ok,
26157 impl Clone for CResult_Bolt12OfferContextDecodeErrorZ {
26158 fn clone(&self) -> Self {
26159 if self.result_ok {
26160 Self { result_ok: true, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
26161 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12OfferContext>::clone(unsafe { &*self.contents.result })))
26164 Self { result_ok: false, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
26165 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26171 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ which has the same data as `orig`
26172 /// but with all dynamically-allocated buffers duplicated in new buffers.
26173 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_clone(orig: &CResult_Bolt12OfferContextDecodeErrorZ) -> CResult_Bolt12OfferContextDecodeErrorZ { Clone::clone(&orig) }
26175 /// The contents of CResult_Bolt12RefundContextDecodeErrorZ
26176 pub union CResult_Bolt12RefundContextDecodeErrorZPtr {
26177 /// A pointer to the contents in the success state.
26178 /// Reading from this pointer when `result_ok` is not set is undefined.
26179 pub result: *mut crate::lightning::blinded_path::payment::Bolt12RefundContext,
26180 /// A pointer to the contents in the error state.
26181 /// Reading from this pointer when `result_ok` is set is undefined.
26182 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26185 /// A CResult_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation,
26186 /// containing a crate::lightning::blinded_path::payment::Bolt12RefundContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
26187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26188 pub struct CResult_Bolt12RefundContextDecodeErrorZ {
26189 /// The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either
26190 /// `err` or `result` depending on the state of `result_ok`.
26191 pub contents: CResult_Bolt12RefundContextDecodeErrorZPtr,
26192 /// Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state.
26193 pub result_ok: bool,
26196 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state.
26197 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12RefundContext) -> CResult_Bolt12RefundContextDecodeErrorZ {
26198 CResult_Bolt12RefundContextDecodeErrorZ {
26199 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
26200 result: Box::into_raw(Box::new(o)),
26206 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state.
26207 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12RefundContextDecodeErrorZ {
26208 CResult_Bolt12RefundContextDecodeErrorZ {
26209 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
26210 err: Box::into_raw(Box::new(e)),
26215 /// Checks if the given object is currently in the success state
26217 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o: &CResult_Bolt12RefundContextDecodeErrorZ) -> bool {
26221 /// Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ.
26222 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_free(_res: CResult_Bolt12RefundContextDecodeErrorZ) { }
26223 impl Drop for CResult_Bolt12RefundContextDecodeErrorZ {
26224 fn drop(&mut self) {
26225 if self.result_ok {
26226 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26227 let _ = unsafe { Box::from_raw(self.contents.result) };
26230 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26231 let _ = unsafe { Box::from_raw(self.contents.err) };
26236 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12RefundContextDecodeErrorZ {
26237 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
26238 let contents = if o.result_ok {
26239 let result = unsafe { o.contents.result };
26240 unsafe { o.contents.result = core::ptr::null_mut() };
26241 CResult_Bolt12RefundContextDecodeErrorZPtr { result }
26243 let err = unsafe { o.contents.err };
26244 unsafe { o.contents.err = core::ptr::null_mut(); }
26245 CResult_Bolt12RefundContextDecodeErrorZPtr { err }
26249 result_ok: o.result_ok,
26253 impl Clone for CResult_Bolt12RefundContextDecodeErrorZ {
26254 fn clone(&self) -> Self {
26255 if self.result_ok {
26256 Self { result_ok: true, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
26257 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12RefundContext>::clone(unsafe { &*self.contents.result })))
26260 Self { result_ok: false, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
26261 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26267 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig`
26268 /// but with all dynamically-allocated buffers duplicated in new buffers.
26269 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_clone(orig: &CResult_Bolt12RefundContextDecodeErrorZ) -> CResult_Bolt12RefundContextDecodeErrorZ { Clone::clone(&orig) }
26271 /// The contents of CResult_StrSecp256k1ErrorZ
26272 pub union CResult_StrSecp256k1ErrorZPtr {
26273 /// A pointer to the contents in the success state.
26274 /// Reading from this pointer when `result_ok` is not set is undefined.
26275 pub result: *mut crate::c_types::Str,
26276 /// A pointer to the contents in the error state.
26277 /// Reading from this pointer when `result_ok` is set is undefined.
26278 pub err: *mut crate::c_types::Secp256k1Error,
26281 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
26282 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
26283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26284 pub struct CResult_StrSecp256k1ErrorZ {
26285 /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
26286 /// `err` or `result` depending on the state of `result_ok`.
26287 pub contents: CResult_StrSecp256k1ErrorZPtr,
26288 /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
26289 pub result_ok: bool,
26292 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
26293 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
26294 CResult_StrSecp256k1ErrorZ {
26295 contents: CResult_StrSecp256k1ErrorZPtr {
26296 result: Box::into_raw(Box::new(o)),
26302 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
26303 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
26304 CResult_StrSecp256k1ErrorZ {
26305 contents: CResult_StrSecp256k1ErrorZPtr {
26306 err: Box::into_raw(Box::new(e)),
26311 /// Checks if the given object is currently in the success state
26313 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
26317 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
26318 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
26319 impl Drop for CResult_StrSecp256k1ErrorZ {
26320 fn drop(&mut self) {
26321 if self.result_ok {
26322 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26323 let _ = unsafe { Box::from_raw(self.contents.result) };
26326 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26327 let _ = unsafe { Box::from_raw(self.contents.err) };
26332 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
26333 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
26334 let contents = if o.result_ok {
26335 let result = unsafe { o.contents.result };
26336 unsafe { o.contents.result = core::ptr::null_mut() };
26337 CResult_StrSecp256k1ErrorZPtr { result }
26339 let err = unsafe { o.contents.err };
26340 unsafe { o.contents.err = core::ptr::null_mut(); }
26341 CResult_StrSecp256k1ErrorZPtr { err }
26345 result_ok: o.result_ok,
26349 impl Clone for CResult_StrSecp256k1ErrorZ {
26350 fn clone(&self) -> Self {
26351 if self.result_ok {
26352 Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
26353 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
26356 Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
26357 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
26363 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
26364 /// but with all dynamically-allocated buffers duplicated in new buffers.
26365 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
26367 /// A tuple of 3 elements. See the individual fields for the types contained.
26368 pub struct C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
26369 /// The element at position 0
26370 pub a: crate::c_types::ThirtyTwoBytes,
26371 /// The element at position 1
26372 pub b: crate::lightning::ln::outbound_payment::RecipientOnionFields,
26373 /// The element at position 2
26374 pub c: crate::lightning::routing::router::RouteParameters,
26376 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)> for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
26377 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)) -> Self {
26385 impl C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
26386 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters) {
26387 (self.a, self.b, self.c)
26390 impl Clone for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
26391 fn clone(&self) -> Self {
26393 a: Clone::clone(&self.a),
26394 b: Clone::clone(&self.b),
26395 c: Clone::clone(&self.c),
26400 /// Creates a new tuple which has the same data as `orig`
26401 /// but with all dynamically-allocated buffers duplicated in new buffers.
26402 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig: &C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { Clone::clone(&orig) }
26403 /// Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements.
26405 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 {
26406 C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { a, b, c, }
26410 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ.
26411 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res: C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) { }
26413 /// The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ
26414 pub union CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
26415 /// A pointer to the contents in the success state.
26416 /// Reading from this pointer when `result_ok` is not set is undefined.
26417 pub result: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ,
26418 /// Note that this value is always NULL, as there are no contents in the Err variant
26419 pub err: *mut core::ffi::c_void,
26422 /// A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation,
26423 /// containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure.
26424 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26425 pub struct CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26426 /// The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either
26427 /// `err` or `result` depending on the state of `result_ok`.
26428 pub contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr,
26429 /// Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state.
26430 pub result_ok: bool,
26433 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state.
26434 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o: crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26435 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26436 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
26437 result: Box::into_raw(Box::new(o)),
26443 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state.
26444 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26445 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26446 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
26447 err: core::ptr::null_mut(),
26452 /// Checks if the given object is currently in the success state
26454 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> bool {
26458 /// Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.
26459 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) { }
26460 impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26461 fn drop(&mut self) {
26462 if self.result_ok {
26463 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26464 let _ = unsafe { Box::from_raw(self.contents.result) };
26470 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>> for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26471 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>) -> Self {
26472 let contents = if o.result_ok {
26473 let result = unsafe { o.contents.result };
26474 unsafe { o.contents.result = core::ptr::null_mut() };
26475 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { result }
26477 let _ = unsafe { Box::from_raw(o.contents.err) };
26478 o.contents.err = core::ptr::null_mut();
26479 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { err: core::ptr::null_mut() }
26483 result_ok: o.result_ok,
26487 impl Clone for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26488 fn clone(&self) -> Self {
26489 if self.result_ok {
26490 Self { result_ok: true, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
26491 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ>::clone(unsafe { &*self.contents.result })))
26494 Self { result_ok: false, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
26495 err: core::ptr::null_mut()
26501 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig`
26502 /// but with all dynamically-allocated buffers duplicated in new buffers.
26503 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { Clone::clone(&orig) }
26505 /// The contents of CResult_TxOutUtxoLookupErrorZ
26506 pub union CResult_TxOutUtxoLookupErrorZPtr {
26507 /// A pointer to the contents in the success state.
26508 /// Reading from this pointer when `result_ok` is not set is undefined.
26509 pub result: *mut crate::c_types::TxOut,
26510 /// A pointer to the contents in the error state.
26511 /// Reading from this pointer when `result_ok` is set is undefined.
26512 pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
26515 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
26516 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
26517 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26518 pub struct CResult_TxOutUtxoLookupErrorZ {
26519 /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
26520 /// `err` or `result` depending on the state of `result_ok`.
26521 pub contents: CResult_TxOutUtxoLookupErrorZPtr,
26522 /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
26523 pub result_ok: bool,
26526 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
26527 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
26528 CResult_TxOutUtxoLookupErrorZ {
26529 contents: CResult_TxOutUtxoLookupErrorZPtr {
26530 result: Box::into_raw(Box::new(o)),
26536 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
26537 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
26538 CResult_TxOutUtxoLookupErrorZ {
26539 contents: CResult_TxOutUtxoLookupErrorZPtr {
26540 err: Box::into_raw(Box::new(e)),
26545 /// Checks if the given object is currently in the success state
26547 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
26551 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
26552 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
26553 impl Drop for CResult_TxOutUtxoLookupErrorZ {
26554 fn drop(&mut self) {
26555 if self.result_ok {
26556 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26557 let _ = unsafe { Box::from_raw(self.contents.result) };
26560 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26561 let _ = unsafe { Box::from_raw(self.contents.err) };
26566 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
26567 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
26568 let contents = if o.result_ok {
26569 let result = unsafe { o.contents.result };
26570 unsafe { o.contents.result = core::ptr::null_mut() };
26571 CResult_TxOutUtxoLookupErrorZPtr { result }
26573 let err = unsafe { o.contents.err };
26574 unsafe { o.contents.err = core::ptr::null_mut(); }
26575 CResult_TxOutUtxoLookupErrorZPtr { err }
26579 result_ok: o.result_ok,
26583 impl Clone for CResult_TxOutUtxoLookupErrorZ {
26584 fn clone(&self) -> Self {
26585 if self.result_ok {
26586 Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
26587 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
26590 Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
26591 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
26597 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
26598 /// but with all dynamically-allocated buffers duplicated in new buffers.
26599 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
26601 /// A tuple of 3 elements. See the individual fields for the types contained.
26602 pub struct C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26603 /// The element at position 0
26604 pub a: crate::c_types::PublicKey,
26605 /// The element at position 1
26606 pub b: crate::lightning::ln::msgs::OnionMessage,
26607 /// The element at position 2
26608 pub c: crate::c_types::derived::COption_CVec_SocketAddressZZ,
26610 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)> for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26611 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)) -> Self {
26619 impl C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26620 #[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) {
26621 (self.a, self.b, self.c)
26624 impl Clone for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26625 fn clone(&self) -> Self {
26627 a: Clone::clone(&self.a),
26628 b: Clone::clone(&self.b),
26629 c: Clone::clone(&self.c),
26634 /// Creates a new tuple which has the same data as `orig`
26635 /// but with all dynamically-allocated buffers duplicated in new buffers.
26636 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig: &C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { Clone::clone(&orig) }
26637 /// Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements.
26639 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 {
26640 C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { a, b, c, }
26644 /// Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ.
26645 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res: C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) { }
26647 /// The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ
26648 pub union CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26649 /// A pointer to the contents in the success state.
26650 /// Reading from this pointer when `result_ok` is not set is undefined.
26651 pub result: *mut crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ,
26652 /// A pointer to the contents in the error state.
26653 /// Reading from this pointer when `result_ok` is set is undefined.
26654 pub err: *mut crate::lightning::onion_message::messenger::SendError,
26657 /// A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation,
26658 /// containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
26659 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26660 pub struct CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26661 /// The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either
26662 /// `err` or `result` depending on the state of `result_ok`.
26663 pub contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr,
26664 /// Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state.
26665 pub result_ok: bool,
26668 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state.
26669 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o: crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26670 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26671 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26672 result: Box::into_raw(Box::new(o)),
26678 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state.
26679 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26680 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26681 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26682 err: Box::into_raw(Box::new(e)),
26687 /// Checks if the given object is currently in the success state
26689 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> bool {
26693 /// Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.
26694 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) { }
26695 impl Drop for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26696 fn drop(&mut self) {
26697 if self.result_ok {
26698 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26699 let _ = unsafe { Box::from_raw(self.contents.result) };
26702 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26703 let _ = unsafe { Box::from_raw(self.contents.err) };
26708 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 {
26709 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
26710 let contents = if o.result_ok {
26711 let result = unsafe { o.contents.result };
26712 unsafe { o.contents.result = core::ptr::null_mut() };
26713 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { result }
26715 let err = unsafe { o.contents.err };
26716 unsafe { o.contents.err = core::ptr::null_mut(); }
26717 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { err }
26721 result_ok: o.result_ok,
26725 impl Clone for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26726 fn clone(&self) -> Self {
26727 if self.result_ok {
26728 Self { result_ok: true, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26729 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ>::clone(unsafe { &*self.contents.result })))
26732 Self { result_ok: false, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26733 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
26739 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ which has the same data as `orig`
26740 /// but with all dynamically-allocated buffers duplicated in new buffers.
26741 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { Clone::clone(&orig) }
26743 /// The contents of CResult_PeeledOnionNoneZ
26744 pub union CResult_PeeledOnionNoneZPtr {
26745 /// A pointer to the contents in the success state.
26746 /// Reading from this pointer when `result_ok` is not set is undefined.
26747 pub result: *mut crate::lightning::onion_message::messenger::PeeledOnion,
26748 /// Note that this value is always NULL, as there are no contents in the Err variant
26749 pub err: *mut core::ffi::c_void,
26752 /// A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
26753 /// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
26754 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26755 pub struct CResult_PeeledOnionNoneZ {
26756 /// The contents of this CResult_PeeledOnionNoneZ, accessible via either
26757 /// `err` or `result` depending on the state of `result_ok`.
26758 pub contents: CResult_PeeledOnionNoneZPtr,
26759 /// Whether this CResult_PeeledOnionNoneZ represents a success state.
26760 pub result_ok: bool,
26763 /// Creates a new CResult_PeeledOnionNoneZ in the success state.
26764 pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ {
26765 CResult_PeeledOnionNoneZ {
26766 contents: CResult_PeeledOnionNoneZPtr {
26767 result: Box::into_raw(Box::new(o)),
26773 /// Creates a new CResult_PeeledOnionNoneZ in the error state.
26774 pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ {
26775 CResult_PeeledOnionNoneZ {
26776 contents: CResult_PeeledOnionNoneZPtr {
26777 err: core::ptr::null_mut(),
26782 /// Checks if the given object is currently in the success state
26784 pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool {
26788 /// Frees any resources used by the CResult_PeeledOnionNoneZ.
26789 pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { }
26790 impl Drop for CResult_PeeledOnionNoneZ {
26791 fn drop(&mut self) {
26792 if self.result_ok {
26793 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26794 let _ = unsafe { Box::from_raw(self.contents.result) };
26800 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>> for CResult_PeeledOnionNoneZ {
26801 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>) -> Self {
26802 let contents = if o.result_ok {
26803 let result = unsafe { o.contents.result };
26804 unsafe { o.contents.result = core::ptr::null_mut() };
26805 CResult_PeeledOnionNoneZPtr { result }
26807 let _ = unsafe { Box::from_raw(o.contents.err) };
26808 o.contents.err = core::ptr::null_mut();
26809 CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() }
26813 result_ok: o.result_ok,
26817 impl Clone for CResult_PeeledOnionNoneZ {
26818 fn clone(&self) -> Self {
26819 if self.result_ok {
26820 Self { result_ok: true, contents: CResult_PeeledOnionNoneZPtr {
26821 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::PeeledOnion>::clone(unsafe { &*self.contents.result })))
26824 Self { result_ok: false, contents: CResult_PeeledOnionNoneZPtr {
26825 err: core::ptr::null_mut()
26831 /// Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig`
26832 /// but with all dynamically-allocated buffers duplicated in new buffers.
26833 pub extern "C" fn CResult_PeeledOnionNoneZ_clone(orig: &CResult_PeeledOnionNoneZ) -> CResult_PeeledOnionNoneZ { Clone::clone(&orig) }
26835 /// The contents of CResult_SendSuccessSendErrorZ
26836 pub union CResult_SendSuccessSendErrorZPtr {
26837 /// A pointer to the contents in the success state.
26838 /// Reading from this pointer when `result_ok` is not set is undefined.
26839 pub result: *mut crate::lightning::onion_message::messenger::SendSuccess,
26840 /// A pointer to the contents in the error state.
26841 /// Reading from this pointer when `result_ok` is set is undefined.
26842 pub err: *mut crate::lightning::onion_message::messenger::SendError,
26845 /// A CResult_SendSuccessSendErrorZ represents the result of a fallible operation,
26846 /// containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure.
26847 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26848 pub struct CResult_SendSuccessSendErrorZ {
26849 /// The contents of this CResult_SendSuccessSendErrorZ, accessible via either
26850 /// `err` or `result` depending on the state of `result_ok`.
26851 pub contents: CResult_SendSuccessSendErrorZPtr,
26852 /// Whether this CResult_SendSuccessSendErrorZ represents a success state.
26853 pub result_ok: bool,
26856 /// Creates a new CResult_SendSuccessSendErrorZ in the success state.
26857 pub extern "C" fn CResult_SendSuccessSendErrorZ_ok(o: crate::lightning::onion_message::messenger::SendSuccess) -> CResult_SendSuccessSendErrorZ {
26858 CResult_SendSuccessSendErrorZ {
26859 contents: CResult_SendSuccessSendErrorZPtr {
26860 result: Box::into_raw(Box::new(o)),
26866 /// Creates a new CResult_SendSuccessSendErrorZ in the error state.
26867 pub extern "C" fn CResult_SendSuccessSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_SendSuccessSendErrorZ {
26868 CResult_SendSuccessSendErrorZ {
26869 contents: CResult_SendSuccessSendErrorZPtr {
26870 err: Box::into_raw(Box::new(e)),
26875 /// Checks if the given object is currently in the success state
26877 pub extern "C" fn CResult_SendSuccessSendErrorZ_is_ok(o: &CResult_SendSuccessSendErrorZ) -> bool {
26881 /// Frees any resources used by the CResult_SendSuccessSendErrorZ.
26882 pub extern "C" fn CResult_SendSuccessSendErrorZ_free(_res: CResult_SendSuccessSendErrorZ) { }
26883 impl Drop for CResult_SendSuccessSendErrorZ {
26884 fn drop(&mut self) {
26885 if self.result_ok {
26886 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26887 let _ = unsafe { Box::from_raw(self.contents.result) };
26890 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26891 let _ = unsafe { Box::from_raw(self.contents.err) };
26896 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>> for CResult_SendSuccessSendErrorZ {
26897 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>) -> Self {
26898 let contents = if o.result_ok {
26899 let result = unsafe { o.contents.result };
26900 unsafe { o.contents.result = core::ptr::null_mut() };
26901 CResult_SendSuccessSendErrorZPtr { result }
26903 let err = unsafe { o.contents.err };
26904 unsafe { o.contents.err = core::ptr::null_mut(); }
26905 CResult_SendSuccessSendErrorZPtr { err }
26909 result_ok: o.result_ok,
26913 impl Clone for CResult_SendSuccessSendErrorZ {
26914 fn clone(&self) -> Self {
26915 if self.result_ok {
26916 Self { result_ok: true, contents: CResult_SendSuccessSendErrorZPtr {
26917 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendSuccess>::clone(unsafe { &*self.contents.result })))
26920 Self { result_ok: false, contents: CResult_SendSuccessSendErrorZPtr {
26921 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
26927 /// Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig`
26928 /// but with all dynamically-allocated buffers duplicated in new buffers.
26929 pub extern "C" fn CResult_SendSuccessSendErrorZ_clone(orig: &CResult_SendSuccessSendErrorZ) -> CResult_SendSuccessSendErrorZ { Clone::clone(&orig) }
26931 /// The contents of CResult_BlindedPathNoneZ
26932 pub union CResult_BlindedPathNoneZPtr {
26933 /// A pointer to the contents in the success state.
26934 /// Reading from this pointer when `result_ok` is not set is undefined.
26935 pub result: *mut crate::lightning::blinded_path::BlindedPath,
26936 /// Note that this value is always NULL, as there are no contents in the Err variant
26937 pub err: *mut core::ffi::c_void,
26940 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
26941 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
26942 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26943 pub struct CResult_BlindedPathNoneZ {
26944 /// The contents of this CResult_BlindedPathNoneZ, accessible via either
26945 /// `err` or `result` depending on the state of `result_ok`.
26946 pub contents: CResult_BlindedPathNoneZPtr,
26947 /// Whether this CResult_BlindedPathNoneZ represents a success state.
26948 pub result_ok: bool,
26951 /// Creates a new CResult_BlindedPathNoneZ in the success state.
26952 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
26953 CResult_BlindedPathNoneZ {
26954 contents: CResult_BlindedPathNoneZPtr {
26955 result: Box::into_raw(Box::new(o)),
26961 /// Creates a new CResult_BlindedPathNoneZ in the error state.
26962 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
26963 CResult_BlindedPathNoneZ {
26964 contents: CResult_BlindedPathNoneZPtr {
26965 err: core::ptr::null_mut(),
26970 /// Checks if the given object is currently in the success state
26972 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
26976 /// Frees any resources used by the CResult_BlindedPathNoneZ.
26977 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
26978 impl Drop for CResult_BlindedPathNoneZ {
26979 fn drop(&mut self) {
26980 if self.result_ok {
26981 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26982 let _ = unsafe { Box::from_raw(self.contents.result) };
26988 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
26989 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
26990 let contents = if o.result_ok {
26991 let result = unsafe { o.contents.result };
26992 unsafe { o.contents.result = core::ptr::null_mut() };
26993 CResult_BlindedPathNoneZPtr { result }
26995 let _ = unsafe { Box::from_raw(o.contents.err) };
26996 o.contents.err = core::ptr::null_mut();
26997 CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
27001 result_ok: o.result_ok,
27005 impl Clone for CResult_BlindedPathNoneZ {
27006 fn clone(&self) -> Self {
27007 if self.result_ok {
27008 Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
27009 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
27012 Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
27013 err: core::ptr::null_mut()
27019 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
27020 /// but with all dynamically-allocated buffers duplicated in new buffers.
27021 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
27023 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
27024 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
27025 /// A pointer to the contents in the success state.
27026 /// Reading from this pointer when `result_ok` is not set is undefined.
27027 pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
27028 /// Note that this value is always NULL, as there are no contents in the Err variant
27029 pub err: *mut core::ffi::c_void,
27032 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
27033 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
27034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27035 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27036 /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
27037 /// `err` or `result` depending on the state of `result_ok`.
27038 pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
27039 /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
27040 pub result_ok: bool,
27043 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
27044 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27045 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27046 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
27047 result: Box::into_raw(Box::new(o)),
27053 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
27054 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27055 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27056 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
27057 err: core::ptr::null_mut(),
27062 /// Checks if the given object is currently in the success state
27064 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
27068 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
27069 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
27070 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27071 fn drop(&mut self) {
27072 if self.result_ok {
27073 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27074 let _ = unsafe { Box::from_raw(self.contents.result) };
27080 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27081 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
27082 let contents = if o.result_ok {
27083 let result = unsafe { o.contents.result };
27084 unsafe { o.contents.result = core::ptr::null_mut() };
27085 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
27087 let _ = unsafe { Box::from_raw(o.contents.err) };
27088 o.contents.err = core::ptr::null_mut();
27089 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
27093 result_ok: o.result_ok,
27097 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27098 fn clone(&self) -> Self {
27099 if self.result_ok {
27100 Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
27101 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
27104 Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
27105 err: core::ptr::null_mut()
27111 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
27112 /// but with all dynamically-allocated buffers duplicated in new buffers.
27113 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
27115 /// A dynamically-allocated array of crate::lightning::blinded_path::payment::ForwardNodes of arbitrary size.
27116 /// This corresponds to std::vector in C++
27117 pub struct CVec_ForwardNodeZ {
27118 /// The elements in the array.
27119 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27120 pub data: *mut crate::lightning::blinded_path::payment::ForwardNode,
27121 /// The number of elements pointed to by `data`.
27124 impl CVec_ForwardNodeZ {
27125 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::payment::ForwardNode> {
27126 if self.datalen == 0 { return Vec::new(); }
27127 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27128 self.data = core::ptr::null_mut();
27132 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::payment::ForwardNode] {
27133 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27136 impl From<Vec<crate::lightning::blinded_path::payment::ForwardNode>> for CVec_ForwardNodeZ {
27137 fn from(v: Vec<crate::lightning::blinded_path::payment::ForwardNode>) -> Self {
27138 let datalen = v.len();
27139 let data = Box::into_raw(v.into_boxed_slice());
27140 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27144 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27145 pub extern "C" fn CVec_ForwardNodeZ_free(_res: CVec_ForwardNodeZ) { }
27146 impl Drop for CVec_ForwardNodeZ {
27147 fn drop(&mut self) {
27148 if self.datalen == 0 { return; }
27149 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27152 impl Clone for CVec_ForwardNodeZ {
27153 fn clone(&self) -> Self {
27154 let mut res = Vec::new();
27155 if self.datalen == 0 { return Self::from(res); }
27156 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
27161 /// The contents of CResult_BlindedPathDecodeErrorZ
27162 pub union CResult_BlindedPathDecodeErrorZPtr {
27163 /// A pointer to the contents in the success state.
27164 /// Reading from this pointer when `result_ok` is not set is undefined.
27165 pub result: *mut crate::lightning::blinded_path::BlindedPath,
27166 /// A pointer to the contents in the error state.
27167 /// Reading from this pointer when `result_ok` is set is undefined.
27168 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27171 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
27172 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
27173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27174 pub struct CResult_BlindedPathDecodeErrorZ {
27175 /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
27176 /// `err` or `result` depending on the state of `result_ok`.
27177 pub contents: CResult_BlindedPathDecodeErrorZPtr,
27178 /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
27179 pub result_ok: bool,
27182 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
27183 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
27184 CResult_BlindedPathDecodeErrorZ {
27185 contents: CResult_BlindedPathDecodeErrorZPtr {
27186 result: Box::into_raw(Box::new(o)),
27192 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
27193 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
27194 CResult_BlindedPathDecodeErrorZ {
27195 contents: CResult_BlindedPathDecodeErrorZPtr {
27196 err: Box::into_raw(Box::new(e)),
27201 /// Checks if the given object is currently in the success state
27203 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
27207 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
27208 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
27209 impl Drop for CResult_BlindedPathDecodeErrorZ {
27210 fn drop(&mut self) {
27211 if self.result_ok {
27212 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27213 let _ = unsafe { Box::from_raw(self.contents.result) };
27216 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27217 let _ = unsafe { Box::from_raw(self.contents.err) };
27222 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
27223 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
27224 let contents = if o.result_ok {
27225 let result = unsafe { o.contents.result };
27226 unsafe { o.contents.result = core::ptr::null_mut() };
27227 CResult_BlindedPathDecodeErrorZPtr { result }
27229 let err = unsafe { o.contents.err };
27230 unsafe { o.contents.err = core::ptr::null_mut(); }
27231 CResult_BlindedPathDecodeErrorZPtr { err }
27235 result_ok: o.result_ok,
27239 impl Clone for CResult_BlindedPathDecodeErrorZ {
27240 fn clone(&self) -> Self {
27241 if self.result_ok {
27242 Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
27243 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
27246 Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
27247 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27253 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
27254 /// but with all dynamically-allocated buffers duplicated in new buffers.
27255 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
27257 /// The contents of CResult_BlindedHopDecodeErrorZ
27258 pub union CResult_BlindedHopDecodeErrorZPtr {
27259 /// A pointer to the contents in the success state.
27260 /// Reading from this pointer when `result_ok` is not set is undefined.
27261 pub result: *mut crate::lightning::blinded_path::BlindedHop,
27262 /// A pointer to the contents in the error state.
27263 /// Reading from this pointer when `result_ok` is set is undefined.
27264 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27267 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
27268 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
27269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27270 pub struct CResult_BlindedHopDecodeErrorZ {
27271 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
27272 /// `err` or `result` depending on the state of `result_ok`.
27273 pub contents: CResult_BlindedHopDecodeErrorZPtr,
27274 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
27275 pub result_ok: bool,
27278 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
27279 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
27280 CResult_BlindedHopDecodeErrorZ {
27281 contents: CResult_BlindedHopDecodeErrorZPtr {
27282 result: Box::into_raw(Box::new(o)),
27288 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
27289 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
27290 CResult_BlindedHopDecodeErrorZ {
27291 contents: CResult_BlindedHopDecodeErrorZPtr {
27292 err: Box::into_raw(Box::new(e)),
27297 /// Checks if the given object is currently in the success state
27299 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
27303 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
27304 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
27305 impl Drop for CResult_BlindedHopDecodeErrorZ {
27306 fn drop(&mut self) {
27307 if self.result_ok {
27308 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27309 let _ = unsafe { Box::from_raw(self.contents.result) };
27312 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27313 let _ = unsafe { Box::from_raw(self.contents.err) };
27318 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
27319 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
27320 let contents = if o.result_ok {
27321 let result = unsafe { o.contents.result };
27322 unsafe { o.contents.result = core::ptr::null_mut() };
27323 CResult_BlindedHopDecodeErrorZPtr { result }
27325 let err = unsafe { o.contents.err };
27326 unsafe { o.contents.err = core::ptr::null_mut(); }
27327 CResult_BlindedHopDecodeErrorZPtr { err }
27331 result_ok: o.result_ok,
27335 impl Clone for CResult_BlindedHopDecodeErrorZ {
27336 fn clone(&self) -> Self {
27337 if self.result_ok {
27338 Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
27339 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
27342 Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
27343 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27349 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
27350 /// but with all dynamically-allocated buffers duplicated in new buffers.
27351 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
27353 /// The contents of CResult_InvoiceErrorDecodeErrorZ
27354 pub union CResult_InvoiceErrorDecodeErrorZPtr {
27355 /// A pointer to the contents in the success state.
27356 /// Reading from this pointer when `result_ok` is not set is undefined.
27357 pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
27358 /// A pointer to the contents in the error state.
27359 /// Reading from this pointer when `result_ok` is set is undefined.
27360 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27363 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
27364 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
27365 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27366 pub struct CResult_InvoiceErrorDecodeErrorZ {
27367 /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
27368 /// `err` or `result` depending on the state of `result_ok`.
27369 pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
27370 /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
27371 pub result_ok: bool,
27374 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
27375 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
27376 CResult_InvoiceErrorDecodeErrorZ {
27377 contents: CResult_InvoiceErrorDecodeErrorZPtr {
27378 result: Box::into_raw(Box::new(o)),
27384 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
27385 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
27386 CResult_InvoiceErrorDecodeErrorZ {
27387 contents: CResult_InvoiceErrorDecodeErrorZPtr {
27388 err: Box::into_raw(Box::new(e)),
27393 /// Checks if the given object is currently in the success state
27395 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
27399 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
27400 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
27401 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
27402 fn drop(&mut self) {
27403 if self.result_ok {
27404 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27405 let _ = unsafe { Box::from_raw(self.contents.result) };
27408 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27409 let _ = unsafe { Box::from_raw(self.contents.err) };
27414 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
27415 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
27416 let contents = if o.result_ok {
27417 let result = unsafe { o.contents.result };
27418 unsafe { o.contents.result = core::ptr::null_mut() };
27419 CResult_InvoiceErrorDecodeErrorZPtr { result }
27421 let err = unsafe { o.contents.err };
27422 unsafe { o.contents.err = core::ptr::null_mut(); }
27423 CResult_InvoiceErrorDecodeErrorZPtr { err }
27427 result_ok: o.result_ok,
27431 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
27432 fn clone(&self) -> Self {
27433 if self.result_ok {
27434 Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
27435 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
27438 Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
27439 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27445 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
27446 /// but with all dynamically-allocated buffers duplicated in new buffers.
27447 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
27449 /// The contents of CResult_TrackedSpendableOutputDecodeErrorZ
27450 pub union CResult_TrackedSpendableOutputDecodeErrorZPtr {
27451 /// A pointer to the contents in the success state.
27452 /// Reading from this pointer when `result_ok` is not set is undefined.
27453 pub result: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
27454 /// A pointer to the contents in the error state.
27455 /// Reading from this pointer when `result_ok` is set is undefined.
27456 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27459 /// A CResult_TrackedSpendableOutputDecodeErrorZ represents the result of a fallible operation,
27460 /// containing a crate::lightning::util::sweep::TrackedSpendableOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
27461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27462 pub struct CResult_TrackedSpendableOutputDecodeErrorZ {
27463 /// The contents of this CResult_TrackedSpendableOutputDecodeErrorZ, accessible via either
27464 /// `err` or `result` depending on the state of `result_ok`.
27465 pub contents: CResult_TrackedSpendableOutputDecodeErrorZPtr,
27466 /// Whether this CResult_TrackedSpendableOutputDecodeErrorZ represents a success state.
27467 pub result_ok: bool,
27470 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the success state.
27471 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_ok(o: crate::lightning::util::sweep::TrackedSpendableOutput) -> CResult_TrackedSpendableOutputDecodeErrorZ {
27472 CResult_TrackedSpendableOutputDecodeErrorZ {
27473 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
27474 result: Box::into_raw(Box::new(o)),
27480 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the error state.
27481 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TrackedSpendableOutputDecodeErrorZ {
27482 CResult_TrackedSpendableOutputDecodeErrorZ {
27483 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
27484 err: Box::into_raw(Box::new(e)),
27489 /// Checks if the given object is currently in the success state
27491 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o: &CResult_TrackedSpendableOutputDecodeErrorZ) -> bool {
27495 /// Frees any resources used by the CResult_TrackedSpendableOutputDecodeErrorZ.
27496 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_free(_res: CResult_TrackedSpendableOutputDecodeErrorZ) { }
27497 impl Drop for CResult_TrackedSpendableOutputDecodeErrorZ {
27498 fn drop(&mut self) {
27499 if self.result_ok {
27500 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27501 let _ = unsafe { Box::from_raw(self.contents.result) };
27504 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27505 let _ = unsafe { Box::from_raw(self.contents.err) };
27510 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TrackedSpendableOutputDecodeErrorZ {
27511 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
27512 let contents = if o.result_ok {
27513 let result = unsafe { o.contents.result };
27514 unsafe { o.contents.result = core::ptr::null_mut() };
27515 CResult_TrackedSpendableOutputDecodeErrorZPtr { result }
27517 let err = unsafe { o.contents.err };
27518 unsafe { o.contents.err = core::ptr::null_mut(); }
27519 CResult_TrackedSpendableOutputDecodeErrorZPtr { err }
27523 result_ok: o.result_ok,
27527 impl Clone for CResult_TrackedSpendableOutputDecodeErrorZ {
27528 fn clone(&self) -> Self {
27529 if self.result_ok {
27530 Self { result_ok: true, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
27531 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::TrackedSpendableOutput>::clone(unsafe { &*self.contents.result })))
27534 Self { result_ok: false, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
27535 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27541 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ which has the same data as `orig`
27542 /// but with all dynamically-allocated buffers duplicated in new buffers.
27543 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig: &CResult_TrackedSpendableOutputDecodeErrorZ) -> CResult_TrackedSpendableOutputDecodeErrorZ { Clone::clone(&orig) }
27545 /// The contents of CResult_OutputSpendStatusDecodeErrorZ
27546 pub union CResult_OutputSpendStatusDecodeErrorZPtr {
27547 /// A pointer to the contents in the success state.
27548 /// Reading from this pointer when `result_ok` is not set is undefined.
27549 pub result: *mut crate::lightning::util::sweep::OutputSpendStatus,
27550 /// A pointer to the contents in the error state.
27551 /// Reading from this pointer when `result_ok` is set is undefined.
27552 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27555 /// A CResult_OutputSpendStatusDecodeErrorZ represents the result of a fallible operation,
27556 /// containing a crate::lightning::util::sweep::OutputSpendStatus on success and a crate::lightning::ln::msgs::DecodeError on failure.
27557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27558 pub struct CResult_OutputSpendStatusDecodeErrorZ {
27559 /// The contents of this CResult_OutputSpendStatusDecodeErrorZ, accessible via either
27560 /// `err` or `result` depending on the state of `result_ok`.
27561 pub contents: CResult_OutputSpendStatusDecodeErrorZPtr,
27562 /// Whether this CResult_OutputSpendStatusDecodeErrorZ represents a success state.
27563 pub result_ok: bool,
27566 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the success state.
27567 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSpendStatus) -> CResult_OutputSpendStatusDecodeErrorZ {
27568 CResult_OutputSpendStatusDecodeErrorZ {
27569 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27570 result: Box::into_raw(Box::new(o)),
27576 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the error state.
27577 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSpendStatusDecodeErrorZ {
27578 CResult_OutputSpendStatusDecodeErrorZ {
27579 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27580 err: Box::into_raw(Box::new(e)),
27585 /// Checks if the given object is currently in the success state
27587 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_is_ok(o: &CResult_OutputSpendStatusDecodeErrorZ) -> bool {
27591 /// Frees any resources used by the CResult_OutputSpendStatusDecodeErrorZ.
27592 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_free(_res: CResult_OutputSpendStatusDecodeErrorZ) { }
27593 impl Drop for CResult_OutputSpendStatusDecodeErrorZ {
27594 fn drop(&mut self) {
27595 if self.result_ok {
27596 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27597 let _ = unsafe { Box::from_raw(self.contents.result) };
27600 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27601 let _ = unsafe { Box::from_raw(self.contents.err) };
27606 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSpendStatusDecodeErrorZ {
27607 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>) -> Self {
27608 let contents = if o.result_ok {
27609 let result = unsafe { o.contents.result };
27610 unsafe { o.contents.result = core::ptr::null_mut() };
27611 CResult_OutputSpendStatusDecodeErrorZPtr { result }
27613 let err = unsafe { o.contents.err };
27614 unsafe { o.contents.err = core::ptr::null_mut(); }
27615 CResult_OutputSpendStatusDecodeErrorZPtr { err }
27619 result_ok: o.result_ok,
27623 impl Clone for CResult_OutputSpendStatusDecodeErrorZ {
27624 fn clone(&self) -> Self {
27625 if self.result_ok {
27626 Self { result_ok: true, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27627 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::OutputSpendStatus>::clone(unsafe { &*self.contents.result })))
27630 Self { result_ok: false, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27631 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27637 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ which has the same data as `orig`
27638 /// but with all dynamically-allocated buffers duplicated in new buffers.
27639 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_clone(orig: &CResult_OutputSpendStatusDecodeErrorZ) -> CResult_OutputSpendStatusDecodeErrorZ { Clone::clone(&orig) }
27641 /// An enum which can either contain a crate::lightning::chain::Filter or not
27642 pub enum COption_FilterZ {
27643 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
27644 Some(crate::lightning::chain::Filter),
27645 /// When we're in this state, this COption_FilterZ contains nothing
27648 impl COption_FilterZ {
27649 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
27650 if let Self::None = self { false } else { true }
27652 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
27655 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
27656 if let Self::Some(v) = self { v } else { unreachable!() }
27660 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
27661 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
27662 COption_FilterZ::Some(o)
27665 /// Constructs a new COption_FilterZ containing nothing
27666 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
27667 COption_FilterZ::None
27670 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
27671 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
27673 /// A dynamically-allocated array of crate::lightning::util::sweep::TrackedSpendableOutputs of arbitrary size.
27674 /// This corresponds to std::vector in C++
27675 pub struct CVec_TrackedSpendableOutputZ {
27676 /// The elements in the array.
27677 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27678 pub data: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
27679 /// The number of elements pointed to by `data`.
27682 impl CVec_TrackedSpendableOutputZ {
27683 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::sweep::TrackedSpendableOutput> {
27684 if self.datalen == 0 { return Vec::new(); }
27685 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27686 self.data = core::ptr::null_mut();
27690 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::sweep::TrackedSpendableOutput] {
27691 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27694 impl From<Vec<crate::lightning::util::sweep::TrackedSpendableOutput>> for CVec_TrackedSpendableOutputZ {
27695 fn from(v: Vec<crate::lightning::util::sweep::TrackedSpendableOutput>) -> Self {
27696 let datalen = v.len();
27697 let data = Box::into_raw(v.into_boxed_slice());
27698 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27702 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27703 pub extern "C" fn CVec_TrackedSpendableOutputZ_free(_res: CVec_TrackedSpendableOutputZ) { }
27704 impl Drop for CVec_TrackedSpendableOutputZ {
27705 fn drop(&mut self) {
27706 if self.datalen == 0 { return; }
27707 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27710 impl Clone for CVec_TrackedSpendableOutputZ {
27711 fn clone(&self) -> Self {
27712 let mut res = Vec::new();
27713 if self.datalen == 0 { return Self::from(res); }
27714 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
27719 /// The contents of CResult_OutputSweeperDecodeErrorZ
27720 pub union CResult_OutputSweeperDecodeErrorZPtr {
27721 /// A pointer to the contents in the success state.
27722 /// Reading from this pointer when `result_ok` is not set is undefined.
27723 pub result: *mut crate::lightning::util::sweep::OutputSweeper,
27724 /// A pointer to the contents in the error state.
27725 /// Reading from this pointer when `result_ok` is set is undefined.
27726 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27729 /// A CResult_OutputSweeperDecodeErrorZ represents the result of a fallible operation,
27730 /// containing a crate::lightning::util::sweep::OutputSweeper on success and a crate::lightning::ln::msgs::DecodeError on failure.
27731 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27732 pub struct CResult_OutputSweeperDecodeErrorZ {
27733 /// The contents of this CResult_OutputSweeperDecodeErrorZ, accessible via either
27734 /// `err` or `result` depending on the state of `result_ok`.
27735 pub contents: CResult_OutputSweeperDecodeErrorZPtr,
27736 /// Whether this CResult_OutputSweeperDecodeErrorZ represents a success state.
27737 pub result_ok: bool,
27740 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the success state.
27741 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSweeper) -> CResult_OutputSweeperDecodeErrorZ {
27742 CResult_OutputSweeperDecodeErrorZ {
27743 contents: CResult_OutputSweeperDecodeErrorZPtr {
27744 result: Box::into_raw(Box::new(o)),
27750 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the error state.
27751 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSweeperDecodeErrorZ {
27752 CResult_OutputSweeperDecodeErrorZ {
27753 contents: CResult_OutputSweeperDecodeErrorZPtr {
27754 err: Box::into_raw(Box::new(e)),
27759 /// Checks if the given object is currently in the success state
27761 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_is_ok(o: &CResult_OutputSweeperDecodeErrorZ) -> bool {
27765 /// Frees any resources used by the CResult_OutputSweeperDecodeErrorZ.
27766 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_free(_res: CResult_OutputSweeperDecodeErrorZ) { }
27767 impl Drop for CResult_OutputSweeperDecodeErrorZ {
27768 fn drop(&mut self) {
27769 if self.result_ok {
27770 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27771 let _ = unsafe { Box::from_raw(self.contents.result) };
27774 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27775 let _ = unsafe { Box::from_raw(self.contents.err) };
27780 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSweeperDecodeErrorZ {
27781 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>) -> Self {
27782 let contents = if o.result_ok {
27783 let result = unsafe { o.contents.result };
27784 unsafe { o.contents.result = core::ptr::null_mut() };
27785 CResult_OutputSweeperDecodeErrorZPtr { result }
27787 let err = unsafe { o.contents.err };
27788 unsafe { o.contents.err = core::ptr::null_mut(); }
27789 CResult_OutputSweeperDecodeErrorZPtr { err }
27793 result_ok: o.result_ok,
27798 /// A tuple of 2 elements. See the individual fields for the types contained.
27799 pub struct C2Tuple_BestBlockOutputSweeperZ {
27800 /// The element at position 0
27801 pub a: crate::lightning::chain::BestBlock,
27802 /// The element at position 1
27803 pub b: crate::lightning::util::sweep::OutputSweeper,
27805 impl From<(crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)> for C2Tuple_BestBlockOutputSweeperZ {
27806 fn from (tup: (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)) -> Self {
27813 impl C2Tuple_BestBlockOutputSweeperZ {
27814 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper) {
27818 /// Creates a new C2Tuple_BestBlockOutputSweeperZ from the contained elements.
27820 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_new(a: crate::lightning::chain::BestBlock, b: crate::lightning::util::sweep::OutputSweeper) -> C2Tuple_BestBlockOutputSweeperZ {
27821 C2Tuple_BestBlockOutputSweeperZ { a, b, }
27825 /// Frees any resources used by the C2Tuple_BestBlockOutputSweeperZ.
27826 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_free(_res: C2Tuple_BestBlockOutputSweeperZ) { }
27828 /// The contents of CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ
27829 pub union CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27830 /// A pointer to the contents in the success state.
27831 /// Reading from this pointer when `result_ok` is not set is undefined.
27832 pub result: *mut crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ,
27833 /// A pointer to the contents in the error state.
27834 /// Reading from this pointer when `result_ok` is set is undefined.
27835 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27838 /// A CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents the result of a fallible operation,
27839 /// containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
27840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27841 pub struct CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27842 /// The contents of this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ, accessible via either
27843 /// `err` or `result` depending on the state of `result_ok`.
27844 pub contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr,
27845 /// Whether this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents a success state.
27846 pub result_ok: bool,
27849 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the success state.
27850 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27851 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27852 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27853 result: Box::into_raw(Box::new(o)),
27859 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the error state.
27860 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27861 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27862 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27863 err: Box::into_raw(Box::new(e)),
27868 /// Checks if the given object is currently in the success state
27870 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) -> bool {
27874 /// Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ.
27875 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) { }
27876 impl Drop for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27877 fn drop(&mut self) {
27878 if self.result_ok {
27879 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27880 let _ = unsafe { Box::from_raw(self.contents.result) };
27883 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27884 let _ = unsafe { Box::from_raw(self.contents.err) };
27889 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27890 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
27891 let contents = if o.result_ok {
27892 let result = unsafe { o.contents.result };
27893 unsafe { o.contents.result = core::ptr::null_mut() };
27894 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { result }
27896 let err = unsafe { o.contents.err };
27897 unsafe { o.contents.err = core::ptr::null_mut(); }
27898 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { err }
27902 result_ok: o.result_ok,
27907 /// The contents of CResult_DelayedPaymentBasepointDecodeErrorZ
27908 pub union CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27909 /// A pointer to the contents in the success state.
27910 /// Reading from this pointer when `result_ok` is not set is undefined.
27911 pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentBasepoint,
27912 /// A pointer to the contents in the error state.
27913 /// Reading from this pointer when `result_ok` is set is undefined.
27914 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27917 /// A CResult_DelayedPaymentBasepointDecodeErrorZ represents the result of a fallible operation,
27918 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27919 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27920 pub struct CResult_DelayedPaymentBasepointDecodeErrorZ {
27921 /// The contents of this CResult_DelayedPaymentBasepointDecodeErrorZ, accessible via either
27922 /// `err` or `result` depending on the state of `result_ok`.
27923 pub contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr,
27924 /// Whether this CResult_DelayedPaymentBasepointDecodeErrorZ represents a success state.
27925 pub result_ok: bool,
27928 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state.
27929 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentBasepoint) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
27930 CResult_DelayedPaymentBasepointDecodeErrorZ {
27931 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27932 result: Box::into_raw(Box::new(o)),
27938 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state.
27939 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
27940 CResult_DelayedPaymentBasepointDecodeErrorZ {
27941 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27942 err: Box::into_raw(Box::new(e)),
27947 /// Checks if the given object is currently in the success state
27949 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> bool {
27953 /// Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ.
27954 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res: CResult_DelayedPaymentBasepointDecodeErrorZ) { }
27955 impl Drop for CResult_DelayedPaymentBasepointDecodeErrorZ {
27956 fn drop(&mut self) {
27957 if self.result_ok {
27958 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27959 let _ = unsafe { Box::from_raw(self.contents.result) };
27962 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27963 let _ = unsafe { Box::from_raw(self.contents.err) };
27968 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentBasepointDecodeErrorZ {
27969 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27970 let contents = if o.result_ok {
27971 let result = unsafe { o.contents.result };
27972 unsafe { o.contents.result = core::ptr::null_mut() };
27973 CResult_DelayedPaymentBasepointDecodeErrorZPtr { result }
27975 let err = unsafe { o.contents.err };
27976 unsafe { o.contents.err = core::ptr::null_mut(); }
27977 CResult_DelayedPaymentBasepointDecodeErrorZPtr { err }
27981 result_ok: o.result_ok,
27985 impl Clone for CResult_DelayedPaymentBasepointDecodeErrorZ {
27986 fn clone(&self) -> Self {
27987 if self.result_ok {
27988 Self { result_ok: true, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27989 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint>::clone(unsafe { &*self.contents.result })))
27992 Self { result_ok: false, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27993 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27999 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig`
28000 /// but with all dynamically-allocated buffers duplicated in new buffers.
28001 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> CResult_DelayedPaymentBasepointDecodeErrorZ { Clone::clone(&orig) }
28003 /// The contents of CResult_DelayedPaymentKeyDecodeErrorZ
28004 pub union CResult_DelayedPaymentKeyDecodeErrorZPtr {
28005 /// A pointer to the contents in the success state.
28006 /// Reading from this pointer when `result_ok` is not set is undefined.
28007 pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentKey,
28008 /// A pointer to the contents in the error state.
28009 /// Reading from this pointer when `result_ok` is set is undefined.
28010 pub err: *mut crate::lightning::ln::msgs::DecodeError,
28013 /// A CResult_DelayedPaymentKeyDecodeErrorZ represents the result of a fallible operation,
28014 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
28015 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28016 pub struct CResult_DelayedPaymentKeyDecodeErrorZ {
28017 /// The contents of this CResult_DelayedPaymentKeyDecodeErrorZ, accessible via either
28018 /// `err` or `result` depending on the state of `result_ok`.
28019 pub contents: CResult_DelayedPaymentKeyDecodeErrorZPtr,
28020 /// Whether this CResult_DelayedPaymentKeyDecodeErrorZ represents a success state.
28021 pub result_ok: bool,
28024 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state.
28025 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentKey) -> CResult_DelayedPaymentKeyDecodeErrorZ {
28026 CResult_DelayedPaymentKeyDecodeErrorZ {
28027 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
28028 result: Box::into_raw(Box::new(o)),
28034 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state.
28035 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentKeyDecodeErrorZ {
28036 CResult_DelayedPaymentKeyDecodeErrorZ {
28037 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
28038 err: Box::into_raw(Box::new(e)),
28043 /// Checks if the given object is currently in the success state
28045 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentKeyDecodeErrorZ) -> bool {
28049 /// Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ.
28050 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_free(_res: CResult_DelayedPaymentKeyDecodeErrorZ) { }
28051 impl Drop for CResult_DelayedPaymentKeyDecodeErrorZ {
28052 fn drop(&mut self) {
28053 if self.result_ok {
28054 if unsafe { !(self.contents.result as *mut ()).is_null() } {
28055 let _ = unsafe { Box::from_raw(self.contents.result) };
28058 if unsafe { !(self.contents.err as *mut ()).is_null() } {
28059 let _ = unsafe { Box::from_raw(self.contents.err) };
28064 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentKeyDecodeErrorZ {
28065 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
28066 let contents = if o.result_ok {
28067 let result = unsafe { o.contents.result };
28068 unsafe { o.contents.result = core::ptr::null_mut() };
28069 CResult_DelayedPaymentKeyDecodeErrorZPtr { result }
28071 let err = unsafe { o.contents.err };
28072 unsafe { o.contents.err = core::ptr::null_mut(); }
28073 CResult_DelayedPaymentKeyDecodeErrorZPtr { err }
28077 result_ok: o.result_ok,
28081 impl Clone for CResult_DelayedPaymentKeyDecodeErrorZ {
28082 fn clone(&self) -> Self {
28083 if self.result_ok {
28084 Self { result_ok: true, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
28085 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentKey>::clone(unsafe { &*self.contents.result })))
28088 Self { result_ok: false, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
28089 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
28095 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig`
28096 /// but with all dynamically-allocated buffers duplicated in new buffers.
28097 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig: &CResult_DelayedPaymentKeyDecodeErrorZ) -> CResult_DelayedPaymentKeyDecodeErrorZ { Clone::clone(&orig) }
28099 /// The contents of CResult_HtlcBasepointDecodeErrorZ
28100 pub union CResult_HtlcBasepointDecodeErrorZPtr {
28101 /// A pointer to the contents in the success state.
28102 /// Reading from this pointer when `result_ok` is not set is undefined.
28103 pub result: *mut crate::lightning::ln::channel_keys::HtlcBasepoint,
28104 /// A pointer to the contents in the error state.
28105 /// Reading from this pointer when `result_ok` is set is undefined.
28106 pub err: *mut crate::lightning::ln::msgs::DecodeError,
28109 /// A CResult_HtlcBasepointDecodeErrorZ represents the result of a fallible operation,
28110 /// containing a crate::lightning::ln::channel_keys::HtlcBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
28111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28112 pub struct CResult_HtlcBasepointDecodeErrorZ {
28113 /// The contents of this CResult_HtlcBasepointDecodeErrorZ, accessible via either
28114 /// `err` or `result` depending on the state of `result_ok`.
28115 pub contents: CResult_HtlcBasepointDecodeErrorZPtr,
28116 /// Whether this CResult_HtlcBasepointDecodeErrorZ represents a success state.
28117 pub result_ok: bool,
28120 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state.
28121 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcBasepoint) -> CResult_HtlcBasepointDecodeErrorZ {
28122 CResult_HtlcBasepointDecodeErrorZ {
28123 contents: CResult_HtlcBasepointDecodeErrorZPtr {
28124 result: Box::into_raw(Box::new(o)),
28130 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state.
28131 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcBasepointDecodeErrorZ {
28132 CResult_HtlcBasepointDecodeErrorZ {
28133 contents: CResult_HtlcBasepointDecodeErrorZPtr {
28134 err: Box::into_raw(Box::new(e)),
28139 /// Checks if the given object is currently in the success state
28141 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_is_ok(o: &CResult_HtlcBasepointDecodeErrorZ) -> bool {
28145 /// Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ.
28146 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_free(_res: CResult_HtlcBasepointDecodeErrorZ) { }
28147 impl Drop for CResult_HtlcBasepointDecodeErrorZ {
28148 fn drop(&mut self) {
28149 if self.result_ok {
28150 if unsafe { !(self.contents.result as *mut ()).is_null() } {
28151 let _ = unsafe { Box::from_raw(self.contents.result) };
28154 if unsafe { !(self.contents.err as *mut ()).is_null() } {
28155 let _ = unsafe { Box::from_raw(self.contents.err) };
28160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcBasepointDecodeErrorZ {
28161 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
28162 let contents = if o.result_ok {
28163 let result = unsafe { o.contents.result };
28164 unsafe { o.contents.result = core::ptr::null_mut() };
28165 CResult_HtlcBasepointDecodeErrorZPtr { result }
28167 let err = unsafe { o.contents.err };
28168 unsafe { o.contents.err = core::ptr::null_mut(); }
28169 CResult_HtlcBasepointDecodeErrorZPtr { err }
28173 result_ok: o.result_ok,
28177 impl Clone for CResult_HtlcBasepointDecodeErrorZ {
28178 fn clone(&self) -> Self {
28179 if self.result_ok {
28180 Self { result_ok: true, contents: CResult_HtlcBasepointDecodeErrorZPtr {
28181 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcBasepoint>::clone(unsafe { &*self.contents.result })))
28184 Self { result_ok: false, contents: CResult_HtlcBasepointDecodeErrorZPtr {
28185 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
28191 /// Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig`
28192 /// but with all dynamically-allocated buffers duplicated in new buffers.
28193 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_clone(orig: &CResult_HtlcBasepointDecodeErrorZ) -> CResult_HtlcBasepointDecodeErrorZ { Clone::clone(&orig) }
28195 /// The contents of CResult_HtlcKeyDecodeErrorZ
28196 pub union CResult_HtlcKeyDecodeErrorZPtr {
28197 /// A pointer to the contents in the success state.
28198 /// Reading from this pointer when `result_ok` is not set is undefined.
28199 pub result: *mut crate::lightning::ln::channel_keys::HtlcKey,
28200 /// A pointer to the contents in the error state.
28201 /// Reading from this pointer when `result_ok` is set is undefined.
28202 pub err: *mut crate::lightning::ln::msgs::DecodeError,
28205 /// A CResult_HtlcKeyDecodeErrorZ represents the result of a fallible operation,
28206 /// containing a crate::lightning::ln::channel_keys::HtlcKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
28207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28208 pub struct CResult_HtlcKeyDecodeErrorZ {
28209 /// The contents of this CResult_HtlcKeyDecodeErrorZ, accessible via either
28210 /// `err` or `result` depending on the state of `result_ok`.
28211 pub contents: CResult_HtlcKeyDecodeErrorZPtr,
28212 /// Whether this CResult_HtlcKeyDecodeErrorZ represents a success state.
28213 pub result_ok: bool,
28216 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the success state.
28217 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcKey) -> CResult_HtlcKeyDecodeErrorZ {
28218 CResult_HtlcKeyDecodeErrorZ {
28219 contents: CResult_HtlcKeyDecodeErrorZPtr {
28220 result: Box::into_raw(Box::new(o)),
28226 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the error state.
28227 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcKeyDecodeErrorZ {
28228 CResult_HtlcKeyDecodeErrorZ {
28229 contents: CResult_HtlcKeyDecodeErrorZPtr {
28230 err: Box::into_raw(Box::new(e)),
28235 /// Checks if the given object is currently in the success state
28237 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_is_ok(o: &CResult_HtlcKeyDecodeErrorZ) -> bool {
28241 /// Frees any resources used by the CResult_HtlcKeyDecodeErrorZ.
28242 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_free(_res: CResult_HtlcKeyDecodeErrorZ) { }
28243 impl Drop for CResult_HtlcKeyDecodeErrorZ {
28244 fn drop(&mut self) {
28245 if self.result_ok {
28246 if unsafe { !(self.contents.result as *mut ()).is_null() } {
28247 let _ = unsafe { Box::from_raw(self.contents.result) };
28250 if unsafe { !(self.contents.err as *mut ()).is_null() } {
28251 let _ = unsafe { Box::from_raw(self.contents.err) };
28256 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcKeyDecodeErrorZ {
28257 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
28258 let contents = if o.result_ok {
28259 let result = unsafe { o.contents.result };
28260 unsafe { o.contents.result = core::ptr::null_mut() };
28261 CResult_HtlcKeyDecodeErrorZPtr { result }
28263 let err = unsafe { o.contents.err };
28264 unsafe { o.contents.err = core::ptr::null_mut(); }
28265 CResult_HtlcKeyDecodeErrorZPtr { err }
28269 result_ok: o.result_ok,
28273 impl Clone for CResult_HtlcKeyDecodeErrorZ {
28274 fn clone(&self) -> Self {
28275 if self.result_ok {
28276 Self { result_ok: true, contents: CResult_HtlcKeyDecodeErrorZPtr {
28277 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcKey>::clone(unsafe { &*self.contents.result })))
28280 Self { result_ok: false, contents: CResult_HtlcKeyDecodeErrorZPtr {
28281 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
28287 /// Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig`
28288 /// but with all dynamically-allocated buffers duplicated in new buffers.
28289 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_clone(orig: &CResult_HtlcKeyDecodeErrorZ) -> CResult_HtlcKeyDecodeErrorZ { Clone::clone(&orig) }
28291 /// The contents of CResult_RevocationBasepointDecodeErrorZ
28292 pub union CResult_RevocationBasepointDecodeErrorZPtr {
28293 /// A pointer to the contents in the success state.
28294 /// Reading from this pointer when `result_ok` is not set is undefined.
28295 pub result: *mut crate::lightning::ln::channel_keys::RevocationBasepoint,
28296 /// A pointer to the contents in the error state.
28297 /// Reading from this pointer when `result_ok` is set is undefined.
28298 pub err: *mut crate::lightning::ln::msgs::DecodeError,
28301 /// A CResult_RevocationBasepointDecodeErrorZ represents the result of a fallible operation,
28302 /// containing a crate::lightning::ln::channel_keys::RevocationBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
28303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28304 pub struct CResult_RevocationBasepointDecodeErrorZ {
28305 /// The contents of this CResult_RevocationBasepointDecodeErrorZ, accessible via either
28306 /// `err` or `result` depending on the state of `result_ok`.
28307 pub contents: CResult_RevocationBasepointDecodeErrorZPtr,
28308 /// Whether this CResult_RevocationBasepointDecodeErrorZ represents a success state.
28309 pub result_ok: bool,
28312 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state.
28313 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationBasepoint) -> CResult_RevocationBasepointDecodeErrorZ {
28314 CResult_RevocationBasepointDecodeErrorZ {
28315 contents: CResult_RevocationBasepointDecodeErrorZPtr {
28316 result: Box::into_raw(Box::new(o)),
28322 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state.
28323 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationBasepointDecodeErrorZ {
28324 CResult_RevocationBasepointDecodeErrorZ {
28325 contents: CResult_RevocationBasepointDecodeErrorZPtr {
28326 err: Box::into_raw(Box::new(e)),
28331 /// Checks if the given object is currently in the success state
28333 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_is_ok(o: &CResult_RevocationBasepointDecodeErrorZ) -> bool {
28337 /// Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ.
28338 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_free(_res: CResult_RevocationBasepointDecodeErrorZ) { }
28339 impl Drop for CResult_RevocationBasepointDecodeErrorZ {
28340 fn drop(&mut self) {
28341 if self.result_ok {
28342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
28343 let _ = unsafe { Box::from_raw(self.contents.result) };
28346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
28347 let _ = unsafe { Box::from_raw(self.contents.err) };
28352 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationBasepointDecodeErrorZ {
28353 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
28354 let contents = if o.result_ok {
28355 let result = unsafe { o.contents.result };
28356 unsafe { o.contents.result = core::ptr::null_mut() };
28357 CResult_RevocationBasepointDecodeErrorZPtr { result }
28359 let err = unsafe { o.contents.err };
28360 unsafe { o.contents.err = core::ptr::null_mut(); }
28361 CResult_RevocationBasepointDecodeErrorZPtr { err }
28365 result_ok: o.result_ok,
28369 impl Clone for CResult_RevocationBasepointDecodeErrorZ {
28370 fn clone(&self) -> Self {
28371 if self.result_ok {
28372 Self { result_ok: true, contents: CResult_RevocationBasepointDecodeErrorZPtr {
28373 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationBasepoint>::clone(unsafe { &*self.contents.result })))
28376 Self { result_ok: false, contents: CResult_RevocationBasepointDecodeErrorZPtr {
28377 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
28383 /// Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig`
28384 /// but with all dynamically-allocated buffers duplicated in new buffers.
28385 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_clone(orig: &CResult_RevocationBasepointDecodeErrorZ) -> CResult_RevocationBasepointDecodeErrorZ { Clone::clone(&orig) }
28387 /// The contents of CResult_RevocationKeyDecodeErrorZ
28388 pub union CResult_RevocationKeyDecodeErrorZPtr {
28389 /// A pointer to the contents in the success state.
28390 /// Reading from this pointer when `result_ok` is not set is undefined.
28391 pub result: *mut crate::lightning::ln::channel_keys::RevocationKey,
28392 /// A pointer to the contents in the error state.
28393 /// Reading from this pointer when `result_ok` is set is undefined.
28394 pub err: *mut crate::lightning::ln::msgs::DecodeError,
28397 /// A CResult_RevocationKeyDecodeErrorZ represents the result of a fallible operation,
28398 /// containing a crate::lightning::ln::channel_keys::RevocationKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
28399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28400 pub struct CResult_RevocationKeyDecodeErrorZ {
28401 /// The contents of this CResult_RevocationKeyDecodeErrorZ, accessible via either
28402 /// `err` or `result` depending on the state of `result_ok`.
28403 pub contents: CResult_RevocationKeyDecodeErrorZPtr,
28404 /// Whether this CResult_RevocationKeyDecodeErrorZ represents a success state.
28405 pub result_ok: bool,
28408 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the success state.
28409 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationKey) -> CResult_RevocationKeyDecodeErrorZ {
28410 CResult_RevocationKeyDecodeErrorZ {
28411 contents: CResult_RevocationKeyDecodeErrorZPtr {
28412 result: Box::into_raw(Box::new(o)),
28418 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the error state.
28419 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationKeyDecodeErrorZ {
28420 CResult_RevocationKeyDecodeErrorZ {
28421 contents: CResult_RevocationKeyDecodeErrorZPtr {
28422 err: Box::into_raw(Box::new(e)),
28427 /// Checks if the given object is currently in the success state
28429 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_is_ok(o: &CResult_RevocationKeyDecodeErrorZ) -> bool {
28433 /// Frees any resources used by the CResult_RevocationKeyDecodeErrorZ.
28434 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_free(_res: CResult_RevocationKeyDecodeErrorZ) { }
28435 impl Drop for CResult_RevocationKeyDecodeErrorZ {
28436 fn drop(&mut self) {
28437 if self.result_ok {
28438 if unsafe { !(self.contents.result as *mut ()).is_null() } {
28439 let _ = unsafe { Box::from_raw(self.contents.result) };
28442 if unsafe { !(self.contents.err as *mut ()).is_null() } {
28443 let _ = unsafe { Box::from_raw(self.contents.err) };
28448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationKeyDecodeErrorZ {
28449 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
28450 let contents = if o.result_ok {
28451 let result = unsafe { o.contents.result };
28452 unsafe { o.contents.result = core::ptr::null_mut() };
28453 CResult_RevocationKeyDecodeErrorZPtr { result }
28455 let err = unsafe { o.contents.err };
28456 unsafe { o.contents.err = core::ptr::null_mut(); }
28457 CResult_RevocationKeyDecodeErrorZPtr { err }
28461 result_ok: o.result_ok,
28465 impl Clone for CResult_RevocationKeyDecodeErrorZ {
28466 fn clone(&self) -> Self {
28467 if self.result_ok {
28468 Self { result_ok: true, contents: CResult_RevocationKeyDecodeErrorZPtr {
28469 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationKey>::clone(unsafe { &*self.contents.result })))
28472 Self { result_ok: false, contents: CResult_RevocationKeyDecodeErrorZPtr {
28473 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
28479 /// Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig`
28480 /// but with all dynamically-allocated buffers duplicated in new buffers.
28481 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_clone(orig: &CResult_RevocationKeyDecodeErrorZ) -> CResult_RevocationKeyDecodeErrorZ { Clone::clone(&orig) }
28483 /// The contents of CResult_LockedChannelMonitorNoneZ
28484 pub union CResult_LockedChannelMonitorNoneZPtr {
28485 /// A pointer to the contents in the success state.
28486 /// Reading from this pointer when `result_ok` is not set is undefined.
28487 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
28488 /// Note that this value is always NULL, as there are no contents in the Err variant
28489 pub err: *mut core::ffi::c_void,
28492 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
28493 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
28494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28495 pub struct CResult_LockedChannelMonitorNoneZ {
28496 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
28497 /// `err` or `result` depending on the state of `result_ok`.
28498 pub contents: CResult_LockedChannelMonitorNoneZPtr,
28499 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
28500 pub result_ok: bool,
28503 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
28504 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
28505 CResult_LockedChannelMonitorNoneZ {
28506 contents: CResult_LockedChannelMonitorNoneZPtr {
28507 result: Box::into_raw(Box::new(o)),
28513 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
28514 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
28515 CResult_LockedChannelMonitorNoneZ {
28516 contents: CResult_LockedChannelMonitorNoneZPtr {
28517 err: core::ptr::null_mut(),
28522 /// Checks if the given object is currently in the success state
28524 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
28528 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
28529 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
28530 impl Drop for CResult_LockedChannelMonitorNoneZ {
28531 fn drop(&mut self) {
28532 if self.result_ok {
28533 if unsafe { !(self.contents.result as *mut ()).is_null() } {
28534 let _ = unsafe { Box::from_raw(self.contents.result) };
28540 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
28541 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
28542 let contents = if o.result_ok {
28543 let result = unsafe { o.contents.result };
28544 unsafe { o.contents.result = core::ptr::null_mut() };
28545 CResult_LockedChannelMonitorNoneZPtr { result }
28547 let _ = unsafe { Box::from_raw(o.contents.err) };
28548 o.contents.err = core::ptr::null_mut();
28549 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
28553 result_ok: o.result_ok,
28558 /// A tuple of 2 elements. See the individual fields for the types contained.
28559 pub struct C2Tuple_OutPointChannelIdZ {
28560 /// The element at position 0
28561 pub a: crate::lightning::chain::transaction::OutPoint,
28562 /// The element at position 1
28563 pub b: crate::lightning::ln::types::ChannelId,
28565 impl From<(crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)> for C2Tuple_OutPointChannelIdZ {
28566 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)) -> Self {
28573 impl C2Tuple_OutPointChannelIdZ {
28574 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId) {
28578 impl Clone for C2Tuple_OutPointChannelIdZ {
28579 fn clone(&self) -> Self {
28581 a: Clone::clone(&self.a),
28582 b: Clone::clone(&self.b),
28587 /// Creates a new tuple which has the same data as `orig`
28588 /// but with all dynamically-allocated buffers duplicated in new buffers.
28589 pub extern "C" fn C2Tuple_OutPointChannelIdZ_clone(orig: &C2Tuple_OutPointChannelIdZ) -> C2Tuple_OutPointChannelIdZ { Clone::clone(&orig) }
28590 /// Creates a new C2Tuple_OutPointChannelIdZ from the contained elements.
28592 pub extern "C" fn C2Tuple_OutPointChannelIdZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId) -> C2Tuple_OutPointChannelIdZ {
28593 C2Tuple_OutPointChannelIdZ { a, b, }
28597 /// Frees any resources used by the C2Tuple_OutPointChannelIdZ.
28598 pub extern "C" fn C2Tuple_OutPointChannelIdZ_free(_res: C2Tuple_OutPointChannelIdZ) { }
28600 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointChannelIdZs of arbitrary size.
28601 /// This corresponds to std::vector in C++
28602 pub struct CVec_C2Tuple_OutPointChannelIdZZ {
28603 /// The elements in the array.
28604 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28605 pub data: *mut crate::c_types::derived::C2Tuple_OutPointChannelIdZ,
28606 /// The number of elements pointed to by `data`.
28609 impl CVec_C2Tuple_OutPointChannelIdZZ {
28610 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ> {
28611 if self.datalen == 0 { return Vec::new(); }
28612 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28613 self.data = core::ptr::null_mut();
28617 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointChannelIdZ] {
28618 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28621 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>> for CVec_C2Tuple_OutPointChannelIdZZ {
28622 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>) -> Self {
28623 let datalen = v.len();
28624 let data = Box::into_raw(v.into_boxed_slice());
28625 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28629 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28630 pub extern "C" fn CVec_C2Tuple_OutPointChannelIdZZ_free(_res: CVec_C2Tuple_OutPointChannelIdZZ) { }
28631 impl Drop for CVec_C2Tuple_OutPointChannelIdZZ {
28632 fn drop(&mut self) {
28633 if self.datalen == 0 { return; }
28634 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28637 impl Clone for CVec_C2Tuple_OutPointChannelIdZZ {
28638 fn clone(&self) -> Self {
28639 let mut res = Vec::new();
28640 if self.datalen == 0 { return Self::from(res); }
28641 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
28646 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
28647 /// This corresponds to std::vector in C++
28648 pub struct CVec_MonitorUpdateIdZ {
28649 /// The elements in the array.
28650 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28651 pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
28652 /// The number of elements pointed to by `data`.
28655 impl CVec_MonitorUpdateIdZ {
28656 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
28657 if self.datalen == 0 { return Vec::new(); }
28658 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28659 self.data = core::ptr::null_mut();
28663 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
28664 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28667 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
28668 fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
28669 let datalen = v.len();
28670 let data = Box::into_raw(v.into_boxed_slice());
28671 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28675 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28676 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
28677 impl Drop for CVec_MonitorUpdateIdZ {
28678 fn drop(&mut self) {
28679 if self.datalen == 0 { return; }
28680 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28683 impl Clone for CVec_MonitorUpdateIdZ {
28684 fn clone(&self) -> Self {
28685 let mut res = Vec::new();
28686 if self.datalen == 0 { return Self::from(res); }
28687 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
28692 /// A tuple of 2 elements. See the individual fields for the types contained.
28693 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28694 /// The element at position 0
28695 pub a: crate::lightning::chain::transaction::OutPoint,
28696 /// The element at position 1
28697 pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
28699 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28700 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
28707 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28708 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
28712 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28713 fn clone(&self) -> Self {
28715 a: Clone::clone(&self.a),
28716 b: Clone::clone(&self.b),
28721 /// Creates a new tuple which has the same data as `orig`
28722 /// but with all dynamically-allocated buffers duplicated in new buffers.
28723 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
28724 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
28726 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28727 C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
28731 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
28732 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
28734 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
28735 /// This corresponds to std::vector in C++
28736 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28737 /// The elements in the array.
28738 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28739 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
28740 /// The number of elements pointed to by `data`.
28743 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28744 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
28745 if self.datalen == 0 { return Vec::new(); }
28746 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28747 self.data = core::ptr::null_mut();
28751 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
28752 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28755 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28756 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
28757 let datalen = v.len();
28758 let data = Box::into_raw(v.into_boxed_slice());
28759 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28763 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28764 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
28765 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28766 fn drop(&mut self) {
28767 if self.datalen == 0 { return; }
28768 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28771 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28772 fn clone(&self) -> Self {
28773 let mut res = Vec::new();
28774 if self.datalen == 0 { return Self::from(res); }
28775 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });