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::channelmanager::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::channelmanager::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::channelmanager::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::channelmanager::ChannelDetails] {
3834 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3837 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3838 fn from(v: Vec<crate::lightning::ln::channelmanager::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) }
9670 /// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
9671 pub enum COption_ChannelShutdownStateZ {
9672 /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
9673 Some(crate::lightning::ln::channelmanager::ChannelShutdownState),
9674 /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
9677 impl COption_ChannelShutdownStateZ {
9678 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9679 if let Self::None = self { false } else { true }
9681 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9684 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channelmanager::ChannelShutdownState {
9685 if let Self::Some(v) = self { v } else { unreachable!() }
9689 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
9690 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
9691 COption_ChannelShutdownStateZ::Some(o)
9694 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
9695 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
9696 COption_ChannelShutdownStateZ::None
9699 /// Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
9700 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
9702 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
9703 /// but with all dynamically-allocated buffers duplicated in new buffers.
9704 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
9706 /// The contents of CResult_ChannelIdAPIErrorZ
9707 pub union CResult_ChannelIdAPIErrorZPtr {
9708 /// A pointer to the contents in the success state.
9709 /// Reading from this pointer when `result_ok` is not set is undefined.
9710 pub result: *mut crate::lightning::ln::types::ChannelId,
9711 /// A pointer to the contents in the error state.
9712 /// Reading from this pointer when `result_ok` is set is undefined.
9713 pub err: *mut crate::lightning::util::errors::APIError,
9716 /// A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation,
9717 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::util::errors::APIError on failure.
9718 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9719 pub struct CResult_ChannelIdAPIErrorZ {
9720 /// The contents of this CResult_ChannelIdAPIErrorZ, accessible via either
9721 /// `err` or `result` depending on the state of `result_ok`.
9722 pub contents: CResult_ChannelIdAPIErrorZPtr,
9723 /// Whether this CResult_ChannelIdAPIErrorZ represents a success state.
9724 pub result_ok: bool,
9727 /// Creates a new CResult_ChannelIdAPIErrorZ in the success state.
9728 pub extern "C" fn CResult_ChannelIdAPIErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdAPIErrorZ {
9729 CResult_ChannelIdAPIErrorZ {
9730 contents: CResult_ChannelIdAPIErrorZPtr {
9731 result: Box::into_raw(Box::new(o)),
9737 /// Creates a new CResult_ChannelIdAPIErrorZ in the error state.
9738 pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ChannelIdAPIErrorZ {
9739 CResult_ChannelIdAPIErrorZ {
9740 contents: CResult_ChannelIdAPIErrorZPtr {
9741 err: Box::into_raw(Box::new(e)),
9746 /// Checks if the given object is currently in the success state
9748 pub extern "C" fn CResult_ChannelIdAPIErrorZ_is_ok(o: &CResult_ChannelIdAPIErrorZ) -> bool {
9752 /// Frees any resources used by the CResult_ChannelIdAPIErrorZ.
9753 pub extern "C" fn CResult_ChannelIdAPIErrorZ_free(_res: CResult_ChannelIdAPIErrorZ) { }
9754 impl Drop for CResult_ChannelIdAPIErrorZ {
9755 fn drop(&mut self) {
9757 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9758 let _ = unsafe { Box::from_raw(self.contents.result) };
9761 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9762 let _ = unsafe { Box::from_raw(self.contents.err) };
9767 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>> for CResult_ChannelIdAPIErrorZ {
9768 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>) -> Self {
9769 let contents = if o.result_ok {
9770 let result = unsafe { o.contents.result };
9771 unsafe { o.contents.result = core::ptr::null_mut() };
9772 CResult_ChannelIdAPIErrorZPtr { result }
9774 let err = unsafe { o.contents.err };
9775 unsafe { o.contents.err = core::ptr::null_mut(); }
9776 CResult_ChannelIdAPIErrorZPtr { err }
9780 result_ok: o.result_ok,
9784 impl Clone for CResult_ChannelIdAPIErrorZ {
9785 fn clone(&self) -> Self {
9787 Self { result_ok: true, contents: CResult_ChannelIdAPIErrorZPtr {
9788 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
9791 Self { result_ok: false, contents: CResult_ChannelIdAPIErrorZPtr {
9792 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9798 /// Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig`
9799 /// but with all dynamically-allocated buffers duplicated in new buffers.
9800 pub extern "C" fn CResult_ChannelIdAPIErrorZ_clone(orig: &CResult_ChannelIdAPIErrorZ) -> CResult_ChannelIdAPIErrorZ { Clone::clone(&orig) }
9802 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
9803 /// This corresponds to std::vector in C++
9804 pub struct CVec_RecentPaymentDetailsZ {
9805 /// The elements in the array.
9806 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9807 pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
9808 /// The number of elements pointed to by `data`.
9811 impl CVec_RecentPaymentDetailsZ {
9812 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
9813 if self.datalen == 0 { return Vec::new(); }
9814 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9815 self.data = core::ptr::null_mut();
9819 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
9820 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9823 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
9824 fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
9825 let datalen = v.len();
9826 let data = Box::into_raw(v.into_boxed_slice());
9827 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9831 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9832 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
9833 impl Drop for CVec_RecentPaymentDetailsZ {
9834 fn drop(&mut self) {
9835 if self.datalen == 0 { return; }
9836 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9840 /// The contents of CResult_NonePaymentSendFailureZ
9841 pub union CResult_NonePaymentSendFailureZPtr {
9842 /// Note that this value is always NULL, as there are no contents in the OK variant
9843 pub result: *mut core::ffi::c_void,
9844 /// A pointer to the contents in the error state.
9845 /// Reading from this pointer when `result_ok` is set is undefined.
9846 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9849 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
9850 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9851 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9852 pub struct CResult_NonePaymentSendFailureZ {
9853 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
9854 /// `err` or `result` depending on the state of `result_ok`.
9855 pub contents: CResult_NonePaymentSendFailureZPtr,
9856 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
9857 pub result_ok: bool,
9860 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
9861 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
9862 CResult_NonePaymentSendFailureZ {
9863 contents: CResult_NonePaymentSendFailureZPtr {
9864 result: core::ptr::null_mut(),
9870 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
9871 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
9872 CResult_NonePaymentSendFailureZ {
9873 contents: CResult_NonePaymentSendFailureZPtr {
9874 err: Box::into_raw(Box::new(e)),
9879 /// Checks if the given object is currently in the success state
9881 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
9885 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
9886 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
9887 impl Drop for CResult_NonePaymentSendFailureZ {
9888 fn drop(&mut self) {
9891 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9892 let _ = unsafe { Box::from_raw(self.contents.err) };
9897 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
9898 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9899 let contents = if o.result_ok {
9900 let _ = unsafe { Box::from_raw(o.contents.result) };
9901 o.contents.result = core::ptr::null_mut();
9902 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
9904 let err = unsafe { o.contents.err };
9905 unsafe { o.contents.err = core::ptr::null_mut(); }
9906 CResult_NonePaymentSendFailureZPtr { err }
9910 result_ok: o.result_ok,
9914 impl Clone for CResult_NonePaymentSendFailureZ {
9915 fn clone(&self) -> Self {
9917 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
9918 result: core::ptr::null_mut()
9921 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
9922 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9928 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9929 /// but with all dynamically-allocated buffers duplicated in new buffers.
9930 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
9932 /// The contents of CResult_NoneRetryableSendFailureZ
9933 pub union CResult_NoneRetryableSendFailureZPtr {
9934 /// Note that this value is always NULL, as there are no contents in the OK variant
9935 pub result: *mut core::ffi::c_void,
9936 /// A pointer to the contents in the error state.
9937 /// Reading from this pointer when `result_ok` is set is undefined.
9938 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9941 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
9942 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9943 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9944 pub struct CResult_NoneRetryableSendFailureZ {
9945 /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
9946 /// `err` or `result` depending on the state of `result_ok`.
9947 pub contents: CResult_NoneRetryableSendFailureZPtr,
9948 /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
9949 pub result_ok: bool,
9952 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
9953 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
9954 CResult_NoneRetryableSendFailureZ {
9955 contents: CResult_NoneRetryableSendFailureZPtr {
9956 result: core::ptr::null_mut(),
9962 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
9963 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
9964 CResult_NoneRetryableSendFailureZ {
9965 contents: CResult_NoneRetryableSendFailureZPtr {
9966 err: Box::into_raw(Box::new(e)),
9971 /// Checks if the given object is currently in the success state
9973 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
9977 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
9978 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
9979 impl Drop for CResult_NoneRetryableSendFailureZ {
9980 fn drop(&mut self) {
9983 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9984 let _ = unsafe { Box::from_raw(self.contents.err) };
9989 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
9990 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9991 let contents = if o.result_ok {
9992 let _ = unsafe { Box::from_raw(o.contents.result) };
9993 o.contents.result = core::ptr::null_mut();
9994 CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
9996 let err = unsafe { o.contents.err };
9997 unsafe { o.contents.err = core::ptr::null_mut(); }
9998 CResult_NoneRetryableSendFailureZPtr { err }
10002 result_ok: o.result_ok,
10006 impl Clone for CResult_NoneRetryableSendFailureZ {
10007 fn clone(&self) -> Self {
10008 if self.result_ok {
10009 Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
10010 result: core::ptr::null_mut()
10013 Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
10014 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
10020 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
10021 /// but with all dynamically-allocated buffers duplicated in new buffers.
10022 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
10024 /// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ
10025 pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10026 /// A pointer to the contents in the success state.
10027 /// Reading from this pointer when `result_ok` is not set is undefined.
10028 pub result: *mut crate::c_types::ThirtyTwoBytes,
10029 /// A pointer to the contents in the error state.
10030 /// Reading from this pointer when `result_ok` is set is undefined.
10031 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
10034 /// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation,
10035 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
10036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10037 pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ {
10038 /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either
10039 /// `err` or `result` depending on the state of `result_ok`.
10040 pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr,
10041 /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state.
10042 pub result_ok: bool,
10045 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state.
10046 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
10047 CResult_ThirtyTwoBytesPaymentSendFailureZ {
10048 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10049 result: Box::into_raw(Box::new(o)),
10055 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state.
10056 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
10057 CResult_ThirtyTwoBytesPaymentSendFailureZ {
10058 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10059 err: Box::into_raw(Box::new(e)),
10064 /// Checks if the given object is currently in the success state
10066 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool {
10070 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ.
10071 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { }
10072 impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10073 fn drop(&mut self) {
10074 if self.result_ok {
10075 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10076 let _ = unsafe { Box::from_raw(self.contents.result) };
10079 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10080 let _ = unsafe { Box::from_raw(self.contents.err) };
10085 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10086 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
10087 let contents = if o.result_ok {
10088 let result = unsafe { o.contents.result };
10089 unsafe { o.contents.result = core::ptr::null_mut() };
10090 CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result }
10092 let err = unsafe { o.contents.err };
10093 unsafe { o.contents.err = core::ptr::null_mut(); }
10094 CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err }
10098 result_ok: o.result_ok,
10102 impl Clone for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10103 fn clone(&self) -> Self {
10104 if self.result_ok {
10105 Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10106 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10109 Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10110 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10116 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig`
10117 /// but with all dynamically-allocated buffers duplicated in new buffers.
10118 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) }
10120 /// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ
10121 pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10122 /// A pointer to the contents in the success state.
10123 /// Reading from this pointer when `result_ok` is not set is undefined.
10124 pub result: *mut crate::c_types::ThirtyTwoBytes,
10125 /// A pointer to the contents in the error state.
10126 /// Reading from this pointer when `result_ok` is set is undefined.
10127 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
10130 /// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation,
10131 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
10132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10133 pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ {
10134 /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either
10135 /// `err` or `result` depending on the state of `result_ok`.
10136 pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr,
10137 /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state.
10138 pub result_ok: bool,
10141 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
10142 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
10143 CResult_ThirtyTwoBytesRetryableSendFailureZ {
10144 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10145 result: Box::into_raw(Box::new(o)),
10151 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
10152 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
10153 CResult_ThirtyTwoBytesRetryableSendFailureZ {
10154 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10155 err: Box::into_raw(Box::new(e)),
10160 /// Checks if the given object is currently in the success state
10162 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool {
10166 /// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ.
10167 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { }
10168 impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10169 fn drop(&mut self) {
10170 if self.result_ok {
10171 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10172 let _ = unsafe { Box::from_raw(self.contents.result) };
10175 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10176 let _ = unsafe { Box::from_raw(self.contents.err) };
10181 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10182 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
10183 let contents = if o.result_ok {
10184 let result = unsafe { o.contents.result };
10185 unsafe { o.contents.result = core::ptr::null_mut() };
10186 CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result }
10188 let err = unsafe { o.contents.err };
10189 unsafe { o.contents.err = core::ptr::null_mut(); }
10190 CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err }
10194 result_ok: o.result_ok,
10198 impl Clone for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10199 fn clone(&self) -> Self {
10200 if self.result_ok {
10201 Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10202 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10205 Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10206 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
10212 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
10213 /// but with all dynamically-allocated buffers duplicated in new buffers.
10214 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) }
10216 /// A tuple of 2 elements. See the individual fields for the types contained.
10217 pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10218 /// The element at position 0
10219 pub a: crate::c_types::ThirtyTwoBytes,
10220 /// The element at position 1
10221 pub b: crate::c_types::ThirtyTwoBytes,
10223 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10224 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
10231 impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10232 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
10236 impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10237 fn clone(&self) -> Self {
10239 a: Clone::clone(&self.a),
10240 b: Clone::clone(&self.b),
10245 /// Creates a new tuple which has the same data as `orig`
10246 /// but with all dynamically-allocated buffers duplicated in new buffers.
10247 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) }
10248 /// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements.
10250 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10251 C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, }
10255 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ.
10256 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { }
10258 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ
10259 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10260 /// A pointer to the contents in the success state.
10261 /// Reading from this pointer when `result_ok` is not set is undefined.
10262 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10263 /// A pointer to the contents in the error state.
10264 /// Reading from this pointer when `result_ok` is set is undefined.
10265 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
10268 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation,
10269 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
10270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10271 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10272 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either
10273 /// `err` or `result` depending on the state of `result_ok`.
10274 pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr,
10275 /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state.
10276 pub result_ok: bool,
10279 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state.
10280 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10281 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10282 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10283 result: Box::into_raw(Box::new(o)),
10289 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state.
10290 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10291 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10292 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10293 err: Box::into_raw(Box::new(e)),
10298 /// Checks if the given object is currently in the success state
10300 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool {
10304 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.
10305 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { }
10306 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10307 fn drop(&mut self) {
10308 if self.result_ok {
10309 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10310 let _ = unsafe { Box::from_raw(self.contents.result) };
10313 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10314 let _ = unsafe { Box::from_raw(self.contents.err) };
10319 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10320 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
10321 let contents = if o.result_ok {
10322 let result = unsafe { o.contents.result };
10323 unsafe { o.contents.result = core::ptr::null_mut() };
10324 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result }
10326 let err = unsafe { o.contents.err };
10327 unsafe { o.contents.err = core::ptr::null_mut(); }
10328 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err }
10332 result_ok: o.result_ok,
10336 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10337 fn clone(&self) -> Self {
10338 if self.result_ok {
10339 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10340 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10343 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10344 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10350 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig`
10351 /// but with all dynamically-allocated buffers duplicated in new buffers.
10352 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) }
10354 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size.
10355 /// This corresponds to std::vector in C++
10356 pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10357 /// The elements in the array.
10358 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10359 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10360 /// The number of elements pointed to by `data`.
10363 impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10364 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ> {
10365 if self.datalen == 0 { return Vec::new(); }
10366 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10367 self.data = core::ptr::null_mut();
10371 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] {
10372 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10375 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10376 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>) -> Self {
10377 let datalen = v.len();
10378 let data = Box::into_raw(v.into_boxed_slice());
10379 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10383 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10384 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { }
10385 impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10386 fn drop(&mut self) {
10387 if self.datalen == 0 { return; }
10388 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10391 impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10392 fn clone(&self) -> Self {
10393 let mut res = Vec::new();
10394 if self.datalen == 0 { return Self::from(res); }
10395 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10400 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ
10401 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10402 /// A pointer to the contents in the success state.
10403 /// Reading from this pointer when `result_ok` is not set is undefined.
10404 pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
10405 /// A pointer to the contents in the error state.
10406 /// Reading from this pointer when `result_ok` is set is undefined.
10407 pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure,
10410 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation,
10411 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure.
10412 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10413 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10414 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either
10415 /// `err` or `result` depending on the state of `result_ok`.
10416 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr,
10417 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state.
10418 pub result_ok: bool,
10421 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state.
10422 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10423 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10424 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10425 result: Box::into_raw(Box::new(o)),
10431 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state.
10432 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10433 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10434 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10435 err: Box::into_raw(Box::new(e)),
10440 /// Checks if the given object is currently in the success state
10442 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool {
10446 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.
10447 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { }
10448 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10449 fn drop(&mut self) {
10450 if self.result_ok {
10451 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10452 let _ = unsafe { Box::from_raw(self.contents.result) };
10455 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10456 let _ = unsafe { Box::from_raw(self.contents.err) };
10461 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10462 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>) -> Self {
10463 let contents = if o.result_ok {
10464 let result = unsafe { o.contents.result };
10465 unsafe { o.contents.result = core::ptr::null_mut() };
10466 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result }
10468 let err = unsafe { o.contents.err };
10469 unsafe { o.contents.err = core::ptr::null_mut(); }
10470 CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err }
10474 result_ok: o.result_ok,
10478 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10479 fn clone(&self) -> Self {
10480 if self.result_ok {
10481 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10482 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
10485 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10486 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::ProbeSendFailure>::clone(unsafe { &*self.contents.err })))
10492 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig`
10493 /// but with all dynamically-allocated buffers duplicated in new buffers.
10494 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) }
10496 /// A tuple of 2 elements. See the individual fields for the types contained.
10497 pub struct C2Tuple_ChannelIdPublicKeyZ {
10498 /// The element at position 0
10499 pub a: crate::lightning::ln::types::ChannelId,
10500 /// The element at position 1
10501 pub b: crate::c_types::PublicKey,
10503 impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)> for C2Tuple_ChannelIdPublicKeyZ {
10504 fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)) -> Self {
10511 impl C2Tuple_ChannelIdPublicKeyZ {
10512 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey) {
10516 impl Clone for C2Tuple_ChannelIdPublicKeyZ {
10517 fn clone(&self) -> Self {
10519 a: Clone::clone(&self.a),
10520 b: Clone::clone(&self.b),
10525 /// Creates a new tuple which has the same data as `orig`
10526 /// but with all dynamically-allocated buffers duplicated in new buffers.
10527 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_clone(orig: &C2Tuple_ChannelIdPublicKeyZ) -> C2Tuple_ChannelIdPublicKeyZ { Clone::clone(&orig) }
10528 /// Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements.
10530 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::PublicKey) -> C2Tuple_ChannelIdPublicKeyZ {
10531 C2Tuple_ChannelIdPublicKeyZ { a, b, }
10535 /// Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ.
10536 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_free(_res: C2Tuple_ChannelIdPublicKeyZ) { }
10538 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size.
10539 /// This corresponds to std::vector in C++
10540 pub struct CVec_C2Tuple_ChannelIdPublicKeyZZ {
10541 /// The elements in the array.
10542 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10543 pub data: *mut crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ,
10544 /// The number of elements pointed to by `data`.
10547 impl CVec_C2Tuple_ChannelIdPublicKeyZZ {
10548 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ> {
10549 if self.datalen == 0 { return Vec::new(); }
10550 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10551 self.data = core::ptr::null_mut();
10555 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ] {
10556 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10559 impl From<Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>> for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10560 fn from(v: Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>) -> Self {
10561 let datalen = v.len();
10562 let data = Box::into_raw(v.into_boxed_slice());
10563 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10567 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10568 pub extern "C" fn CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res: CVec_C2Tuple_ChannelIdPublicKeyZZ) { }
10569 impl Drop for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10570 fn drop(&mut self) {
10571 if self.datalen == 0 { return; }
10572 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10575 impl Clone for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10576 fn clone(&self) -> Self {
10577 let mut res = Vec::new();
10578 if self.datalen == 0 { return Self::from(res); }
10579 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10584 /// A dynamically-allocated array of crate::lightning::ln::types::ChannelIds of arbitrary size.
10585 /// This corresponds to std::vector in C++
10586 pub struct CVec_ChannelIdZ {
10587 /// The elements in the array.
10588 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10589 pub data: *mut crate::lightning::ln::types::ChannelId,
10590 /// The number of elements pointed to by `data`.
10593 impl CVec_ChannelIdZ {
10594 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::types::ChannelId> {
10595 if self.datalen == 0 { return Vec::new(); }
10596 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10597 self.data = core::ptr::null_mut();
10601 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::types::ChannelId] {
10602 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10605 impl From<Vec<crate::lightning::ln::types::ChannelId>> for CVec_ChannelIdZ {
10606 fn from(v: Vec<crate::lightning::ln::types::ChannelId>) -> Self {
10607 let datalen = v.len();
10608 let data = Box::into_raw(v.into_boxed_slice());
10609 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10613 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10614 pub extern "C" fn CVec_ChannelIdZ_free(_res: CVec_ChannelIdZ) { }
10615 impl Drop for CVec_ChannelIdZ {
10616 fn drop(&mut self) {
10617 if self.datalen == 0 { return; }
10618 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10621 impl Clone for CVec_ChannelIdZ {
10622 fn clone(&self) -> Self {
10623 let mut res = Vec::new();
10624 if self.datalen == 0 { return Self::from(res); }
10625 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10630 /// The contents of CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ
10631 pub union CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10632 /// A pointer to the contents in the success state.
10633 /// Reading from this pointer when `result_ok` is not set is undefined.
10634 pub result: *mut crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder,
10635 /// A pointer to the contents in the error state.
10636 /// Reading from this pointer when `result_ok` is set is undefined.
10637 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
10640 /// A CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
10641 /// containing a crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
10642 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10643 pub struct CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10644 /// The contents of this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either
10645 /// `err` or `result` depending on the state of `result_ok`.
10646 pub contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr,
10647 /// Whether this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state.
10648 pub result_ok: bool,
10651 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state.
10652 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10653 CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10654 contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10655 result: Box::into_raw(Box::new(o)),
10661 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state.
10662 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10663 CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10664 contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10665 err: Box::into_raw(Box::new(e)),
10670 /// Checks if the given object is currently in the success state
10672 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> bool {
10676 /// Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ.
10677 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) { }
10678 impl Drop for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10679 fn drop(&mut self) {
10680 if self.result_ok {
10681 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10682 let _ = unsafe { Box::from_raw(self.contents.result) };
10685 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10686 let _ = unsafe { Box::from_raw(self.contents.err) };
10691 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10692 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
10693 let contents = if o.result_ok {
10694 let result = unsafe { o.contents.result };
10695 unsafe { o.contents.result = core::ptr::null_mut() };
10696 CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { result }
10698 let err = unsafe { o.contents.err };
10699 unsafe { o.contents.err = core::ptr::null_mut(); }
10700 CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { err }
10704 result_ok: o.result_ok,
10708 impl Clone for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10709 fn clone(&self) -> Self {
10710 if self.result_ok {
10711 Self { result_ok: true, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10712 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder>::clone(unsafe { &*self.contents.result })))
10715 Self { result_ok: false, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10716 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
10722 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig`
10723 /// but with all dynamically-allocated buffers duplicated in new buffers.
10724 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { Clone::clone(&orig) }
10727 /// An enum which can either contain a crate::c_types::Str or not
10728 pub enum COption_StrZ {
10729 /// When we're in this state, this COption_StrZ contains a crate::c_types::Str
10730 Some(crate::c_types::Str),
10731 /// When we're in this state, this COption_StrZ contains nothing
10734 impl COption_StrZ {
10735 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10736 if let Self::None = self { false } else { true }
10738 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10741 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Str {
10742 if let Self::Some(v) = self { v } else { unreachable!() }
10746 /// Constructs a new COption_StrZ containing a crate::c_types::Str
10747 pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ {
10748 COption_StrZ::Some(o)
10751 /// Constructs a new COption_StrZ containing nothing
10752 pub extern "C" fn COption_StrZ_none() -> COption_StrZ {
10756 /// Frees any resources associated with the crate::c_types::Str, if we are in the Some state
10757 pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { }
10759 /// Creates a new COption_StrZ which has the same data as `orig`
10760 /// but with all dynamically-allocated buffers duplicated in new buffers.
10761 pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) }
10763 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
10764 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10765 /// A pointer to the contents in the success state.
10766 /// Reading from this pointer when `result_ok` is not set is undefined.
10767 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10768 /// Note that this value is always NULL, as there are no contents in the Err variant
10769 pub err: *mut core::ffi::c_void,
10772 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
10773 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
10774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10775 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10776 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
10777 /// `err` or `result` depending on the state of `result_ok`.
10778 pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
10779 /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
10780 pub result_ok: bool,
10783 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
10784 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10785 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10786 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10787 result: Box::into_raw(Box::new(o)),
10793 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
10794 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10795 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10796 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10797 err: core::ptr::null_mut(),
10802 /// Checks if the given object is currently in the success state
10804 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
10808 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
10809 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
10810 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10811 fn drop(&mut self) {
10812 if self.result_ok {
10813 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10814 let _ = unsafe { Box::from_raw(self.contents.result) };
10820 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10821 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
10822 let contents = if o.result_ok {
10823 let result = unsafe { o.contents.result };
10824 unsafe { o.contents.result = core::ptr::null_mut() };
10825 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
10827 let _ = unsafe { Box::from_raw(o.contents.err) };
10828 o.contents.err = core::ptr::null_mut();
10829 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
10833 result_ok: o.result_ok,
10837 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10838 fn clone(&self) -> Self {
10839 if self.result_ok {
10840 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10841 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10844 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10845 err: core::ptr::null_mut()
10851 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
10852 /// but with all dynamically-allocated buffers duplicated in new buffers.
10853 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
10855 /// The contents of CResult_ThirtyTwoBytesAPIErrorZ
10856 pub union CResult_ThirtyTwoBytesAPIErrorZPtr {
10857 /// A pointer to the contents in the success state.
10858 /// Reading from this pointer when `result_ok` is not set is undefined.
10859 pub result: *mut crate::c_types::ThirtyTwoBytes,
10860 /// A pointer to the contents in the error state.
10861 /// Reading from this pointer when `result_ok` is set is undefined.
10862 pub err: *mut crate::lightning::util::errors::APIError,
10865 /// A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation,
10866 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
10867 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10868 pub struct CResult_ThirtyTwoBytesAPIErrorZ {
10869 /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either
10870 /// `err` or `result` depending on the state of `result_ok`.
10871 pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr,
10872 /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state.
10873 pub result_ok: bool,
10876 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state.
10877 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesAPIErrorZ {
10878 CResult_ThirtyTwoBytesAPIErrorZ {
10879 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10880 result: Box::into_raw(Box::new(o)),
10886 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state.
10887 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ThirtyTwoBytesAPIErrorZ {
10888 CResult_ThirtyTwoBytesAPIErrorZ {
10889 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10890 err: Box::into_raw(Box::new(e)),
10895 /// Checks if the given object is currently in the success state
10897 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool {
10901 /// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ.
10902 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { }
10903 impl Drop for CResult_ThirtyTwoBytesAPIErrorZ {
10904 fn drop(&mut self) {
10905 if self.result_ok {
10906 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10907 let _ = unsafe { Box::from_raw(self.contents.result) };
10910 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10911 let _ = unsafe { Box::from_raw(self.contents.err) };
10916 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_ThirtyTwoBytesAPIErrorZ {
10917 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
10918 let contents = if o.result_ok {
10919 let result = unsafe { o.contents.result };
10920 unsafe { o.contents.result = core::ptr::null_mut() };
10921 CResult_ThirtyTwoBytesAPIErrorZPtr { result }
10923 let err = unsafe { o.contents.err };
10924 unsafe { o.contents.err = core::ptr::null_mut(); }
10925 CResult_ThirtyTwoBytesAPIErrorZPtr { err }
10929 result_ok: o.result_ok,
10933 impl Clone for CResult_ThirtyTwoBytesAPIErrorZ {
10934 fn clone(&self) -> Self {
10935 if self.result_ok {
10936 Self { result_ok: true, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10937 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10940 Self { result_ok: false, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10941 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
10947 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig`
10948 /// but with all dynamically-allocated buffers duplicated in new buffers.
10949 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) }
10952 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
10953 pub enum COption_OffersMessageZ {
10954 /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
10955 Some(crate::lightning::onion_message::offers::OffersMessage),
10956 /// When we're in this state, this COption_OffersMessageZ contains nothing
10959 impl COption_OffersMessageZ {
10960 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10961 if let Self::None = self { false } else { true }
10963 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10966 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
10967 if let Self::Some(v) = self { v } else { unreachable!() }
10971 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
10972 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
10973 COption_OffersMessageZ::Some(o)
10976 /// Constructs a new COption_OffersMessageZ containing nothing
10977 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
10978 COption_OffersMessageZ::None
10981 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
10982 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
10984 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
10985 /// but with all dynamically-allocated buffers duplicated in new buffers.
10986 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
10988 /// A tuple of 3 elements. See the individual fields for the types contained.
10989 pub struct C3Tuple_OffersMessageDestinationBlindedPathZ {
10990 /// The element at position 0
10991 pub a: crate::lightning::onion_message::offers::OffersMessage,
10992 /// The element at position 1
10993 pub b: crate::lightning::onion_message::messenger::Destination,
10994 /// The element at position 2
10995 pub c: crate::lightning::blinded_path::BlindedPath,
10997 impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OffersMessageDestinationBlindedPathZ {
10998 fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
11006 impl C3Tuple_OffersMessageDestinationBlindedPathZ {
11007 #[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) {
11008 (self.a, self.b, self.c)
11011 impl Clone for C3Tuple_OffersMessageDestinationBlindedPathZ {
11012 fn clone(&self) -> Self {
11014 a: Clone::clone(&self.a),
11015 b: Clone::clone(&self.b),
11016 c: Clone::clone(&self.c),
11021 /// Creates a new tuple which has the same data as `orig`
11022 /// but with all dynamically-allocated buffers duplicated in new buffers.
11023 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig: &C3Tuple_OffersMessageDestinationBlindedPathZ) -> C3Tuple_OffersMessageDestinationBlindedPathZ { Clone::clone(&orig) }
11024 /// Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
11026 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 {
11027 C3Tuple_OffersMessageDestinationBlindedPathZ { a, b, c, }
11031 /// Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
11032 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res: C3Tuple_OffersMessageDestinationBlindedPathZ) { }
11034 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
11035 /// This corresponds to std::vector in C++
11036 pub struct CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11037 /// The elements in the array.
11038 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11039 pub data: *mut crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ,
11040 /// The number of elements pointed to by `data`.
11043 impl CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11044 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ> {
11045 if self.datalen == 0 { return Vec::new(); }
11046 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11047 self.data = core::ptr::null_mut();
11051 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ] {
11052 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11055 impl From<Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>> for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11056 fn from(v: Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>) -> Self {
11057 let datalen = v.len();
11058 let data = Box::into_raw(v.into_boxed_slice());
11059 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11063 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11064 pub extern "C" fn CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ) { }
11065 impl Drop for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11066 fn drop(&mut self) {
11067 if self.datalen == 0 { return; }
11068 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11071 impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11072 fn clone(&self) -> Self {
11073 let mut res = Vec::new();
11074 if self.datalen == 0 { return Self::from(res); }
11075 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11080 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
11081 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
11082 /// A pointer to the contents in the success state.
11083 /// Reading from this pointer when `result_ok` is not set is undefined.
11084 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
11085 /// A pointer to the contents in the error state.
11086 /// Reading from this pointer when `result_ok` is set is undefined.
11087 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11090 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
11091 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11092 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11093 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
11094 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
11095 /// `err` or `result` depending on the state of `result_ok`.
11096 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
11097 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
11098 pub result_ok: bool,
11101 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
11102 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
11103 CResult_CounterpartyForwardingInfoDecodeErrorZ {
11104 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
11105 result: Box::into_raw(Box::new(o)),
11111 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
11112 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
11113 CResult_CounterpartyForwardingInfoDecodeErrorZ {
11114 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
11115 err: Box::into_raw(Box::new(e)),
11120 /// Checks if the given object is currently in the success state
11122 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
11126 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
11127 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
11128 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
11129 fn drop(&mut self) {
11130 if self.result_ok {
11131 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11132 let _ = unsafe { Box::from_raw(self.contents.result) };
11135 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11136 let _ = unsafe { Box::from_raw(self.contents.err) };
11141 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
11142 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11143 let contents = if o.result_ok {
11144 let result = unsafe { o.contents.result };
11145 unsafe { o.contents.result = core::ptr::null_mut() };
11146 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
11148 let err = unsafe { o.contents.err };
11149 unsafe { o.contents.err = core::ptr::null_mut(); }
11150 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
11154 result_ok: o.result_ok,
11158 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
11159 fn clone(&self) -> Self {
11160 if self.result_ok {
11161 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
11162 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
11165 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
11166 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11172 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
11173 /// but with all dynamically-allocated buffers duplicated in new buffers.
11174 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
11176 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
11177 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
11178 /// A pointer to the contents in the success state.
11179 /// Reading from this pointer when `result_ok` is not set is undefined.
11180 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
11181 /// A pointer to the contents in the error state.
11182 /// Reading from this pointer when `result_ok` is set is undefined.
11183 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11186 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
11187 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
11188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11189 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
11190 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
11191 /// `err` or `result` depending on the state of `result_ok`.
11192 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
11193 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
11194 pub result_ok: bool,
11197 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
11198 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
11199 CResult_ChannelCounterpartyDecodeErrorZ {
11200 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11201 result: Box::into_raw(Box::new(o)),
11207 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
11208 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
11209 CResult_ChannelCounterpartyDecodeErrorZ {
11210 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11211 err: Box::into_raw(Box::new(e)),
11216 /// Checks if the given object is currently in the success state
11218 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
11222 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
11223 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
11224 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
11225 fn drop(&mut self) {
11226 if self.result_ok {
11227 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11228 let _ = unsafe { Box::from_raw(self.contents.result) };
11231 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11232 let _ = unsafe { Box::from_raw(self.contents.err) };
11237 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
11238 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
11239 let contents = if o.result_ok {
11240 let result = unsafe { o.contents.result };
11241 unsafe { o.contents.result = core::ptr::null_mut() };
11242 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
11244 let err = unsafe { o.contents.err };
11245 unsafe { o.contents.err = core::ptr::null_mut(); }
11246 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
11250 result_ok: o.result_ok,
11254 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
11255 fn clone(&self) -> Self {
11256 if self.result_ok {
11257 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11258 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
11261 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11262 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11268 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
11269 /// but with all dynamically-allocated buffers duplicated in new buffers.
11270 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
11272 /// The contents of CResult_ChannelDetailsDecodeErrorZ
11273 pub union CResult_ChannelDetailsDecodeErrorZPtr {
11274 /// A pointer to the contents in the success state.
11275 /// Reading from this pointer when `result_ok` is not set is undefined.
11276 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
11277 /// A pointer to the contents in the error state.
11278 /// Reading from this pointer when `result_ok` is set is undefined.
11279 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11282 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
11283 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
11284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11285 pub struct CResult_ChannelDetailsDecodeErrorZ {
11286 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
11287 /// `err` or `result` depending on the state of `result_ok`.
11288 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
11289 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
11290 pub result_ok: bool,
11293 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
11294 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
11295 CResult_ChannelDetailsDecodeErrorZ {
11296 contents: CResult_ChannelDetailsDecodeErrorZPtr {
11297 result: Box::into_raw(Box::new(o)),
11303 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
11304 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
11305 CResult_ChannelDetailsDecodeErrorZ {
11306 contents: CResult_ChannelDetailsDecodeErrorZPtr {
11307 err: Box::into_raw(Box::new(e)),
11312 /// Checks if the given object is currently in the success state
11314 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
11318 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
11319 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
11320 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
11321 fn drop(&mut self) {
11322 if self.result_ok {
11323 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11324 let _ = unsafe { Box::from_raw(self.contents.result) };
11327 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11328 let _ = unsafe { Box::from_raw(self.contents.err) };
11333 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
11334 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
11335 let contents = if o.result_ok {
11336 let result = unsafe { o.contents.result };
11337 unsafe { o.contents.result = core::ptr::null_mut() };
11338 CResult_ChannelDetailsDecodeErrorZPtr { result }
11340 let err = unsafe { o.contents.err };
11341 unsafe { o.contents.err = core::ptr::null_mut(); }
11342 CResult_ChannelDetailsDecodeErrorZPtr { err }
11346 result_ok: o.result_ok,
11350 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
11351 fn clone(&self) -> Self {
11352 if self.result_ok {
11353 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
11354 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
11357 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
11358 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11364 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
11365 /// but with all dynamically-allocated buffers duplicated in new buffers.
11366 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
11368 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
11369 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
11370 /// A pointer to the contents in the success state.
11371 /// Reading from this pointer when `result_ok` is not set is undefined.
11372 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
11373 /// A pointer to the contents in the error state.
11374 /// Reading from this pointer when `result_ok` is set is undefined.
11375 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11378 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
11379 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
11380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11381 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
11382 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
11383 /// `err` or `result` depending on the state of `result_ok`.
11384 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
11385 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
11386 pub result_ok: bool,
11389 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
11390 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
11391 CResult_PhantomRouteHintsDecodeErrorZ {
11392 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11393 result: Box::into_raw(Box::new(o)),
11399 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
11400 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
11401 CResult_PhantomRouteHintsDecodeErrorZ {
11402 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11403 err: Box::into_raw(Box::new(e)),
11408 /// Checks if the given object is currently in the success state
11410 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
11414 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
11415 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
11416 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
11417 fn drop(&mut self) {
11418 if self.result_ok {
11419 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11420 let _ = unsafe { Box::from_raw(self.contents.result) };
11423 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11424 let _ = unsafe { Box::from_raw(self.contents.err) };
11429 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
11430 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
11431 let contents = if o.result_ok {
11432 let result = unsafe { o.contents.result };
11433 unsafe { o.contents.result = core::ptr::null_mut() };
11434 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
11436 let err = unsafe { o.contents.err };
11437 unsafe { o.contents.err = core::ptr::null_mut(); }
11438 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
11442 result_ok: o.result_ok,
11446 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
11447 fn clone(&self) -> Self {
11448 if self.result_ok {
11449 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11450 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
11453 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11454 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11460 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
11461 /// but with all dynamically-allocated buffers duplicated in new buffers.
11462 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
11464 /// The contents of CResult_BlindedForwardDecodeErrorZ
11465 pub union CResult_BlindedForwardDecodeErrorZPtr {
11466 /// A pointer to the contents in the success state.
11467 /// Reading from this pointer when `result_ok` is not set is undefined.
11468 pub result: *mut crate::lightning::ln::channelmanager::BlindedForward,
11469 /// A pointer to the contents in the error state.
11470 /// Reading from this pointer when `result_ok` is set is undefined.
11471 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11474 /// A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation,
11475 /// containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure.
11476 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11477 pub struct CResult_BlindedForwardDecodeErrorZ {
11478 /// The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either
11479 /// `err` or `result` depending on the state of `result_ok`.
11480 pub contents: CResult_BlindedForwardDecodeErrorZPtr,
11481 /// Whether this CResult_BlindedForwardDecodeErrorZ represents a success state.
11482 pub result_ok: bool,
11485 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the success state.
11486 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ {
11487 CResult_BlindedForwardDecodeErrorZ {
11488 contents: CResult_BlindedForwardDecodeErrorZPtr {
11489 result: Box::into_raw(Box::new(o)),
11495 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the error state.
11496 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ {
11497 CResult_BlindedForwardDecodeErrorZ {
11498 contents: CResult_BlindedForwardDecodeErrorZPtr {
11499 err: Box::into_raw(Box::new(e)),
11504 /// Checks if the given object is currently in the success state
11506 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> bool {
11510 /// Frees any resources used by the CResult_BlindedForwardDecodeErrorZ.
11511 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { }
11512 impl Drop for CResult_BlindedForwardDecodeErrorZ {
11513 fn drop(&mut self) {
11514 if self.result_ok {
11515 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11516 let _ = unsafe { Box::from_raw(self.contents.result) };
11519 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11520 let _ = unsafe { Box::from_raw(self.contents.err) };
11525 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedForwardDecodeErrorZ {
11526 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>) -> Self {
11527 let contents = if o.result_ok {
11528 let result = unsafe { o.contents.result };
11529 unsafe { o.contents.result = core::ptr::null_mut() };
11530 CResult_BlindedForwardDecodeErrorZPtr { result }
11532 let err = unsafe { o.contents.err };
11533 unsafe { o.contents.err = core::ptr::null_mut(); }
11534 CResult_BlindedForwardDecodeErrorZPtr { err }
11538 result_ok: o.result_ok,
11542 impl Clone for CResult_BlindedForwardDecodeErrorZ {
11543 fn clone(&self) -> Self {
11544 if self.result_ok {
11545 Self { result_ok: true, contents: CResult_BlindedForwardDecodeErrorZPtr {
11546 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedForward>::clone(unsafe { &*self.contents.result })))
11549 Self { result_ok: false, contents: CResult_BlindedForwardDecodeErrorZPtr {
11550 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11556 /// Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig`
11557 /// but with all dynamically-allocated buffers duplicated in new buffers.
11558 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) }
11560 /// The contents of CResult_PendingHTLCRoutingDecodeErrorZ
11561 pub union CResult_PendingHTLCRoutingDecodeErrorZPtr {
11562 /// A pointer to the contents in the success state.
11563 /// Reading from this pointer when `result_ok` is not set is undefined.
11564 pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCRouting,
11565 /// A pointer to the contents in the error state.
11566 /// Reading from this pointer when `result_ok` is set is undefined.
11567 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11570 /// A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation,
11571 /// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure.
11572 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11573 pub struct CResult_PendingHTLCRoutingDecodeErrorZ {
11574 /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either
11575 /// `err` or `result` depending on the state of `result_ok`.
11576 pub contents: CResult_PendingHTLCRoutingDecodeErrorZPtr,
11577 /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state.
11578 pub result_ok: bool,
11581 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state.
11582 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11583 CResult_PendingHTLCRoutingDecodeErrorZ {
11584 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11585 result: Box::into_raw(Box::new(o)),
11591 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state.
11592 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11593 CResult_PendingHTLCRoutingDecodeErrorZ {
11594 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11595 err: Box::into_raw(Box::new(e)),
11600 /// Checks if the given object is currently in the success state
11602 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> bool {
11606 /// Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ.
11607 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { }
11608 impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ {
11609 fn drop(&mut self) {
11610 if self.result_ok {
11611 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11612 let _ = unsafe { Box::from_raw(self.contents.result) };
11615 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11616 let _ = unsafe { Box::from_raw(self.contents.err) };
11621 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCRoutingDecodeErrorZ {
11622 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>) -> Self {
11623 let contents = if o.result_ok {
11624 let result = unsafe { o.contents.result };
11625 unsafe { o.contents.result = core::ptr::null_mut() };
11626 CResult_PendingHTLCRoutingDecodeErrorZPtr { result }
11628 let err = unsafe { o.contents.err };
11629 unsafe { o.contents.err = core::ptr::null_mut(); }
11630 CResult_PendingHTLCRoutingDecodeErrorZPtr { err }
11634 result_ok: o.result_ok,
11638 impl Clone for CResult_PendingHTLCRoutingDecodeErrorZ {
11639 fn clone(&self) -> Self {
11640 if self.result_ok {
11641 Self { result_ok: true, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11642 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCRouting>::clone(unsafe { &*self.contents.result })))
11645 Self { result_ok: false, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11646 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11652 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig`
11653 /// but with all dynamically-allocated buffers duplicated in new buffers.
11654 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) }
11656 /// The contents of CResult_PendingHTLCInfoDecodeErrorZ
11657 pub union CResult_PendingHTLCInfoDecodeErrorZPtr {
11658 /// A pointer to the contents in the success state.
11659 /// Reading from this pointer when `result_ok` is not set is undefined.
11660 pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
11661 /// A pointer to the contents in the error state.
11662 /// Reading from this pointer when `result_ok` is set is undefined.
11663 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11666 /// A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation,
11667 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11669 pub struct CResult_PendingHTLCInfoDecodeErrorZ {
11670 /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either
11671 /// `err` or `result` depending on the state of `result_ok`.
11672 pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr,
11673 /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state.
11674 pub result_ok: bool,
11677 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state.
11678 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ {
11679 CResult_PendingHTLCInfoDecodeErrorZ {
11680 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11681 result: Box::into_raw(Box::new(o)),
11687 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state.
11688 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ {
11689 CResult_PendingHTLCInfoDecodeErrorZ {
11690 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11691 err: Box::into_raw(Box::new(e)),
11696 /// Checks if the given object is currently in the success state
11698 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool {
11702 /// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ.
11703 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { }
11704 impl Drop for CResult_PendingHTLCInfoDecodeErrorZ {
11705 fn drop(&mut self) {
11706 if self.result_ok {
11707 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11708 let _ = unsafe { Box::from_raw(self.contents.result) };
11711 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11712 let _ = unsafe { Box::from_raw(self.contents.err) };
11717 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCInfoDecodeErrorZ {
11718 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11719 let contents = if o.result_ok {
11720 let result = unsafe { o.contents.result };
11721 unsafe { o.contents.result = core::ptr::null_mut() };
11722 CResult_PendingHTLCInfoDecodeErrorZPtr { result }
11724 let err = unsafe { o.contents.err };
11725 unsafe { o.contents.err = core::ptr::null_mut(); }
11726 CResult_PendingHTLCInfoDecodeErrorZPtr { err }
11730 result_ok: o.result_ok,
11734 impl Clone for CResult_PendingHTLCInfoDecodeErrorZ {
11735 fn clone(&self) -> Self {
11736 if self.result_ok {
11737 Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11738 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCInfo>::clone(unsafe { &*self.contents.result })))
11741 Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11742 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11748 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig`
11749 /// but with all dynamically-allocated buffers duplicated in new buffers.
11750 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) }
11752 /// The contents of CResult_BlindedFailureDecodeErrorZ
11753 pub union CResult_BlindedFailureDecodeErrorZPtr {
11754 /// A pointer to the contents in the success state.
11755 /// Reading from this pointer when `result_ok` is not set is undefined.
11756 pub result: *mut crate::lightning::ln::channelmanager::BlindedFailure,
11757 /// A pointer to the contents in the error state.
11758 /// Reading from this pointer when `result_ok` is set is undefined.
11759 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11762 /// A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation,
11763 /// containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure.
11764 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11765 pub struct CResult_BlindedFailureDecodeErrorZ {
11766 /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either
11767 /// `err` or `result` depending on the state of `result_ok`.
11768 pub contents: CResult_BlindedFailureDecodeErrorZPtr,
11769 /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state.
11770 pub result_ok: bool,
11773 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state.
11774 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ {
11775 CResult_BlindedFailureDecodeErrorZ {
11776 contents: CResult_BlindedFailureDecodeErrorZPtr {
11777 result: Box::into_raw(Box::new(o)),
11783 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state.
11784 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ {
11785 CResult_BlindedFailureDecodeErrorZ {
11786 contents: CResult_BlindedFailureDecodeErrorZPtr {
11787 err: Box::into_raw(Box::new(e)),
11792 /// Checks if the given object is currently in the success state
11794 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool {
11798 /// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ.
11799 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { }
11800 impl Drop for CResult_BlindedFailureDecodeErrorZ {
11801 fn drop(&mut self) {
11802 if self.result_ok {
11803 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11804 let _ = unsafe { Box::from_raw(self.contents.result) };
11807 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11808 let _ = unsafe { Box::from_raw(self.contents.err) };
11813 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedFailureDecodeErrorZ {
11814 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>) -> Self {
11815 let contents = if o.result_ok {
11816 let result = unsafe { o.contents.result };
11817 unsafe { o.contents.result = core::ptr::null_mut() };
11818 CResult_BlindedFailureDecodeErrorZPtr { result }
11820 let err = unsafe { o.contents.err };
11821 unsafe { o.contents.err = core::ptr::null_mut(); }
11822 CResult_BlindedFailureDecodeErrorZPtr { err }
11826 result_ok: o.result_ok,
11830 impl Clone for CResult_BlindedFailureDecodeErrorZ {
11831 fn clone(&self) -> Self {
11832 if self.result_ok {
11833 Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr {
11834 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedFailure>::clone(unsafe { &*self.contents.result })))
11837 Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr {
11838 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11844 /// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig`
11845 /// but with all dynamically-allocated buffers duplicated in new buffers.
11846 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) }
11848 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
11849 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
11850 /// A pointer to the contents in the success state.
11851 /// Reading from this pointer when `result_ok` is not set is undefined.
11852 pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
11853 /// A pointer to the contents in the error state.
11854 /// Reading from this pointer when `result_ok` is set is undefined.
11855 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11858 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
11859 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
11860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11861 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
11862 /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
11863 /// `err` or `result` depending on the state of `result_ok`.
11864 pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
11865 /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
11866 pub result_ok: bool,
11869 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
11870 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
11871 CResult_ChannelShutdownStateDecodeErrorZ {
11872 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11873 result: Box::into_raw(Box::new(o)),
11879 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
11880 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
11881 CResult_ChannelShutdownStateDecodeErrorZ {
11882 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11883 err: Box::into_raw(Box::new(e)),
11888 /// Checks if the given object is currently in the success state
11890 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
11894 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
11895 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
11896 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
11897 fn drop(&mut self) {
11898 if self.result_ok {
11899 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11900 let _ = unsafe { Box::from_raw(self.contents.result) };
11903 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11904 let _ = unsafe { Box::from_raw(self.contents.err) };
11909 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
11910 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
11911 let contents = if o.result_ok {
11912 let result = unsafe { o.contents.result };
11913 unsafe { o.contents.result = core::ptr::null_mut() };
11914 CResult_ChannelShutdownStateDecodeErrorZPtr { result }
11916 let err = unsafe { o.contents.err };
11917 unsafe { o.contents.err = core::ptr::null_mut(); }
11918 CResult_ChannelShutdownStateDecodeErrorZPtr { err }
11922 result_ok: o.result_ok,
11926 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
11927 fn clone(&self) -> Self {
11928 if self.result_ok {
11929 Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11930 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
11933 Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11934 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11940 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
11941 /// but with all dynamically-allocated buffers duplicated in new buffers.
11942 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
11944 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
11945 /// This corresponds to std::vector in C++
11946 pub struct CVec_ChannelMonitorZ {
11947 /// The elements in the array.
11948 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11949 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
11950 /// The number of elements pointed to by `data`.
11953 impl CVec_ChannelMonitorZ {
11954 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
11955 if self.datalen == 0 { return Vec::new(); }
11956 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11957 self.data = core::ptr::null_mut();
11961 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
11962 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11965 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
11966 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
11967 let datalen = v.len();
11968 let data = Box::into_raw(v.into_boxed_slice());
11969 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11973 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11974 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
11975 impl Drop for CVec_ChannelMonitorZ {
11976 fn drop(&mut self) {
11977 if self.datalen == 0 { return; }
11978 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11981 impl Clone for CVec_ChannelMonitorZ {
11982 fn clone(&self) -> Self {
11983 let mut res = Vec::new();
11984 if self.datalen == 0 { return Self::from(res); }
11985 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11990 /// A tuple of 2 elements. See the individual fields for the types contained.
11991 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
11992 /// The element at position 0
11993 pub a: crate::c_types::ThirtyTwoBytes,
11994 /// The element at position 1
11995 pub b: crate::lightning::ln::channelmanager::ChannelManager,
11997 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
11998 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
12005 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
12006 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
12010 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
12012 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
12013 C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
12017 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
12018 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
12020 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
12021 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
12022 /// A pointer to the contents in the success state.
12023 /// Reading from this pointer when `result_ok` is not set is undefined.
12024 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
12025 /// A pointer to the contents in the error state.
12026 /// Reading from this pointer when `result_ok` is set is undefined.
12027 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12030 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
12031 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12032 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12033 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12034 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
12035 /// `err` or `result` depending on the state of `result_ok`.
12036 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
12037 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
12038 pub result_ok: bool,
12041 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
12042 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12043 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12044 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
12045 result: Box::into_raw(Box::new(o)),
12051 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
12052 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12053 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12054 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
12055 err: Box::into_raw(Box::new(e)),
12060 /// Checks if the given object is currently in the success state
12062 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
12066 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
12067 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
12068 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12069 fn drop(&mut self) {
12070 if self.result_ok {
12071 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12072 let _ = unsafe { Box::from_raw(self.contents.result) };
12075 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12076 let _ = unsafe { Box::from_raw(self.contents.err) };
12081 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12082 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12083 let contents = if o.result_ok {
12084 let result = unsafe { o.contents.result };
12085 unsafe { o.contents.result = core::ptr::null_mut() };
12086 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
12088 let err = unsafe { o.contents.err };
12089 unsafe { o.contents.err = core::ptr::null_mut(); }
12090 CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
12094 result_ok: o.result_ok,
12099 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
12100 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
12101 /// A pointer to the contents in the success state.
12102 /// Reading from this pointer when `result_ok` is not set is undefined.
12103 pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
12104 /// A pointer to the contents in the error state.
12105 /// Reading from this pointer when `result_ok` is set is undefined.
12106 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12109 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
12110 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
12111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12112 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
12113 /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
12114 /// `err` or `result` depending on the state of `result_ok`.
12115 pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
12116 /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
12117 pub result_ok: bool,
12120 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
12121 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
12122 CResult_MaxDustHTLCExposureDecodeErrorZ {
12123 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
12124 result: Box::into_raw(Box::new(o)),
12130 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
12131 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
12132 CResult_MaxDustHTLCExposureDecodeErrorZ {
12133 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
12134 err: Box::into_raw(Box::new(e)),
12139 /// Checks if the given object is currently in the success state
12141 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
12145 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
12146 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
12147 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
12148 fn drop(&mut self) {
12149 if self.result_ok {
12150 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12151 let _ = unsafe { Box::from_raw(self.contents.result) };
12154 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12155 let _ = unsafe { Box::from_raw(self.contents.err) };
12160 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
12161 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
12162 let contents = if o.result_ok {
12163 let result = unsafe { o.contents.result };
12164 unsafe { o.contents.result = core::ptr::null_mut() };
12165 CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
12167 let err = unsafe { o.contents.err };
12168 unsafe { o.contents.err = core::ptr::null_mut(); }
12169 CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
12173 result_ok: o.result_ok,
12177 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
12178 fn clone(&self) -> Self {
12179 if self.result_ok {
12180 Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
12181 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
12184 Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
12185 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12191 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
12192 /// but with all dynamically-allocated buffers duplicated in new buffers.
12193 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
12195 /// The contents of CResult_ChannelConfigDecodeErrorZ
12196 pub union CResult_ChannelConfigDecodeErrorZPtr {
12197 /// A pointer to the contents in the success state.
12198 /// Reading from this pointer when `result_ok` is not set is undefined.
12199 pub result: *mut crate::lightning::util::config::ChannelConfig,
12200 /// A pointer to the contents in the error state.
12201 /// Reading from this pointer when `result_ok` is set is undefined.
12202 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12205 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
12206 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
12207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12208 pub struct CResult_ChannelConfigDecodeErrorZ {
12209 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
12210 /// `err` or `result` depending on the state of `result_ok`.
12211 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
12212 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
12213 pub result_ok: bool,
12216 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
12217 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
12218 CResult_ChannelConfigDecodeErrorZ {
12219 contents: CResult_ChannelConfigDecodeErrorZPtr {
12220 result: Box::into_raw(Box::new(o)),
12226 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
12227 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
12228 CResult_ChannelConfigDecodeErrorZ {
12229 contents: CResult_ChannelConfigDecodeErrorZPtr {
12230 err: Box::into_raw(Box::new(e)),
12235 /// Checks if the given object is currently in the success state
12237 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
12241 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
12242 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
12243 impl Drop for CResult_ChannelConfigDecodeErrorZ {
12244 fn drop(&mut self) {
12245 if self.result_ok {
12246 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12247 let _ = unsafe { Box::from_raw(self.contents.result) };
12250 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12251 let _ = unsafe { Box::from_raw(self.contents.err) };
12256 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
12257 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
12258 let contents = if o.result_ok {
12259 let result = unsafe { o.contents.result };
12260 unsafe { o.contents.result = core::ptr::null_mut() };
12261 CResult_ChannelConfigDecodeErrorZPtr { result }
12263 let err = unsafe { o.contents.err };
12264 unsafe { o.contents.err = core::ptr::null_mut(); }
12265 CResult_ChannelConfigDecodeErrorZPtr { err }
12269 result_ok: o.result_ok,
12273 impl Clone for CResult_ChannelConfigDecodeErrorZ {
12274 fn clone(&self) -> Self {
12275 if self.result_ok {
12276 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
12277 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
12280 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
12281 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12287 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
12288 /// but with all dynamically-allocated buffers duplicated in new buffers.
12289 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
12292 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
12293 pub enum COption_MaxDustHTLCExposureZ {
12294 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
12295 Some(crate::lightning::util::config::MaxDustHTLCExposure),
12296 /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
12299 impl COption_MaxDustHTLCExposureZ {
12300 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12301 if let Self::None = self { false } else { true }
12303 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12306 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
12307 if let Self::Some(v) = self { v } else { unreachable!() }
12311 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
12312 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
12313 COption_MaxDustHTLCExposureZ::Some(o)
12316 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
12317 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
12318 COption_MaxDustHTLCExposureZ::None
12321 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
12322 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
12324 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
12325 /// but with all dynamically-allocated buffers duplicated in new buffers.
12326 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
12329 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
12330 pub enum COption_APIErrorZ {
12331 /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
12332 Some(crate::lightning::util::errors::APIError),
12333 /// When we're in this state, this COption_APIErrorZ contains nothing
12336 impl COption_APIErrorZ {
12337 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12338 if let Self::None = self { false } else { true }
12340 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12343 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
12344 if let Self::Some(v) = self { v } else { unreachable!() }
12348 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
12349 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
12350 COption_APIErrorZ::Some(o)
12353 /// Constructs a new COption_APIErrorZ containing nothing
12354 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
12355 COption_APIErrorZ::None
12358 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
12359 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
12361 /// Creates a new COption_APIErrorZ which has the same data as `orig`
12362 /// but with all dynamically-allocated buffers duplicated in new buffers.
12363 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
12365 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
12366 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
12367 /// A pointer to the contents in the success state.
12368 /// Reading from this pointer when `result_ok` is not set is undefined.
12369 pub result: *mut crate::c_types::derived::COption_APIErrorZ,
12370 /// A pointer to the contents in the error state.
12371 /// Reading from this pointer when `result_ok` is set is undefined.
12372 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12375 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
12376 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12378 pub struct CResult_COption_APIErrorZDecodeErrorZ {
12379 /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
12380 /// `err` or `result` depending on the state of `result_ok`.
12381 pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
12382 /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
12383 pub result_ok: bool,
12386 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
12387 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
12388 CResult_COption_APIErrorZDecodeErrorZ {
12389 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12390 result: Box::into_raw(Box::new(o)),
12396 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
12397 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
12398 CResult_COption_APIErrorZDecodeErrorZ {
12399 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12400 err: Box::into_raw(Box::new(e)),
12405 /// Checks if the given object is currently in the success state
12407 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
12411 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
12412 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
12413 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
12414 fn drop(&mut self) {
12415 if self.result_ok {
12416 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12417 let _ = unsafe { Box::from_raw(self.contents.result) };
12420 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12421 let _ = unsafe { Box::from_raw(self.contents.err) };
12426 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
12427 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12428 let contents = if o.result_ok {
12429 let result = unsafe { o.contents.result };
12430 unsafe { o.contents.result = core::ptr::null_mut() };
12431 CResult_COption_APIErrorZDecodeErrorZPtr { result }
12433 let err = unsafe { o.contents.err };
12434 unsafe { o.contents.err = core::ptr::null_mut(); }
12435 CResult_COption_APIErrorZDecodeErrorZPtr { err }
12439 result_ok: o.result_ok,
12443 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
12444 fn clone(&self) -> Self {
12445 if self.result_ok {
12446 Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12447 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
12450 Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12451 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12457 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
12458 /// but with all dynamically-allocated buffers duplicated in new buffers.
12459 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
12461 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
12462 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12463 /// A pointer to the contents in the success state.
12464 /// Reading from this pointer when `result_ok` is not set is undefined.
12465 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
12466 /// A pointer to the contents in the error state.
12467 /// Reading from this pointer when `result_ok` is set is undefined.
12468 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12471 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
12472 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12474 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
12475 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
12476 /// `err` or `result` depending on the state of `result_ok`.
12477 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
12478 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
12479 pub result_ok: bool,
12482 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
12483 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12484 CResult_ChannelMonitorUpdateDecodeErrorZ {
12485 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12486 result: Box::into_raw(Box::new(o)),
12492 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
12493 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12494 CResult_ChannelMonitorUpdateDecodeErrorZ {
12495 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12496 err: Box::into_raw(Box::new(e)),
12501 /// Checks if the given object is currently in the success state
12503 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
12507 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
12508 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
12509 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
12510 fn drop(&mut self) {
12511 if self.result_ok {
12512 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12513 let _ = unsafe { Box::from_raw(self.contents.result) };
12516 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12517 let _ = unsafe { Box::from_raw(self.contents.err) };
12522 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
12523 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12524 let contents = if o.result_ok {
12525 let result = unsafe { o.contents.result };
12526 unsafe { o.contents.result = core::ptr::null_mut() };
12527 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
12529 let err = unsafe { o.contents.err };
12530 unsafe { o.contents.err = core::ptr::null_mut(); }
12531 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
12535 result_ok: o.result_ok,
12539 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
12540 fn clone(&self) -> Self {
12541 if self.result_ok {
12542 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12543 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
12546 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12547 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12553 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
12554 /// but with all dynamically-allocated buffers duplicated in new buffers.
12555 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
12558 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
12559 pub enum COption_MonitorEventZ {
12560 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
12561 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
12562 /// When we're in this state, this COption_MonitorEventZ contains nothing
12565 impl COption_MonitorEventZ {
12566 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12567 if let Self::None = self { false } else { true }
12569 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12572 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
12573 if let Self::Some(v) = self { v } else { unreachable!() }
12577 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
12578 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
12579 COption_MonitorEventZ::Some(o)
12582 /// Constructs a new COption_MonitorEventZ containing nothing
12583 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
12584 COption_MonitorEventZ::None
12587 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
12588 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
12590 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
12591 /// but with all dynamically-allocated buffers duplicated in new buffers.
12592 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
12594 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
12595 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
12596 /// A pointer to the contents in the success state.
12597 /// Reading from this pointer when `result_ok` is not set is undefined.
12598 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
12599 /// A pointer to the contents in the error state.
12600 /// Reading from this pointer when `result_ok` is set is undefined.
12601 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12604 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
12605 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12607 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
12608 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
12609 /// `err` or `result` depending on the state of `result_ok`.
12610 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
12611 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
12612 pub result_ok: bool,
12615 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
12616 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
12617 CResult_COption_MonitorEventZDecodeErrorZ {
12618 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12619 result: Box::into_raw(Box::new(o)),
12625 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
12626 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
12627 CResult_COption_MonitorEventZDecodeErrorZ {
12628 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12629 err: Box::into_raw(Box::new(e)),
12634 /// Checks if the given object is currently in the success state
12636 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
12640 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
12641 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
12642 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
12643 fn drop(&mut self) {
12644 if self.result_ok {
12645 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12646 let _ = unsafe { Box::from_raw(self.contents.result) };
12649 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12650 let _ = unsafe { Box::from_raw(self.contents.err) };
12655 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
12656 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12657 let contents = if o.result_ok {
12658 let result = unsafe { o.contents.result };
12659 unsafe { o.contents.result = core::ptr::null_mut() };
12660 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
12662 let err = unsafe { o.contents.err };
12663 unsafe { o.contents.err = core::ptr::null_mut(); }
12664 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
12668 result_ok: o.result_ok,
12672 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
12673 fn clone(&self) -> Self {
12674 if self.result_ok {
12675 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12676 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
12679 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12680 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12686 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
12687 /// but with all dynamically-allocated buffers duplicated in new buffers.
12688 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
12690 /// The contents of CResult_HTLCUpdateDecodeErrorZ
12691 pub union CResult_HTLCUpdateDecodeErrorZPtr {
12692 /// A pointer to the contents in the success state.
12693 /// Reading from this pointer when `result_ok` is not set is undefined.
12694 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
12695 /// A pointer to the contents in the error state.
12696 /// Reading from this pointer when `result_ok` is set is undefined.
12697 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12700 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
12701 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12703 pub struct CResult_HTLCUpdateDecodeErrorZ {
12704 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
12705 /// `err` or `result` depending on the state of `result_ok`.
12706 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
12707 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
12708 pub result_ok: bool,
12711 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
12712 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
12713 CResult_HTLCUpdateDecodeErrorZ {
12714 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12715 result: Box::into_raw(Box::new(o)),
12721 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
12722 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
12723 CResult_HTLCUpdateDecodeErrorZ {
12724 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12725 err: Box::into_raw(Box::new(e)),
12730 /// Checks if the given object is currently in the success state
12732 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
12736 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
12737 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
12738 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
12739 fn drop(&mut self) {
12740 if self.result_ok {
12741 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12742 let _ = unsafe { Box::from_raw(self.contents.result) };
12745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12746 let _ = unsafe { Box::from_raw(self.contents.err) };
12751 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
12752 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12753 let contents = if o.result_ok {
12754 let result = unsafe { o.contents.result };
12755 unsafe { o.contents.result = core::ptr::null_mut() };
12756 CResult_HTLCUpdateDecodeErrorZPtr { result }
12758 let err = unsafe { o.contents.err };
12759 unsafe { o.contents.err = core::ptr::null_mut(); }
12760 CResult_HTLCUpdateDecodeErrorZPtr { err }
12764 result_ok: o.result_ok,
12768 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
12769 fn clone(&self) -> Self {
12770 if self.result_ok {
12771 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12772 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
12775 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12776 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12782 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
12783 /// but with all dynamically-allocated buffers duplicated in new buffers.
12784 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
12786 /// A tuple of 2 elements. See the individual fields for the types contained.
12787 pub struct C2Tuple_OutPointCVec_u8ZZ {
12788 /// The element at position 0
12789 pub a: crate::lightning::chain::transaction::OutPoint,
12790 /// The element at position 1
12791 pub b: crate::c_types::derived::CVec_u8Z,
12793 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
12794 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
12801 impl C2Tuple_OutPointCVec_u8ZZ {
12802 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
12806 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
12807 fn clone(&self) -> Self {
12809 a: Clone::clone(&self.a),
12810 b: Clone::clone(&self.b),
12815 /// Creates a new tuple which has the same data as `orig`
12816 /// but with all dynamically-allocated buffers duplicated in new buffers.
12817 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
12818 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
12820 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
12821 C2Tuple_OutPointCVec_u8ZZ { a, b, }
12825 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
12826 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
12828 /// A tuple of 2 elements. See the individual fields for the types contained.
12829 pub struct C2Tuple_u32CVec_u8ZZ {
12830 /// The element at position 0
12832 /// The element at position 1
12833 pub b: crate::c_types::derived::CVec_u8Z,
12835 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
12836 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
12843 impl C2Tuple_u32CVec_u8ZZ {
12844 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
12848 impl Clone for C2Tuple_u32CVec_u8ZZ {
12849 fn clone(&self) -> Self {
12851 a: Clone::clone(&self.a),
12852 b: Clone::clone(&self.b),
12857 /// Creates a new tuple which has the same data as `orig`
12858 /// but with all dynamically-allocated buffers duplicated in new buffers.
12859 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
12860 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
12862 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
12863 C2Tuple_u32CVec_u8ZZ { a, b, }
12867 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
12868 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
12870 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
12871 /// This corresponds to std::vector in C++
12872 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
12873 /// The elements in the array.
12874 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12875 pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
12876 /// The number of elements pointed to by `data`.
12879 impl CVec_C2Tuple_u32CVec_u8ZZZ {
12880 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
12881 if self.datalen == 0 { return Vec::new(); }
12882 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12883 self.data = core::ptr::null_mut();
12887 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
12888 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12891 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
12892 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
12893 let datalen = v.len();
12894 let data = Box::into_raw(v.into_boxed_slice());
12895 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12899 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12900 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
12901 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
12902 fn drop(&mut self) {
12903 if self.datalen == 0 { return; }
12904 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12907 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
12908 fn clone(&self) -> Self {
12909 let mut res = Vec::new();
12910 if self.datalen == 0 { return Self::from(res); }
12911 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12916 /// A tuple of 2 elements. See the individual fields for the types contained.
12917 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12918 /// The element at position 0
12919 pub a: crate::c_types::ThirtyTwoBytes,
12920 /// The element at position 1
12921 pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
12923 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12924 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
12931 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12932 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
12936 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12937 fn clone(&self) -> Self {
12939 a: Clone::clone(&self.a),
12940 b: Clone::clone(&self.b),
12945 /// Creates a new tuple which has the same data as `orig`
12946 /// but with all dynamically-allocated buffers duplicated in new buffers.
12947 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
12948 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
12950 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 {
12951 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
12955 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
12956 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
12958 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
12959 /// This corresponds to std::vector in C++
12960 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12961 /// The elements in the array.
12962 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12963 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
12964 /// The number of elements pointed to by `data`.
12967 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12968 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
12969 if self.datalen == 0 { return Vec::new(); }
12970 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12971 self.data = core::ptr::null_mut();
12975 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
12976 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12979 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12980 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
12981 let datalen = v.len();
12982 let data = Box::into_raw(v.into_boxed_slice());
12983 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12987 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12988 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
12989 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12990 fn drop(&mut self) {
12991 if self.datalen == 0 { return; }
12992 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12995 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12996 fn clone(&self) -> Self {
12997 let mut res = Vec::new();
12998 if self.datalen == 0 { return Self::from(res); }
12999 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13004 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
13005 /// This corresponds to std::vector in C++
13006 pub struct CVec_CommitmentTransactionZ {
13007 /// The elements in the array.
13008 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13009 pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
13010 /// The number of elements pointed to by `data`.
13013 impl CVec_CommitmentTransactionZ {
13014 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
13015 if self.datalen == 0 { return Vec::new(); }
13016 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13017 self.data = core::ptr::null_mut();
13021 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
13022 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13025 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
13026 fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
13027 let datalen = v.len();
13028 let data = Box::into_raw(v.into_boxed_slice());
13029 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13033 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13034 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
13035 impl Drop for CVec_CommitmentTransactionZ {
13036 fn drop(&mut self) {
13037 if self.datalen == 0 { return; }
13038 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13041 impl Clone for CVec_CommitmentTransactionZ {
13042 fn clone(&self) -> Self {
13043 let mut res = Vec::new();
13044 if self.datalen == 0 { return Self::from(res); }
13045 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13050 /// A tuple of 2 elements. See the individual fields for the types contained.
13051 pub struct C2Tuple_u32TxOutZ {
13052 /// The element at position 0
13054 /// The element at position 1
13055 pub b: crate::c_types::TxOut,
13057 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
13058 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
13065 impl C2Tuple_u32TxOutZ {
13066 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
13070 impl Clone for C2Tuple_u32TxOutZ {
13071 fn clone(&self) -> Self {
13073 a: Clone::clone(&self.a),
13074 b: Clone::clone(&self.b),
13079 /// Creates a new tuple which has the same data as `orig`
13080 /// but with all dynamically-allocated buffers duplicated in new buffers.
13081 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
13082 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
13084 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
13085 C2Tuple_u32TxOutZ { a, b, }
13089 /// Frees any resources used by the C2Tuple_u32TxOutZ.
13090 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
13092 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
13093 /// This corresponds to std::vector in C++
13094 pub struct CVec_C2Tuple_u32TxOutZZ {
13095 /// The elements in the array.
13096 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13097 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
13098 /// The number of elements pointed to by `data`.
13101 impl CVec_C2Tuple_u32TxOutZZ {
13102 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
13103 if self.datalen == 0 { return Vec::new(); }
13104 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13105 self.data = core::ptr::null_mut();
13109 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
13110 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13113 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
13114 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
13115 let datalen = v.len();
13116 let data = Box::into_raw(v.into_boxed_slice());
13117 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13121 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13122 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
13123 impl Drop for CVec_C2Tuple_u32TxOutZZ {
13124 fn drop(&mut self) {
13125 if self.datalen == 0 { return; }
13126 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13129 impl Clone for CVec_C2Tuple_u32TxOutZZ {
13130 fn clone(&self) -> Self {
13131 let mut res = Vec::new();
13132 if self.datalen == 0 { return Self::from(res); }
13133 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13138 /// A tuple of 2 elements. See the individual fields for the types contained.
13139 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
13140 /// The element at position 0
13141 pub a: crate::c_types::ThirtyTwoBytes,
13142 /// The element at position 1
13143 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
13145 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
13146 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
13153 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
13154 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
13158 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
13159 fn clone(&self) -> Self {
13161 a: Clone::clone(&self.a),
13162 b: Clone::clone(&self.b),
13167 /// Creates a new tuple which has the same data as `orig`
13168 /// but with all dynamically-allocated buffers duplicated in new buffers.
13169 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
13170 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
13172 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 {
13173 C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
13177 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
13178 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
13180 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
13181 /// This corresponds to std::vector in C++
13182 pub struct CVec_TransactionOutputsZ {
13183 /// The elements in the array.
13184 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13185 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
13186 /// The number of elements pointed to by `data`.
13189 impl CVec_TransactionOutputsZ {
13190 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
13191 if self.datalen == 0 { return Vec::new(); }
13192 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13193 self.data = core::ptr::null_mut();
13197 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
13198 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13201 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
13202 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
13203 let datalen = v.len();
13204 let data = Box::into_raw(v.into_boxed_slice());
13205 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13209 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13210 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
13211 impl Drop for CVec_TransactionOutputsZ {
13212 fn drop(&mut self) {
13213 if self.datalen == 0 { return; }
13214 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13217 impl Clone for CVec_TransactionOutputsZ {
13218 fn clone(&self) -> Self {
13219 let mut res = Vec::new();
13220 if self.datalen == 0 { return Self::from(res); }
13221 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13226 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
13227 /// This corresponds to std::vector in C++
13228 pub struct CVec_BalanceZ {
13229 /// The elements in the array.
13230 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13231 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
13232 /// The number of elements pointed to by `data`.
13235 impl CVec_BalanceZ {
13236 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
13237 if self.datalen == 0 { return Vec::new(); }
13238 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13239 self.data = core::ptr::null_mut();
13243 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
13244 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13247 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
13248 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
13249 let datalen = v.len();
13250 let data = Box::into_raw(v.into_boxed_slice());
13251 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13255 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13256 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
13257 impl Drop for CVec_BalanceZ {
13258 fn drop(&mut self) {
13259 if self.datalen == 0 { return; }
13260 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13263 impl Clone for CVec_BalanceZ {
13264 fn clone(&self) -> Self {
13265 let mut res = Vec::new();
13266 if self.datalen == 0 { return Self::from(res); }
13267 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13272 /// A tuple of 2 elements. See the individual fields for the types contained.
13273 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13274 /// The element at position 0
13275 pub a: crate::c_types::ThirtyTwoBytes,
13276 /// The element at position 1
13277 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
13279 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13280 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
13287 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13288 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
13292 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13293 fn clone(&self) -> Self {
13295 a: Clone::clone(&self.a),
13296 b: Clone::clone(&self.b),
13301 /// Creates a new tuple which has the same data as `orig`
13302 /// but with all dynamically-allocated buffers duplicated in new buffers.
13303 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
13304 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
13306 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13307 C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
13311 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
13312 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
13314 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
13315 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13316 /// A pointer to the contents in the success state.
13317 /// Reading from this pointer when `result_ok` is not set is undefined.
13318 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
13319 /// A pointer to the contents in the error state.
13320 /// Reading from this pointer when `result_ok` is set is undefined.
13321 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13324 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
13325 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13327 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13328 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
13329 /// `err` or `result` depending on the state of `result_ok`.
13330 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
13331 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
13332 pub result_ok: bool,
13335 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
13336 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13337 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13338 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13339 result: Box::into_raw(Box::new(o)),
13345 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
13346 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13347 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13348 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13349 err: Box::into_raw(Box::new(e)),
13354 /// Checks if the given object is currently in the success state
13356 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
13360 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
13361 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
13362 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13363 fn drop(&mut self) {
13364 if self.result_ok {
13365 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13366 let _ = unsafe { Box::from_raw(self.contents.result) };
13369 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13370 let _ = unsafe { Box::from_raw(self.contents.err) };
13375 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13376 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13377 let contents = if o.result_ok {
13378 let result = unsafe { o.contents.result };
13379 unsafe { o.contents.result = core::ptr::null_mut() };
13380 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
13382 let err = unsafe { o.contents.err };
13383 unsafe { o.contents.err = core::ptr::null_mut(); }
13384 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
13388 result_ok: o.result_ok,
13392 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13393 fn clone(&self) -> Self {
13394 if self.result_ok {
13395 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13396 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
13399 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13400 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13406 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
13407 /// but with all dynamically-allocated buffers duplicated in new buffers.
13408 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
13410 /// A tuple of 2 elements. See the individual fields for the types contained.
13411 pub struct C2Tuple_PublicKeyTypeZ {
13412 /// The element at position 0
13413 pub a: crate::c_types::PublicKey,
13414 /// The element at position 1
13415 pub b: crate::lightning::ln::wire::Type,
13417 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
13418 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
13425 impl C2Tuple_PublicKeyTypeZ {
13426 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
13430 impl Clone for C2Tuple_PublicKeyTypeZ {
13431 fn clone(&self) -> Self {
13433 a: Clone::clone(&self.a),
13434 b: Clone::clone(&self.b),
13439 /// Creates a new tuple which has the same data as `orig`
13440 /// but with all dynamically-allocated buffers duplicated in new buffers.
13441 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
13442 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
13444 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
13445 C2Tuple_PublicKeyTypeZ { a, b, }
13449 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
13450 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
13452 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
13453 /// This corresponds to std::vector in C++
13454 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
13455 /// The elements in the array.
13456 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13457 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
13458 /// The number of elements pointed to by `data`.
13461 impl CVec_C2Tuple_PublicKeyTypeZZ {
13462 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
13463 if self.datalen == 0 { return Vec::new(); }
13464 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13465 self.data = core::ptr::null_mut();
13469 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
13470 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13473 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
13474 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
13475 let datalen = v.len();
13476 let data = Box::into_raw(v.into_boxed_slice());
13477 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13481 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13482 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
13483 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
13484 fn drop(&mut self) {
13485 if self.datalen == 0 { return; }
13486 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13489 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
13490 fn clone(&self) -> Self {
13491 let mut res = Vec::new();
13492 if self.datalen == 0 { return Self::from(res); }
13493 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13498 /// A tuple of 2 elements. See the individual fields for the types contained.
13499 pub struct C2Tuple_PublicKeyCVec_SocketAddressZZ {
13500 /// The element at position 0
13501 pub a: crate::c_types::PublicKey,
13502 /// The element at position 1
13503 pub b: crate::c_types::derived::CVec_SocketAddressZ,
13505 impl From<(crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)> for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13506 fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)) -> Self {
13513 impl C2Tuple_PublicKeyCVec_SocketAddressZZ {
13514 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ) {
13518 impl Clone for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13519 fn clone(&self) -> Self {
13521 a: Clone::clone(&self.a),
13522 b: Clone::clone(&self.b),
13527 /// Creates a new tuple which has the same data as `orig`
13528 /// but with all dynamically-allocated buffers duplicated in new buffers.
13529 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCVec_SocketAddressZZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { Clone::clone(&orig) }
13530 /// Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements.
13532 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::CVec_SocketAddressZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ {
13533 C2Tuple_PublicKeyCVec_SocketAddressZZ { a, b, }
13537 /// Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ.
13538 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCVec_SocketAddressZZ) { }
13540 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZs of arbitrary size.
13541 /// This corresponds to std::vector in C++
13542 pub struct CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13543 /// The elements in the array.
13544 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13545 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ,
13546 /// The number of elements pointed to by `data`.
13549 impl CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13550 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ> {
13551 if self.datalen == 0 { return Vec::new(); }
13552 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13553 self.data = core::ptr::null_mut();
13557 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ] {
13558 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13561 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13562 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>) -> Self {
13563 let datalen = v.len();
13564 let data = Box::into_raw(v.into_boxed_slice());
13565 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13569 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13570 pub extern "C" fn CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ) { }
13571 impl Drop for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13572 fn drop(&mut self) {
13573 if self.datalen == 0 { return; }
13574 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13577 impl Clone for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13578 fn clone(&self) -> Self {
13579 let mut res = Vec::new();
13580 if self.datalen == 0 { return Self::from(res); }
13581 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13587 /// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
13588 pub enum COption_OnionMessageContentsZ {
13589 /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
13590 Some(crate::lightning::onion_message::packet::OnionMessageContents),
13591 /// When we're in this state, this COption_OnionMessageContentsZ contains nothing
13594 impl COption_OnionMessageContentsZ {
13595 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13596 if let Self::None = self { false } else { true }
13598 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13601 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents {
13602 if let Self::Some(v) = self { v } else { unreachable!() }
13606 /// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
13607 pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ {
13608 COption_OnionMessageContentsZ::Some(o)
13611 /// Constructs a new COption_OnionMessageContentsZ containing nothing
13612 pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ {
13613 COption_OnionMessageContentsZ::None
13616 /// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
13617 pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { }
13619 /// Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
13620 /// but with all dynamically-allocated buffers duplicated in new buffers.
13621 pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) }
13623 /// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
13624 pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13625 /// A pointer to the contents in the success state.
13626 /// Reading from this pointer when `result_ok` is not set is undefined.
13627 pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ,
13628 /// A pointer to the contents in the error state.
13629 /// Reading from this pointer when `result_ok` is set is undefined.
13630 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13633 /// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
13634 /// containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13635 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13636 pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ {
13637 /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
13638 /// `err` or `result` depending on the state of `result_ok`.
13639 pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr,
13640 /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
13641 pub result_ok: bool,
13644 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
13645 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13646 CResult_COption_OnionMessageContentsZDecodeErrorZ {
13647 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13648 result: Box::into_raw(Box::new(o)),
13654 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
13655 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13656 CResult_COption_OnionMessageContentsZDecodeErrorZ {
13657 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13658 err: Box::into_raw(Box::new(e)),
13663 /// Checks if the given object is currently in the success state
13665 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool {
13669 /// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
13670 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { }
13671 impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13672 fn drop(&mut self) {
13673 if self.result_ok {
13674 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13675 let _ = unsafe { Box::from_raw(self.contents.result) };
13678 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13679 let _ = unsafe { Box::from_raw(self.contents.err) };
13684 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13685 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13686 let contents = if o.result_ok {
13687 let result = unsafe { o.contents.result };
13688 unsafe { o.contents.result = core::ptr::null_mut() };
13689 CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result }
13691 let err = unsafe { o.contents.err };
13692 unsafe { o.contents.err = core::ptr::null_mut(); }
13693 CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err }
13697 result_ok: o.result_ok,
13701 impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13702 fn clone(&self) -> Self {
13703 if self.result_ok {
13704 Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13705 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
13708 Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13709 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13715 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
13716 /// but with all dynamically-allocated buffers duplicated in new buffers.
13717 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
13719 /// A tuple of 3 elements. See the individual fields for the types contained.
13720 pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13721 /// The element at position 0
13722 pub a: crate::lightning::onion_message::packet::OnionMessageContents,
13723 /// The element at position 1
13724 pub b: crate::lightning::onion_message::messenger::Destination,
13725 /// The element at position 2
13726 pub c: crate::lightning::blinded_path::BlindedPath,
13728 impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13729 fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
13737 impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13738 #[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) {
13739 (self.a, self.b, self.c)
13742 impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13743 fn clone(&self) -> Self {
13745 a: Clone::clone(&self.a),
13746 b: Clone::clone(&self.b),
13747 c: Clone::clone(&self.c),
13752 /// Creates a new tuple which has the same data as `orig`
13753 /// but with all dynamically-allocated buffers duplicated in new buffers.
13754 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) }
13755 /// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
13757 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 {
13758 C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, }
13762 /// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
13763 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { }
13765 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
13766 /// This corresponds to std::vector in C++
13767 pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13768 /// The elements in the array.
13769 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13770 pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ,
13771 /// The number of elements pointed to by `data`.
13774 impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13775 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ> {
13776 if self.datalen == 0 { return Vec::new(); }
13777 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13778 self.data = core::ptr::null_mut();
13782 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] {
13783 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13786 impl From<Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13787 fn from(v: Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>) -> Self {
13788 let datalen = v.len();
13789 let data = Box::into_raw(v.into_boxed_slice());
13790 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13794 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13795 pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { }
13796 impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13797 fn drop(&mut self) {
13798 if self.datalen == 0 { return; }
13799 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13802 impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13803 fn clone(&self) -> Self {
13804 let mut res = Vec::new();
13805 if self.datalen == 0 { return Self::from(res); }
13806 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13812 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
13813 pub enum COption_TypeZ {
13814 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
13815 Some(crate::lightning::ln::wire::Type),
13816 /// When we're in this state, this COption_TypeZ contains nothing
13819 impl COption_TypeZ {
13820 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13821 if let Self::None = self { false } else { true }
13823 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13826 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
13827 if let Self::Some(v) = self { v } else { unreachable!() }
13831 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
13832 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
13833 COption_TypeZ::Some(o)
13836 /// Constructs a new COption_TypeZ containing nothing
13837 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
13838 COption_TypeZ::None
13841 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
13842 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
13844 /// Creates a new COption_TypeZ which has the same data as `orig`
13845 /// but with all dynamically-allocated buffers duplicated in new buffers.
13846 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
13848 /// The contents of CResult_COption_TypeZDecodeErrorZ
13849 pub union CResult_COption_TypeZDecodeErrorZPtr {
13850 /// A pointer to the contents in the success state.
13851 /// Reading from this pointer when `result_ok` is not set is undefined.
13852 pub result: *mut crate::c_types::derived::COption_TypeZ,
13853 /// A pointer to the contents in the error state.
13854 /// Reading from this pointer when `result_ok` is set is undefined.
13855 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13858 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
13859 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13861 pub struct CResult_COption_TypeZDecodeErrorZ {
13862 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
13863 /// `err` or `result` depending on the state of `result_ok`.
13864 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
13865 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
13866 pub result_ok: bool,
13869 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
13870 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
13871 CResult_COption_TypeZDecodeErrorZ {
13872 contents: CResult_COption_TypeZDecodeErrorZPtr {
13873 result: Box::into_raw(Box::new(o)),
13879 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
13880 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
13881 CResult_COption_TypeZDecodeErrorZ {
13882 contents: CResult_COption_TypeZDecodeErrorZPtr {
13883 err: Box::into_raw(Box::new(e)),
13888 /// Checks if the given object is currently in the success state
13890 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
13894 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
13895 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
13896 impl Drop for CResult_COption_TypeZDecodeErrorZ {
13897 fn drop(&mut self) {
13898 if self.result_ok {
13899 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13900 let _ = unsafe { Box::from_raw(self.contents.result) };
13903 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13904 let _ = unsafe { Box::from_raw(self.contents.err) };
13909 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
13910 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13911 let contents = if o.result_ok {
13912 let result = unsafe { o.contents.result };
13913 unsafe { o.contents.result = core::ptr::null_mut() };
13914 CResult_COption_TypeZDecodeErrorZPtr { result }
13916 let err = unsafe { o.contents.err };
13917 unsafe { o.contents.err = core::ptr::null_mut(); }
13918 CResult_COption_TypeZDecodeErrorZPtr { err }
13922 result_ok: o.result_ok,
13926 impl Clone for CResult_COption_TypeZDecodeErrorZ {
13927 fn clone(&self) -> Self {
13928 if self.result_ok {
13929 Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
13930 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
13933 Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
13934 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13940 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
13941 /// but with all dynamically-allocated buffers duplicated in new buffers.
13942 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
13945 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
13946 pub enum COption_SocketAddressZ {
13947 /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
13948 Some(crate::lightning::ln::msgs::SocketAddress),
13949 /// When we're in this state, this COption_SocketAddressZ contains nothing
13952 impl COption_SocketAddressZ {
13953 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13954 if let Self::None = self { false } else { true }
13956 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13959 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
13960 if let Self::Some(v) = self { v } else { unreachable!() }
13964 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
13965 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
13966 COption_SocketAddressZ::Some(o)
13969 /// Constructs a new COption_SocketAddressZ containing nothing
13970 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
13971 COption_SocketAddressZ::None
13974 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
13975 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
13977 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
13978 /// but with all dynamically-allocated buffers duplicated in new buffers.
13979 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
13981 /// A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size.
13982 /// This corresponds to std::vector in C++
13983 pub struct CVec_PeerDetailsZ {
13984 /// The elements in the array.
13985 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13986 pub data: *mut crate::lightning::ln::peer_handler::PeerDetails,
13987 /// The number of elements pointed to by `data`.
13990 impl CVec_PeerDetailsZ {
13991 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::peer_handler::PeerDetails> {
13992 if self.datalen == 0 { return Vec::new(); }
13993 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13994 self.data = core::ptr::null_mut();
13998 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::peer_handler::PeerDetails] {
13999 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14002 impl From<Vec<crate::lightning::ln::peer_handler::PeerDetails>> for CVec_PeerDetailsZ {
14003 fn from(v: Vec<crate::lightning::ln::peer_handler::PeerDetails>) -> Self {
14004 let datalen = v.len();
14005 let data = Box::into_raw(v.into_boxed_slice());
14006 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14010 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14011 pub extern "C" fn CVec_PeerDetailsZ_free(_res: CVec_PeerDetailsZ) { }
14012 impl Drop for CVec_PeerDetailsZ {
14013 fn drop(&mut self) {
14014 if self.datalen == 0 { return; }
14015 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14019 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
14020 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
14021 /// A pointer to the contents in the success state.
14022 /// Reading from this pointer when `result_ok` is not set is undefined.
14023 pub result: *mut crate::c_types::derived::CVec_u8Z,
14024 /// A pointer to the contents in the error state.
14025 /// Reading from this pointer when `result_ok` is set is undefined.
14026 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
14029 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
14030 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
14031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14032 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
14033 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
14034 /// `err` or `result` depending on the state of `result_ok`.
14035 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
14036 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
14037 pub result_ok: bool,
14040 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
14041 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
14042 CResult_CVec_u8ZPeerHandleErrorZ {
14043 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
14044 result: Box::into_raw(Box::new(o)),
14050 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
14051 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
14052 CResult_CVec_u8ZPeerHandleErrorZ {
14053 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
14054 err: Box::into_raw(Box::new(e)),
14059 /// Checks if the given object is currently in the success state
14061 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
14065 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
14066 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
14067 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
14068 fn drop(&mut self) {
14069 if self.result_ok {
14070 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14071 let _ = unsafe { Box::from_raw(self.contents.result) };
14074 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14075 let _ = unsafe { Box::from_raw(self.contents.err) };
14080 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
14081 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
14082 let contents = if o.result_ok {
14083 let result = unsafe { o.contents.result };
14084 unsafe { o.contents.result = core::ptr::null_mut() };
14085 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
14087 let err = unsafe { o.contents.err };
14088 unsafe { o.contents.err = core::ptr::null_mut(); }
14089 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
14093 result_ok: o.result_ok,
14097 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
14098 fn clone(&self) -> Self {
14099 if self.result_ok {
14100 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
14101 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
14104 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
14105 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
14111 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
14112 /// but with all dynamically-allocated buffers duplicated in new buffers.
14113 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
14115 /// The contents of CResult_NonePeerHandleErrorZ
14116 pub union CResult_NonePeerHandleErrorZPtr {
14117 /// Note that this value is always NULL, as there are no contents in the OK variant
14118 pub result: *mut core::ffi::c_void,
14119 /// A pointer to the contents in the error state.
14120 /// Reading from this pointer when `result_ok` is set is undefined.
14121 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
14124 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
14125 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
14126 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14127 pub struct CResult_NonePeerHandleErrorZ {
14128 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
14129 /// `err` or `result` depending on the state of `result_ok`.
14130 pub contents: CResult_NonePeerHandleErrorZPtr,
14131 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
14132 pub result_ok: bool,
14135 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
14136 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
14137 CResult_NonePeerHandleErrorZ {
14138 contents: CResult_NonePeerHandleErrorZPtr {
14139 result: core::ptr::null_mut(),
14145 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
14146 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
14147 CResult_NonePeerHandleErrorZ {
14148 contents: CResult_NonePeerHandleErrorZPtr {
14149 err: Box::into_raw(Box::new(e)),
14154 /// Checks if the given object is currently in the success state
14156 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
14160 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
14161 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
14162 impl Drop for CResult_NonePeerHandleErrorZ {
14163 fn drop(&mut self) {
14164 if self.result_ok {
14166 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14167 let _ = unsafe { Box::from_raw(self.contents.err) };
14172 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
14173 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
14174 let contents = if o.result_ok {
14175 let _ = unsafe { Box::from_raw(o.contents.result) };
14176 o.contents.result = core::ptr::null_mut();
14177 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
14179 let err = unsafe { o.contents.err };
14180 unsafe { o.contents.err = core::ptr::null_mut(); }
14181 CResult_NonePeerHandleErrorZPtr { err }
14185 result_ok: o.result_ok,
14189 impl Clone for CResult_NonePeerHandleErrorZ {
14190 fn clone(&self) -> Self {
14191 if self.result_ok {
14192 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
14193 result: core::ptr::null_mut()
14196 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
14197 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
14203 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
14204 /// but with all dynamically-allocated buffers duplicated in new buffers.
14205 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
14207 /// The contents of CResult_boolPeerHandleErrorZ
14208 pub union CResult_boolPeerHandleErrorZPtr {
14209 /// A pointer to the contents in the success state.
14210 /// Reading from this pointer when `result_ok` is not set is undefined.
14211 pub result: *mut bool,
14212 /// A pointer to the contents in the error state.
14213 /// Reading from this pointer when `result_ok` is set is undefined.
14214 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
14217 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
14218 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
14219 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14220 pub struct CResult_boolPeerHandleErrorZ {
14221 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
14222 /// `err` or `result` depending on the state of `result_ok`.
14223 pub contents: CResult_boolPeerHandleErrorZPtr,
14224 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
14225 pub result_ok: bool,
14228 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
14229 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
14230 CResult_boolPeerHandleErrorZ {
14231 contents: CResult_boolPeerHandleErrorZPtr {
14232 result: Box::into_raw(Box::new(o)),
14238 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
14239 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
14240 CResult_boolPeerHandleErrorZ {
14241 contents: CResult_boolPeerHandleErrorZPtr {
14242 err: Box::into_raw(Box::new(e)),
14247 /// Checks if the given object is currently in the success state
14249 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
14253 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
14254 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
14255 impl Drop for CResult_boolPeerHandleErrorZ {
14256 fn drop(&mut self) {
14257 if self.result_ok {
14258 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14259 let _ = unsafe { Box::from_raw(self.contents.result) };
14262 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14263 let _ = unsafe { Box::from_raw(self.contents.err) };
14268 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
14269 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
14270 let contents = if o.result_ok {
14271 let result = unsafe { o.contents.result };
14272 unsafe { o.contents.result = core::ptr::null_mut() };
14273 CResult_boolPeerHandleErrorZPtr { result }
14275 let err = unsafe { o.contents.err };
14276 unsafe { o.contents.err = core::ptr::null_mut(); }
14277 CResult_boolPeerHandleErrorZPtr { err }
14281 result_ok: o.result_ok,
14285 impl Clone for CResult_boolPeerHandleErrorZ {
14286 fn clone(&self) -> Self {
14287 if self.result_ok {
14288 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
14289 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
14292 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
14293 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
14299 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
14300 /// but with all dynamically-allocated buffers duplicated in new buffers.
14301 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
14303 /// The contents of CResult_u32GraphSyncErrorZ
14304 pub union CResult_u32GraphSyncErrorZPtr {
14305 /// A pointer to the contents in the success state.
14306 /// Reading from this pointer when `result_ok` is not set is undefined.
14307 pub result: *mut u32,
14308 /// A pointer to the contents in the error state.
14309 /// Reading from this pointer when `result_ok` is set is undefined.
14310 pub err: *mut crate::lightning_rapid_gossip_sync::GraphSyncError,
14313 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
14314 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure.
14315 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14316 pub struct CResult_u32GraphSyncErrorZ {
14317 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
14318 /// `err` or `result` depending on the state of `result_ok`.
14319 pub contents: CResult_u32GraphSyncErrorZPtr,
14320 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
14321 pub result_ok: bool,
14324 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
14325 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
14326 CResult_u32GraphSyncErrorZ {
14327 contents: CResult_u32GraphSyncErrorZPtr {
14328 result: Box::into_raw(Box::new(o)),
14334 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
14335 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
14336 CResult_u32GraphSyncErrorZ {
14337 contents: CResult_u32GraphSyncErrorZPtr {
14338 err: Box::into_raw(Box::new(e)),
14343 /// Checks if the given object is currently in the success state
14345 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
14349 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
14350 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
14351 impl Drop for CResult_u32GraphSyncErrorZ {
14352 fn drop(&mut self) {
14353 if self.result_ok {
14354 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14355 let _ = unsafe { Box::from_raw(self.contents.result) };
14358 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14359 let _ = unsafe { Box::from_raw(self.contents.err) };
14364 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
14365 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>) -> Self {
14366 let contents = if o.result_ok {
14367 let result = unsafe { o.contents.result };
14368 unsafe { o.contents.result = core::ptr::null_mut() };
14369 CResult_u32GraphSyncErrorZPtr { result }
14371 let err = unsafe { o.contents.err };
14372 unsafe { o.contents.err = core::ptr::null_mut(); }
14373 CResult_u32GraphSyncErrorZPtr { err }
14377 result_ok: o.result_ok,
14382 /// The contents of CResult_CVec_u8ZIOErrorZ
14383 pub union CResult_CVec_u8ZIOErrorZPtr {
14384 /// A pointer to the contents in the success state.
14385 /// Reading from this pointer when `result_ok` is not set is undefined.
14386 pub result: *mut crate::c_types::derived::CVec_u8Z,
14387 /// A pointer to the contents in the error state.
14388 /// Reading from this pointer when `result_ok` is set is undefined.
14389 pub err: *mut crate::c_types::IOError,
14392 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
14393 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
14394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14395 pub struct CResult_CVec_u8ZIOErrorZ {
14396 /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
14397 /// `err` or `result` depending on the state of `result_ok`.
14398 pub contents: CResult_CVec_u8ZIOErrorZPtr,
14399 /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
14400 pub result_ok: bool,
14403 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
14404 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
14405 CResult_CVec_u8ZIOErrorZ {
14406 contents: CResult_CVec_u8ZIOErrorZPtr {
14407 result: Box::into_raw(Box::new(o)),
14413 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
14414 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
14415 CResult_CVec_u8ZIOErrorZ {
14416 contents: CResult_CVec_u8ZIOErrorZPtr {
14417 err: Box::into_raw(Box::new(e)),
14422 /// Checks if the given object is currently in the success state
14424 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
14428 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
14429 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
14430 impl Drop for CResult_CVec_u8ZIOErrorZ {
14431 fn drop(&mut self) {
14432 if self.result_ok {
14433 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14434 let _ = unsafe { Box::from_raw(self.contents.result) };
14437 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14438 let _ = unsafe { Box::from_raw(self.contents.err) };
14443 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
14444 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
14445 let contents = if o.result_ok {
14446 let result = unsafe { o.contents.result };
14447 unsafe { o.contents.result = core::ptr::null_mut() };
14448 CResult_CVec_u8ZIOErrorZPtr { result }
14450 let err = unsafe { o.contents.err };
14451 unsafe { o.contents.err = core::ptr::null_mut(); }
14452 CResult_CVec_u8ZIOErrorZPtr { err }
14456 result_ok: o.result_ok,
14460 impl Clone for CResult_CVec_u8ZIOErrorZ {
14461 fn clone(&self) -> Self {
14462 if self.result_ok {
14463 Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
14464 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
14467 Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
14468 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14474 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
14475 /// but with all dynamically-allocated buffers duplicated in new buffers.
14476 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
14478 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
14479 /// This corresponds to std::vector in C++
14480 pub struct CVec_StrZ {
14481 /// The elements in the array.
14482 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14483 pub data: *mut crate::c_types::Str,
14484 /// The number of elements pointed to by `data`.
14488 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
14489 if self.datalen == 0 { return Vec::new(); }
14490 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14491 self.data = core::ptr::null_mut();
14495 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
14496 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14499 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
14500 fn from(v: Vec<crate::c_types::Str>) -> Self {
14501 let datalen = v.len();
14502 let data = Box::into_raw(v.into_boxed_slice());
14503 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14507 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14508 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
14509 impl Drop for CVec_StrZ {
14510 fn drop(&mut self) {
14511 if self.datalen == 0 { return; }
14512 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14515 impl Clone for CVec_StrZ {
14516 fn clone(&self) -> Self {
14517 let mut res = Vec::new();
14518 if self.datalen == 0 { return Self::from(res); }
14519 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14524 /// The contents of CResult_CVec_StrZIOErrorZ
14525 pub union CResult_CVec_StrZIOErrorZPtr {
14526 /// A pointer to the contents in the success state.
14527 /// Reading from this pointer when `result_ok` is not set is undefined.
14528 pub result: *mut crate::c_types::derived::CVec_StrZ,
14529 /// A pointer to the contents in the error state.
14530 /// Reading from this pointer when `result_ok` is set is undefined.
14531 pub err: *mut crate::c_types::IOError,
14534 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
14535 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
14536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14537 pub struct CResult_CVec_StrZIOErrorZ {
14538 /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
14539 /// `err` or `result` depending on the state of `result_ok`.
14540 pub contents: CResult_CVec_StrZIOErrorZPtr,
14541 /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
14542 pub result_ok: bool,
14545 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
14546 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
14547 CResult_CVec_StrZIOErrorZ {
14548 contents: CResult_CVec_StrZIOErrorZPtr {
14549 result: Box::into_raw(Box::new(o)),
14555 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
14556 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
14557 CResult_CVec_StrZIOErrorZ {
14558 contents: CResult_CVec_StrZIOErrorZPtr {
14559 err: Box::into_raw(Box::new(e)),
14564 /// Checks if the given object is currently in the success state
14566 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
14570 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
14571 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
14572 impl Drop for CResult_CVec_StrZIOErrorZ {
14573 fn drop(&mut self) {
14574 if self.result_ok {
14575 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14576 let _ = unsafe { Box::from_raw(self.contents.result) };
14579 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14580 let _ = unsafe { Box::from_raw(self.contents.err) };
14585 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
14586 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
14587 let contents = if o.result_ok {
14588 let result = unsafe { o.contents.result };
14589 unsafe { o.contents.result = core::ptr::null_mut() };
14590 CResult_CVec_StrZIOErrorZPtr { result }
14592 let err = unsafe { o.contents.err };
14593 unsafe { o.contents.err = core::ptr::null_mut(); }
14594 CResult_CVec_StrZIOErrorZPtr { err }
14598 result_ok: o.result_ok,
14602 impl Clone for CResult_CVec_StrZIOErrorZ {
14603 fn clone(&self) -> Self {
14604 if self.result_ok {
14605 Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
14606 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
14609 Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
14610 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14616 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
14617 /// but with all dynamically-allocated buffers duplicated in new buffers.
14618 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
14620 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
14621 /// This corresponds to std::vector in C++
14622 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14623 /// The elements in the array.
14624 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14625 pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14626 /// The number of elements pointed to by `data`.
14629 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14630 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
14631 if self.datalen == 0 { return Vec::new(); }
14632 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14633 self.data = core::ptr::null_mut();
14637 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
14638 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14641 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14642 fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
14643 let datalen = v.len();
14644 let data = Box::into_raw(v.into_boxed_slice());
14645 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14649 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14650 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
14651 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14652 fn drop(&mut self) {
14653 if self.datalen == 0 { return; }
14654 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14657 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14658 fn clone(&self) -> Self {
14659 let mut res = Vec::new();
14660 if self.datalen == 0 { return Self::from(res); }
14661 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14666 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
14667 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
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::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
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::c_types::IOError,
14676 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
14677 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
14678 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14679 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14680 /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
14681 /// `err` or `result` depending on the state of `result_ok`.
14682 pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
14683 /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
14684 pub result_ok: bool,
14687 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
14688 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14689 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14690 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14691 result: Box::into_raw(Box::new(o)),
14697 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
14698 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14699 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14700 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
14712 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
14713 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
14714 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
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::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14728 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> 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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
14734 let err = unsafe { o.contents.err };
14735 unsafe { o.contents.err = core::ptr::null_mut(); }
14736 CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
14740 result_ok: o.result_ok,
14744 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14745 fn clone(&self) -> Self {
14746 if self.result_ok {
14747 Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14748 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
14751 Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14752 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14758 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
14759 /// but with all dynamically-allocated buffers duplicated in new buffers.
14760 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
14762 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
14763 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14764 /// A pointer to the contents in the success state.
14765 /// Reading from this pointer when `result_ok` is not set is undefined.
14766 pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14767 /// A pointer to the contents in the error state.
14768 /// Reading from this pointer when `result_ok` is set is undefined.
14769 pub err: *mut crate::c_types::IOError,
14772 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
14773 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
14774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14775 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14776 /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
14777 /// `err` or `result` depending on the state of `result_ok`.
14778 pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
14779 /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
14780 pub result_ok: bool,
14783 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
14784 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14785 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14786 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14787 result: Box::into_raw(Box::new(o)),
14793 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
14794 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14795 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14796 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14797 err: Box::into_raw(Box::new(e)),
14802 /// Checks if the given object is currently in the success state
14804 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
14808 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
14809 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
14810 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14811 fn drop(&mut self) {
14812 if self.result_ok {
14813 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14814 let _ = unsafe { Box::from_raw(self.contents.result) };
14817 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14818 let _ = unsafe { Box::from_raw(self.contents.err) };
14823 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14824 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
14825 let contents = if o.result_ok {
14826 let result = unsafe { o.contents.result };
14827 unsafe { o.contents.result = core::ptr::null_mut() };
14828 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
14830 let err = unsafe { o.contents.err };
14831 unsafe { o.contents.err = core::ptr::null_mut(); }
14832 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
14836 result_ok: o.result_ok,
14840 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14841 fn clone(&self) -> Self {
14842 if self.result_ok {
14843 Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14844 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
14847 Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14848 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14854 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
14855 /// but with all dynamically-allocated buffers duplicated in new buffers.
14856 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
14858 /// The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ
14859 pub union CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14860 /// A pointer to the contents in the success state.
14861 /// Reading from this pointer when `result_ok` is not set is undefined.
14862 pub result: *mut crate::lightning::offers::invoice_request::UnsignedInvoiceRequest,
14863 /// A pointer to the contents in the error state.
14864 /// Reading from this pointer when `result_ok` is set is undefined.
14865 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14868 /// A CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14869 /// containing a crate::lightning::offers::invoice_request::UnsignedInvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14871 pub struct CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14872 /// The contents of this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ, accessible via either
14873 /// `err` or `result` depending on the state of `result_ok`.
14874 pub contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr,
14875 /// Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state.
14876 pub result_ok: bool,
14879 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the success state.
14880 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14881 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14882 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14883 result: Box::into_raw(Box::new(o)),
14889 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the error state.
14890 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14891 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14892 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14893 err: Box::into_raw(Box::new(e)),
14898 /// Checks if the given object is currently in the success state
14900 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> bool {
14904 /// Frees any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ.
14905 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) { }
14906 impl Drop for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14907 fn drop(&mut self) {
14908 if self.result_ok {
14909 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14910 let _ = unsafe { Box::from_raw(self.contents.result) };
14913 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14914 let _ = unsafe { Box::from_raw(self.contents.err) };
14919 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14920 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14921 let contents = if o.result_ok {
14922 let result = unsafe { o.contents.result };
14923 unsafe { o.contents.result = core::ptr::null_mut() };
14924 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { result }
14926 let err = unsafe { o.contents.err };
14927 unsafe { o.contents.err = core::ptr::null_mut(); }
14928 CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { err }
14932 result_ok: o.result_ok,
14936 impl Clone for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14937 fn clone(&self) -> Self {
14938 if self.result_ok {
14939 Self { result_ok: true, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14940 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
14943 Self { result_ok: false, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14944 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
14950 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
14951 /// but with all dynamically-allocated buffers duplicated in new buffers.
14952 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) }
14954 /// The contents of CResult_InvoiceRequestBolt12SemanticErrorZ
14955 pub union CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14956 /// A pointer to the contents in the success state.
14957 /// Reading from this pointer when `result_ok` is not set is undefined.
14958 pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequest,
14959 /// A pointer to the contents in the error state.
14960 /// Reading from this pointer when `result_ok` is set is undefined.
14961 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14964 /// A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14965 /// containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14967 pub struct CResult_InvoiceRequestBolt12SemanticErrorZ {
14968 /// The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either
14969 /// `err` or `result` depending on the state of `result_ok`.
14970 pub contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr,
14971 /// Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state.
14972 pub result_ok: bool,
14975 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state.
14976 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14977 CResult_InvoiceRequestBolt12SemanticErrorZ {
14978 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14979 result: Box::into_raw(Box::new(o)),
14985 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state.
14986 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14987 CResult_InvoiceRequestBolt12SemanticErrorZ {
14988 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14989 err: Box::into_raw(Box::new(e)),
14994 /// Checks if the given object is currently in the success state
14996 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> bool {
15000 /// Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ.
15001 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestBolt12SemanticErrorZ) { }
15002 impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ {
15003 fn drop(&mut self) {
15004 if self.result_ok {
15005 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15006 let _ = unsafe { Box::from_raw(self.contents.result) };
15009 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15010 let _ = unsafe { Box::from_raw(self.contents.err) };
15015 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestBolt12SemanticErrorZ {
15016 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
15017 let contents = if o.result_ok {
15018 let result = unsafe { o.contents.result };
15019 unsafe { o.contents.result = core::ptr::null_mut() };
15020 CResult_InvoiceRequestBolt12SemanticErrorZPtr { result }
15022 let err = unsafe { o.contents.err };
15023 unsafe { o.contents.err = core::ptr::null_mut(); }
15024 CResult_InvoiceRequestBolt12SemanticErrorZPtr { err }
15028 result_ok: o.result_ok,
15032 impl Clone for CResult_InvoiceRequestBolt12SemanticErrorZ {
15033 fn clone(&self) -> Self {
15034 if self.result_ok {
15035 Self { result_ok: true, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
15036 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequest>::clone(unsafe { &*self.contents.result })))
15039 Self { result_ok: false, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
15040 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
15046 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
15047 /// but with all dynamically-allocated buffers duplicated in new buffers.
15048 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> CResult_InvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) }
15051 /// An enum which can either contain a crate::c_types::SecretKey or not
15052 pub enum COption_SecretKeyZ {
15053 /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
15054 Some(crate::c_types::SecretKey),
15055 /// When we're in this state, this COption_SecretKeyZ contains nothing
15058 impl COption_SecretKeyZ {
15059 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15060 if let Self::None = self { false } else { true }
15062 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15065 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
15066 if let Self::Some(v) = self { v } else { unreachable!() }
15070 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
15071 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
15072 COption_SecretKeyZ::Some(o)
15075 /// Constructs a new COption_SecretKeyZ containing nothing
15076 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
15077 COption_SecretKeyZ::None
15080 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
15081 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
15083 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
15084 /// but with all dynamically-allocated buffers duplicated in new buffers.
15085 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
15087 /// The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ
15088 pub union CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15089 /// A pointer to the contents in the success state.
15090 /// Reading from this pointer when `result_ok` is not set is undefined.
15091 pub result: *mut crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder,
15092 /// A pointer to the contents in the error state.
15093 /// Reading from this pointer when `result_ok` is set is undefined.
15094 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
15097 /// A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
15098 /// containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
15099 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15100 pub struct CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15101 /// The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
15102 /// `err` or `result` depending on the state of `result_ok`.
15103 pub contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr,
15104 /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
15105 pub result_ok: bool,
15108 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
15109 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15110 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15111 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15112 result: Box::into_raw(Box::new(o)),
15118 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
15119 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15120 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15121 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15122 err: Box::into_raw(Box::new(e)),
15127 /// Checks if the given object is currently in the success state
15129 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
15133 /// Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.
15134 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) { }
15135 impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15136 fn drop(&mut self) {
15137 if self.result_ok {
15138 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15139 let _ = unsafe { Box::from_raw(self.contents.result) };
15142 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15143 let _ = unsafe { Box::from_raw(self.contents.err) };
15148 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15149 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
15150 let contents = if o.result_ok {
15151 let result = unsafe { o.contents.result };
15152 unsafe { o.contents.result = core::ptr::null_mut() };
15153 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
15155 let err = unsafe { o.contents.err };
15156 unsafe { o.contents.err = core::ptr::null_mut(); }
15157 CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
15161 result_ok: o.result_ok,
15166 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
15167 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
15168 /// A pointer to the contents in the success state.
15169 /// Reading from this pointer when `result_ok` is not set is undefined.
15170 pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
15171 /// Note that this value is always NULL, as there are no contents in the Err variant
15172 pub err: *mut core::ffi::c_void,
15175 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
15176 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
15177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15178 pub struct CResult_VerifiedInvoiceRequestNoneZ {
15179 /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
15180 /// `err` or `result` depending on the state of `result_ok`.
15181 pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
15182 /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
15183 pub result_ok: bool,
15186 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
15187 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
15188 CResult_VerifiedInvoiceRequestNoneZ {
15189 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
15190 result: Box::into_raw(Box::new(o)),
15196 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
15197 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
15198 CResult_VerifiedInvoiceRequestNoneZ {
15199 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
15200 err: core::ptr::null_mut(),
15205 /// Checks if the given object is currently in the success state
15207 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
15211 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
15212 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
15213 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
15214 fn drop(&mut self) {
15215 if self.result_ok {
15216 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15217 let _ = unsafe { Box::from_raw(self.contents.result) };
15223 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
15224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
15225 let contents = if o.result_ok {
15226 let result = unsafe { o.contents.result };
15227 unsafe { o.contents.result = core::ptr::null_mut() };
15228 CResult_VerifiedInvoiceRequestNoneZPtr { result }
15230 let _ = unsafe { Box::from_raw(o.contents.err) };
15231 o.contents.err = core::ptr::null_mut();
15232 CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
15236 result_ok: o.result_ok,
15240 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
15241 fn clone(&self) -> Self {
15242 if self.result_ok {
15243 Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
15244 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
15247 Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
15248 err: core::ptr::null_mut()
15254 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
15255 /// but with all dynamically-allocated buffers duplicated in new buffers.
15256 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
15258 /// The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ
15259 pub union CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15260 /// A pointer to the contents in the success state.
15261 /// Reading from this pointer when `result_ok` is not set is undefined.
15262 pub result: *mut crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder,
15263 /// A pointer to the contents in the error state.
15264 /// Reading from this pointer when `result_ok` is set is undefined.
15265 pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
15268 /// A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
15269 /// containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
15270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15271 pub struct CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15272 /// The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
15273 /// `err` or `result` depending on the state of `result_ok`.
15274 pub contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr,
15275 /// Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
15276 pub result_ok: bool,
15279 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
15280 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15281 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15282 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15283 result: Box::into_raw(Box::new(o)),
15289 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
15290 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15291 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15292 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15293 err: Box::into_raw(Box::new(e)),
15298 /// Checks if the given object is currently in the success state
15300 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
15304 /// Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ.
15305 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) { }
15306 impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15307 fn drop(&mut self) {
15308 if self.result_ok {
15309 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15310 let _ = unsafe { Box::from_raw(self.contents.result) };
15313 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15314 let _ = unsafe { Box::from_raw(self.contents.err) };
15319 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15320 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
15321 let contents = if o.result_ok {
15322 let result = unsafe { o.contents.result };
15323 unsafe { o.contents.result = core::ptr::null_mut() };
15324 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
15326 let err = unsafe { o.contents.err };
15327 unsafe { o.contents.err = core::ptr::null_mut(); }
15328 CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
15332 result_ok: o.result_ok,
15337 /// The contents of CResult_InvoiceRequestFieldsDecodeErrorZ
15338 pub union CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15339 /// A pointer to the contents in the success state.
15340 /// Reading from this pointer when `result_ok` is not set is undefined.
15341 pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestFields,
15342 /// A pointer to the contents in the error state.
15343 /// Reading from this pointer when `result_ok` is set is undefined.
15344 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15347 /// A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation,
15348 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
15349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15350 pub struct CResult_InvoiceRequestFieldsDecodeErrorZ {
15351 /// The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either
15352 /// `err` or `result` depending on the state of `result_ok`.
15353 pub contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr,
15354 /// Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state.
15355 pub result_ok: bool,
15358 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state.
15359 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestFields) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
15360 CResult_InvoiceRequestFieldsDecodeErrorZ {
15361 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15362 result: Box::into_raw(Box::new(o)),
15368 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state.
15369 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
15370 CResult_InvoiceRequestFieldsDecodeErrorZ {
15371 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15372 err: Box::into_raw(Box::new(e)),
15377 /// Checks if the given object is currently in the success state
15379 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> bool {
15383 /// Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ.
15384 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res: CResult_InvoiceRequestFieldsDecodeErrorZ) { }
15385 impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ {
15386 fn drop(&mut self) {
15387 if self.result_ok {
15388 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15389 let _ = unsafe { Box::from_raw(self.contents.result) };
15392 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15393 let _ = unsafe { Box::from_raw(self.contents.err) };
15398 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceRequestFieldsDecodeErrorZ {
15399 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
15400 let contents = if o.result_ok {
15401 let result = unsafe { o.contents.result };
15402 unsafe { o.contents.result = core::ptr::null_mut() };
15403 CResult_InvoiceRequestFieldsDecodeErrorZPtr { result }
15405 let err = unsafe { o.contents.err };
15406 unsafe { o.contents.err = core::ptr::null_mut(); }
15407 CResult_InvoiceRequestFieldsDecodeErrorZPtr { err }
15411 result_ok: o.result_ok,
15415 impl Clone for CResult_InvoiceRequestFieldsDecodeErrorZ {
15416 fn clone(&self) -> Self {
15417 if self.result_ok {
15418 Self { result_ok: true, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15419 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequestFields>::clone(unsafe { &*self.contents.result })))
15422 Self { result_ok: false, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15423 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15429 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig`
15430 /// but with all dynamically-allocated buffers duplicated in new buffers.
15431 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> CResult_InvoiceRequestFieldsDecodeErrorZ { Clone::clone(&orig) }
15433 /// An enum which can either contain a or not
15434 pub enum COption_NoneZ {
15435 /// When we're in this state, this COption_NoneZ contains a
15437 /// When we're in this state, this COption_NoneZ contains nothing
15440 impl COption_NoneZ {
15441 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15442 if let Self::None = self { false } else { true }
15444 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15449 /// Constructs a new COption_NoneZ containing a
15450 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
15451 COption_NoneZ::Some
15454 /// Constructs a new COption_NoneZ containing nothing
15455 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
15456 COption_NoneZ::None
15459 /// Frees any resources associated with the , if we are in the Some state
15460 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
15462 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
15463 /// This corresponds to std::vector in C++
15464 pub struct CVec_WitnessZ {
15465 /// The elements in the array.
15466 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15467 pub data: *mut crate::c_types::Witness,
15468 /// The number of elements pointed to by `data`.
15471 impl CVec_WitnessZ {
15472 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
15473 if self.datalen == 0 { return Vec::new(); }
15474 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15475 self.data = core::ptr::null_mut();
15479 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
15480 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15483 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
15484 fn from(v: Vec<crate::c_types::Witness>) -> Self {
15485 let datalen = v.len();
15486 let data = Box::into_raw(v.into_boxed_slice());
15487 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15491 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15492 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
15493 impl Drop for CVec_WitnessZ {
15494 fn drop(&mut self) {
15495 if self.datalen == 0 { return; }
15496 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15499 impl Clone for CVec_WitnessZ {
15500 fn clone(&self) -> Self {
15501 let mut res = Vec::new();
15502 if self.datalen == 0 { return Self::from(res); }
15503 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15509 /// An enum which can either contain a crate::c_types::ECDSASignature or not
15510 pub enum COption_ECDSASignatureZ {
15511 /// When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature
15512 Some(crate::c_types::ECDSASignature),
15513 /// When we're in this state, this COption_ECDSASignatureZ contains nothing
15516 impl COption_ECDSASignatureZ {
15517 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15518 if let Self::None = self { false } else { true }
15520 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15523 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ECDSASignature {
15524 if let Self::Some(v) = self { v } else { unreachable!() }
15528 /// Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature
15529 pub extern "C" fn COption_ECDSASignatureZ_some(o: crate::c_types::ECDSASignature) -> COption_ECDSASignatureZ {
15530 COption_ECDSASignatureZ::Some(o)
15533 /// Constructs a new COption_ECDSASignatureZ containing nothing
15534 pub extern "C" fn COption_ECDSASignatureZ_none() -> COption_ECDSASignatureZ {
15535 COption_ECDSASignatureZ::None
15538 /// Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state
15539 pub extern "C" fn COption_ECDSASignatureZ_free(_res: COption_ECDSASignatureZ) { }
15541 /// Creates a new COption_ECDSASignatureZ which has the same data as `orig`
15542 /// but with all dynamically-allocated buffers duplicated in new buffers.
15543 pub extern "C" fn COption_ECDSASignatureZ_clone(orig: &COption_ECDSASignatureZ) -> COption_ECDSASignatureZ { Clone::clone(&orig) }
15546 /// An enum which can either contain a i64 or not
15547 pub enum COption_i64Z {
15548 /// When we're in this state, this COption_i64Z contains a i64
15550 /// When we're in this state, this COption_i64Z contains nothing
15553 impl COption_i64Z {
15554 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15555 if let Self::None = self { false } else { true }
15557 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15560 #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
15561 if let Self::Some(v) = self { v } else { unreachable!() }
15565 /// Constructs a new COption_i64Z containing a i64
15566 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
15567 COption_i64Z::Some(o)
15570 /// Constructs a new COption_i64Z containing nothing
15571 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
15575 /// Frees any resources associated with the i64, if we are in the Some state
15576 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
15578 /// Creates a new COption_i64Z which has the same data as `orig`
15579 /// but with all dynamically-allocated buffers duplicated in new buffers.
15580 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
15582 /// The contents of CResult_SocketAddressDecodeErrorZ
15583 pub union CResult_SocketAddressDecodeErrorZPtr {
15584 /// A pointer to the contents in the success state.
15585 /// Reading from this pointer when `result_ok` is not set is undefined.
15586 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15587 /// A pointer to the contents in the error state.
15588 /// Reading from this pointer when `result_ok` is set is undefined.
15589 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15592 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
15593 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
15594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15595 pub struct CResult_SocketAddressDecodeErrorZ {
15596 /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
15597 /// `err` or `result` depending on the state of `result_ok`.
15598 pub contents: CResult_SocketAddressDecodeErrorZPtr,
15599 /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
15600 pub result_ok: bool,
15603 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
15604 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
15605 CResult_SocketAddressDecodeErrorZ {
15606 contents: CResult_SocketAddressDecodeErrorZPtr {
15607 result: Box::into_raw(Box::new(o)),
15613 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
15614 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
15615 CResult_SocketAddressDecodeErrorZ {
15616 contents: CResult_SocketAddressDecodeErrorZPtr {
15617 err: Box::into_raw(Box::new(e)),
15622 /// Checks if the given object is currently in the success state
15624 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
15628 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
15629 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
15630 impl Drop for CResult_SocketAddressDecodeErrorZ {
15631 fn drop(&mut self) {
15632 if self.result_ok {
15633 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15634 let _ = unsafe { Box::from_raw(self.contents.result) };
15637 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15638 let _ = unsafe { Box::from_raw(self.contents.err) };
15643 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
15644 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
15645 let contents = if o.result_ok {
15646 let result = unsafe { o.contents.result };
15647 unsafe { o.contents.result = core::ptr::null_mut() };
15648 CResult_SocketAddressDecodeErrorZPtr { result }
15650 let err = unsafe { o.contents.err };
15651 unsafe { o.contents.err = core::ptr::null_mut(); }
15652 CResult_SocketAddressDecodeErrorZPtr { err }
15656 result_ok: o.result_ok,
15660 impl Clone for CResult_SocketAddressDecodeErrorZ {
15661 fn clone(&self) -> Self {
15662 if self.result_ok {
15663 Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
15664 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15667 Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
15668 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15674 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
15675 /// but with all dynamically-allocated buffers duplicated in new buffers.
15676 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
15678 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
15679 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
15680 /// A pointer to the contents in the success state.
15681 /// Reading from this pointer when `result_ok` is not set is undefined.
15682 pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15683 /// A pointer to the contents in the error state.
15684 /// Reading from this pointer when `result_ok` is set is undefined.
15685 pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
15688 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
15689 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
15690 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15691 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
15692 /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
15693 /// `err` or `result` depending on the state of `result_ok`.
15694 pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
15695 /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
15696 pub result_ok: bool,
15699 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
15700 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
15701 CResult_SocketAddressSocketAddressParseErrorZ {
15702 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15703 result: Box::into_raw(Box::new(o)),
15709 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
15710 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
15711 CResult_SocketAddressSocketAddressParseErrorZ {
15712 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15713 err: Box::into_raw(Box::new(e)),
15718 /// Checks if the given object is currently in the success state
15720 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
15724 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
15725 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
15726 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
15727 fn drop(&mut self) {
15728 if self.result_ok {
15729 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15730 let _ = unsafe { Box::from_raw(self.contents.result) };
15733 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15734 let _ = unsafe { Box::from_raw(self.contents.err) };
15739 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
15740 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
15741 let contents = if o.result_ok {
15742 let result = unsafe { o.contents.result };
15743 unsafe { o.contents.result = core::ptr::null_mut() };
15744 CResult_SocketAddressSocketAddressParseErrorZPtr { result }
15746 let err = unsafe { o.contents.err };
15747 unsafe { o.contents.err = core::ptr::null_mut(); }
15748 CResult_SocketAddressSocketAddressParseErrorZPtr { err }
15752 result_ok: o.result_ok,
15756 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
15757 fn clone(&self) -> Self {
15758 if self.result_ok {
15759 Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15760 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15763 Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15764 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
15770 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
15771 /// but with all dynamically-allocated buffers duplicated in new buffers.
15772 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
15774 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
15775 /// This corresponds to std::vector in C++
15776 pub struct CVec_UpdateAddHTLCZ {
15777 /// The elements in the array.
15778 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15779 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15780 /// The number of elements pointed to by `data`.
15783 impl CVec_UpdateAddHTLCZ {
15784 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
15785 if self.datalen == 0 { return Vec::new(); }
15786 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15787 self.data = core::ptr::null_mut();
15791 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
15792 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15795 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
15796 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
15797 let datalen = v.len();
15798 let data = Box::into_raw(v.into_boxed_slice());
15799 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15803 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15804 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
15805 impl Drop for CVec_UpdateAddHTLCZ {
15806 fn drop(&mut self) {
15807 if self.datalen == 0 { return; }
15808 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15811 impl Clone for CVec_UpdateAddHTLCZ {
15812 fn clone(&self) -> Self {
15813 let mut res = Vec::new();
15814 if self.datalen == 0 { return Self::from(res); }
15815 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15820 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
15821 /// This corresponds to std::vector in C++
15822 pub struct CVec_UpdateFulfillHTLCZ {
15823 /// The elements in the array.
15824 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15825 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
15826 /// The number of elements pointed to by `data`.
15829 impl CVec_UpdateFulfillHTLCZ {
15830 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
15831 if self.datalen == 0 { return Vec::new(); }
15832 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15833 self.data = core::ptr::null_mut();
15837 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
15838 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15841 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
15842 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
15843 let datalen = v.len();
15844 let data = Box::into_raw(v.into_boxed_slice());
15845 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15849 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15850 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
15851 impl Drop for CVec_UpdateFulfillHTLCZ {
15852 fn drop(&mut self) {
15853 if self.datalen == 0 { return; }
15854 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15857 impl Clone for CVec_UpdateFulfillHTLCZ {
15858 fn clone(&self) -> Self {
15859 let mut res = Vec::new();
15860 if self.datalen == 0 { return Self::from(res); }
15861 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15866 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
15867 /// This corresponds to std::vector in C++
15868 pub struct CVec_UpdateFailHTLCZ {
15869 /// The elements in the array.
15870 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15871 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15872 /// The number of elements pointed to by `data`.
15875 impl CVec_UpdateFailHTLCZ {
15876 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
15877 if self.datalen == 0 { return Vec::new(); }
15878 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15879 self.data = core::ptr::null_mut();
15883 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
15884 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15887 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
15888 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
15889 let datalen = v.len();
15890 let data = Box::into_raw(v.into_boxed_slice());
15891 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15895 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15896 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
15897 impl Drop for CVec_UpdateFailHTLCZ {
15898 fn drop(&mut self) {
15899 if self.datalen == 0 { return; }
15900 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15903 impl Clone for CVec_UpdateFailHTLCZ {
15904 fn clone(&self) -> Self {
15905 let mut res = Vec::new();
15906 if self.datalen == 0 { return Self::from(res); }
15907 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15912 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
15913 /// This corresponds to std::vector in C++
15914 pub struct CVec_UpdateFailMalformedHTLCZ {
15915 /// The elements in the array.
15916 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15917 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15918 /// The number of elements pointed to by `data`.
15921 impl CVec_UpdateFailMalformedHTLCZ {
15922 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
15923 if self.datalen == 0 { return Vec::new(); }
15924 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15925 self.data = core::ptr::null_mut();
15929 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
15930 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15933 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
15934 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
15935 let datalen = v.len();
15936 let data = Box::into_raw(v.into_boxed_slice());
15937 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15941 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15942 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
15943 impl Drop for CVec_UpdateFailMalformedHTLCZ {
15944 fn drop(&mut self) {
15945 if self.datalen == 0 { return; }
15946 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15949 impl Clone for CVec_UpdateFailMalformedHTLCZ {
15950 fn clone(&self) -> Self {
15951 let mut res = Vec::new();
15952 if self.datalen == 0 { return Self::from(res); }
15953 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15958 /// The contents of CResult_AcceptChannelDecodeErrorZ
15959 pub union CResult_AcceptChannelDecodeErrorZPtr {
15960 /// A pointer to the contents in the success state.
15961 /// Reading from this pointer when `result_ok` is not set is undefined.
15962 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
15963 /// A pointer to the contents in the error state.
15964 /// Reading from this pointer when `result_ok` is set is undefined.
15965 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15968 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
15969 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15970 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15971 pub struct CResult_AcceptChannelDecodeErrorZ {
15972 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
15973 /// `err` or `result` depending on the state of `result_ok`.
15974 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
15975 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
15976 pub result_ok: bool,
15979 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
15980 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
15981 CResult_AcceptChannelDecodeErrorZ {
15982 contents: CResult_AcceptChannelDecodeErrorZPtr {
15983 result: Box::into_raw(Box::new(o)),
15989 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
15990 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
15991 CResult_AcceptChannelDecodeErrorZ {
15992 contents: CResult_AcceptChannelDecodeErrorZPtr {
15993 err: Box::into_raw(Box::new(e)),
15998 /// Checks if the given object is currently in the success state
16000 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
16004 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
16005 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
16006 impl Drop for CResult_AcceptChannelDecodeErrorZ {
16007 fn drop(&mut self) {
16008 if self.result_ok {
16009 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16010 let _ = unsafe { Box::from_raw(self.contents.result) };
16013 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16014 let _ = unsafe { Box::from_raw(self.contents.err) };
16019 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
16020 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
16021 let contents = if o.result_ok {
16022 let result = unsafe { o.contents.result };
16023 unsafe { o.contents.result = core::ptr::null_mut() };
16024 CResult_AcceptChannelDecodeErrorZPtr { result }
16026 let err = unsafe { o.contents.err };
16027 unsafe { o.contents.err = core::ptr::null_mut(); }
16028 CResult_AcceptChannelDecodeErrorZPtr { err }
16032 result_ok: o.result_ok,
16036 impl Clone for CResult_AcceptChannelDecodeErrorZ {
16037 fn clone(&self) -> Self {
16038 if self.result_ok {
16039 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
16040 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
16043 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
16044 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16050 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
16051 /// but with all dynamically-allocated buffers duplicated in new buffers.
16052 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
16054 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
16055 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
16056 /// A pointer to the contents in the success state.
16057 /// Reading from this pointer when `result_ok` is not set is undefined.
16058 pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
16059 /// A pointer to the contents in the error state.
16060 /// Reading from this pointer when `result_ok` is set is undefined.
16061 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16064 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
16065 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
16066 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16067 pub struct CResult_AcceptChannelV2DecodeErrorZ {
16068 /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
16069 /// `err` or `result` depending on the state of `result_ok`.
16070 pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
16071 /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
16072 pub result_ok: bool,
16075 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
16076 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
16077 CResult_AcceptChannelV2DecodeErrorZ {
16078 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
16079 result: Box::into_raw(Box::new(o)),
16085 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
16086 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
16087 CResult_AcceptChannelV2DecodeErrorZ {
16088 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
16089 err: Box::into_raw(Box::new(e)),
16094 /// Checks if the given object is currently in the success state
16096 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
16100 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
16101 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
16102 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
16103 fn drop(&mut self) {
16104 if self.result_ok {
16105 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16106 let _ = unsafe { Box::from_raw(self.contents.result) };
16109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16110 let _ = unsafe { Box::from_raw(self.contents.err) };
16115 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
16116 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
16117 let contents = if o.result_ok {
16118 let result = unsafe { o.contents.result };
16119 unsafe { o.contents.result = core::ptr::null_mut() };
16120 CResult_AcceptChannelV2DecodeErrorZPtr { result }
16122 let err = unsafe { o.contents.err };
16123 unsafe { o.contents.err = core::ptr::null_mut(); }
16124 CResult_AcceptChannelV2DecodeErrorZPtr { err }
16128 result_ok: o.result_ok,
16132 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
16133 fn clone(&self) -> Self {
16134 if self.result_ok {
16135 Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
16136 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
16139 Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
16140 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16146 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
16147 /// but with all dynamically-allocated buffers duplicated in new buffers.
16148 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
16150 /// The contents of CResult_StfuDecodeErrorZ
16151 pub union CResult_StfuDecodeErrorZPtr {
16152 /// A pointer to the contents in the success state.
16153 /// Reading from this pointer when `result_ok` is not set is undefined.
16154 pub result: *mut crate::lightning::ln::msgs::Stfu,
16155 /// A pointer to the contents in the error state.
16156 /// Reading from this pointer when `result_ok` is set is undefined.
16157 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16160 /// A CResult_StfuDecodeErrorZ represents the result of a fallible operation,
16161 /// containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure.
16162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16163 pub struct CResult_StfuDecodeErrorZ {
16164 /// The contents of this CResult_StfuDecodeErrorZ, accessible via either
16165 /// `err` or `result` depending on the state of `result_ok`.
16166 pub contents: CResult_StfuDecodeErrorZPtr,
16167 /// Whether this CResult_StfuDecodeErrorZ represents a success state.
16168 pub result_ok: bool,
16171 /// Creates a new CResult_StfuDecodeErrorZ in the success state.
16172 pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ {
16173 CResult_StfuDecodeErrorZ {
16174 contents: CResult_StfuDecodeErrorZPtr {
16175 result: Box::into_raw(Box::new(o)),
16181 /// Creates a new CResult_StfuDecodeErrorZ in the error state.
16182 pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ {
16183 CResult_StfuDecodeErrorZ {
16184 contents: CResult_StfuDecodeErrorZPtr {
16185 err: Box::into_raw(Box::new(e)),
16190 /// Checks if the given object is currently in the success state
16192 pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool {
16196 /// Frees any resources used by the CResult_StfuDecodeErrorZ.
16197 pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { }
16198 impl Drop for CResult_StfuDecodeErrorZ {
16199 fn drop(&mut self) {
16200 if self.result_ok {
16201 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16202 let _ = unsafe { Box::from_raw(self.contents.result) };
16205 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16206 let _ = unsafe { Box::from_raw(self.contents.err) };
16211 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>> for CResult_StfuDecodeErrorZ {
16212 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>) -> Self {
16213 let contents = if o.result_ok {
16214 let result = unsafe { o.contents.result };
16215 unsafe { o.contents.result = core::ptr::null_mut() };
16216 CResult_StfuDecodeErrorZPtr { result }
16218 let err = unsafe { o.contents.err };
16219 unsafe { o.contents.err = core::ptr::null_mut(); }
16220 CResult_StfuDecodeErrorZPtr { err }
16224 result_ok: o.result_ok,
16228 impl Clone for CResult_StfuDecodeErrorZ {
16229 fn clone(&self) -> Self {
16230 if self.result_ok {
16231 Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr {
16232 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Stfu>::clone(unsafe { &*self.contents.result })))
16235 Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr {
16236 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16242 /// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig`
16243 /// but with all dynamically-allocated buffers duplicated in new buffers.
16244 pub extern "C" fn CResult_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) }
16246 /// The contents of CResult_SpliceDecodeErrorZ
16247 pub union CResult_SpliceDecodeErrorZPtr {
16248 /// A pointer to the contents in the success state.
16249 /// Reading from this pointer when `result_ok` is not set is undefined.
16250 pub result: *mut crate::lightning::ln::msgs::Splice,
16251 /// A pointer to the contents in the error state.
16252 /// Reading from this pointer when `result_ok` is set is undefined.
16253 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16256 /// A CResult_SpliceDecodeErrorZ represents the result of a fallible operation,
16257 /// containing a crate::lightning::ln::msgs::Splice on success and a crate::lightning::ln::msgs::DecodeError on failure.
16258 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16259 pub struct CResult_SpliceDecodeErrorZ {
16260 /// The contents of this CResult_SpliceDecodeErrorZ, accessible via either
16261 /// `err` or `result` depending on the state of `result_ok`.
16262 pub contents: CResult_SpliceDecodeErrorZPtr,
16263 /// Whether this CResult_SpliceDecodeErrorZ represents a success state.
16264 pub result_ok: bool,
16267 /// Creates a new CResult_SpliceDecodeErrorZ in the success state.
16268 pub extern "C" fn CResult_SpliceDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Splice) -> CResult_SpliceDecodeErrorZ {
16269 CResult_SpliceDecodeErrorZ {
16270 contents: CResult_SpliceDecodeErrorZPtr {
16271 result: Box::into_raw(Box::new(o)),
16277 /// Creates a new CResult_SpliceDecodeErrorZ in the error state.
16278 pub extern "C" fn CResult_SpliceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceDecodeErrorZ {
16279 CResult_SpliceDecodeErrorZ {
16280 contents: CResult_SpliceDecodeErrorZPtr {
16281 err: Box::into_raw(Box::new(e)),
16286 /// Checks if the given object is currently in the success state
16288 pub extern "C" fn CResult_SpliceDecodeErrorZ_is_ok(o: &CResult_SpliceDecodeErrorZ) -> bool {
16292 /// Frees any resources used by the CResult_SpliceDecodeErrorZ.
16293 pub extern "C" fn CResult_SpliceDecodeErrorZ_free(_res: CResult_SpliceDecodeErrorZ) { }
16294 impl Drop for CResult_SpliceDecodeErrorZ {
16295 fn drop(&mut self) {
16296 if self.result_ok {
16297 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16298 let _ = unsafe { Box::from_raw(self.contents.result) };
16301 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16302 let _ = unsafe { Box::from_raw(self.contents.err) };
16307 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceDecodeErrorZ {
16308 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>) -> Self {
16309 let contents = if o.result_ok {
16310 let result = unsafe { o.contents.result };
16311 unsafe { o.contents.result = core::ptr::null_mut() };
16312 CResult_SpliceDecodeErrorZPtr { result }
16314 let err = unsafe { o.contents.err };
16315 unsafe { o.contents.err = core::ptr::null_mut(); }
16316 CResult_SpliceDecodeErrorZPtr { err }
16320 result_ok: o.result_ok,
16324 impl Clone for CResult_SpliceDecodeErrorZ {
16325 fn clone(&self) -> Self {
16326 if self.result_ok {
16327 Self { result_ok: true, contents: CResult_SpliceDecodeErrorZPtr {
16328 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Splice>::clone(unsafe { &*self.contents.result })))
16331 Self { result_ok: false, contents: CResult_SpliceDecodeErrorZPtr {
16332 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16338 /// Creates a new CResult_SpliceDecodeErrorZ which has the same data as `orig`
16339 /// but with all dynamically-allocated buffers duplicated in new buffers.
16340 pub extern "C" fn CResult_SpliceDecodeErrorZ_clone(orig: &CResult_SpliceDecodeErrorZ) -> CResult_SpliceDecodeErrorZ { Clone::clone(&orig) }
16342 /// The contents of CResult_SpliceAckDecodeErrorZ
16343 pub union CResult_SpliceAckDecodeErrorZPtr {
16344 /// A pointer to the contents in the success state.
16345 /// Reading from this pointer when `result_ok` is not set is undefined.
16346 pub result: *mut crate::lightning::ln::msgs::SpliceAck,
16347 /// A pointer to the contents in the error state.
16348 /// Reading from this pointer when `result_ok` is set is undefined.
16349 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16352 /// A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation,
16353 /// containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure.
16354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16355 pub struct CResult_SpliceAckDecodeErrorZ {
16356 /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either
16357 /// `err` or `result` depending on the state of `result_ok`.
16358 pub contents: CResult_SpliceAckDecodeErrorZPtr,
16359 /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state.
16360 pub result_ok: bool,
16363 /// Creates a new CResult_SpliceAckDecodeErrorZ in the success state.
16364 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ {
16365 CResult_SpliceAckDecodeErrorZ {
16366 contents: CResult_SpliceAckDecodeErrorZPtr {
16367 result: Box::into_raw(Box::new(o)),
16373 /// Creates a new CResult_SpliceAckDecodeErrorZ in the error state.
16374 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ {
16375 CResult_SpliceAckDecodeErrorZ {
16376 contents: CResult_SpliceAckDecodeErrorZPtr {
16377 err: Box::into_raw(Box::new(e)),
16382 /// Checks if the given object is currently in the success state
16384 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool {
16388 /// Frees any resources used by the CResult_SpliceAckDecodeErrorZ.
16389 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { }
16390 impl Drop for CResult_SpliceAckDecodeErrorZ {
16391 fn drop(&mut self) {
16392 if self.result_ok {
16393 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16394 let _ = unsafe { Box::from_raw(self.contents.result) };
16397 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16398 let _ = unsafe { Box::from_raw(self.contents.err) };
16403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceAckDecodeErrorZ {
16404 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>) -> Self {
16405 let contents = if o.result_ok {
16406 let result = unsafe { o.contents.result };
16407 unsafe { o.contents.result = core::ptr::null_mut() };
16408 CResult_SpliceAckDecodeErrorZPtr { result }
16410 let err = unsafe { o.contents.err };
16411 unsafe { o.contents.err = core::ptr::null_mut(); }
16412 CResult_SpliceAckDecodeErrorZPtr { err }
16416 result_ok: o.result_ok,
16420 impl Clone for CResult_SpliceAckDecodeErrorZ {
16421 fn clone(&self) -> Self {
16422 if self.result_ok {
16423 Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr {
16424 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceAck>::clone(unsafe { &*self.contents.result })))
16427 Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr {
16428 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16434 /// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig`
16435 /// but with all dynamically-allocated buffers duplicated in new buffers.
16436 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) }
16438 /// The contents of CResult_SpliceLockedDecodeErrorZ
16439 pub union CResult_SpliceLockedDecodeErrorZPtr {
16440 /// A pointer to the contents in the success state.
16441 /// Reading from this pointer when `result_ok` is not set is undefined.
16442 pub result: *mut crate::lightning::ln::msgs::SpliceLocked,
16443 /// A pointer to the contents in the error state.
16444 /// Reading from this pointer when `result_ok` is set is undefined.
16445 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16448 /// A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation,
16449 /// containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
16450 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16451 pub struct CResult_SpliceLockedDecodeErrorZ {
16452 /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either
16453 /// `err` or `result` depending on the state of `result_ok`.
16454 pub contents: CResult_SpliceLockedDecodeErrorZPtr,
16455 /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state.
16456 pub result_ok: bool,
16459 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state.
16460 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ {
16461 CResult_SpliceLockedDecodeErrorZ {
16462 contents: CResult_SpliceLockedDecodeErrorZPtr {
16463 result: Box::into_raw(Box::new(o)),
16469 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state.
16470 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ {
16471 CResult_SpliceLockedDecodeErrorZ {
16472 contents: CResult_SpliceLockedDecodeErrorZPtr {
16473 err: Box::into_raw(Box::new(e)),
16478 /// Checks if the given object is currently in the success state
16480 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool {
16484 /// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ.
16485 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { }
16486 impl Drop for CResult_SpliceLockedDecodeErrorZ {
16487 fn drop(&mut self) {
16488 if self.result_ok {
16489 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16490 let _ = unsafe { Box::from_raw(self.contents.result) };
16493 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16494 let _ = unsafe { Box::from_raw(self.contents.err) };
16499 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceLockedDecodeErrorZ {
16500 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
16501 let contents = if o.result_ok {
16502 let result = unsafe { o.contents.result };
16503 unsafe { o.contents.result = core::ptr::null_mut() };
16504 CResult_SpliceLockedDecodeErrorZPtr { result }
16506 let err = unsafe { o.contents.err };
16507 unsafe { o.contents.err = core::ptr::null_mut(); }
16508 CResult_SpliceLockedDecodeErrorZPtr { err }
16512 result_ok: o.result_ok,
16516 impl Clone for CResult_SpliceLockedDecodeErrorZ {
16517 fn clone(&self) -> Self {
16518 if self.result_ok {
16519 Self { result_ok: true, contents: CResult_SpliceLockedDecodeErrorZPtr {
16520 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceLocked>::clone(unsafe { &*self.contents.result })))
16523 Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr {
16524 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16530 /// Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig`
16531 /// but with all dynamically-allocated buffers duplicated in new buffers.
16532 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) }
16534 /// The contents of CResult_TxAddInputDecodeErrorZ
16535 pub union CResult_TxAddInputDecodeErrorZPtr {
16536 /// A pointer to the contents in the success state.
16537 /// Reading from this pointer when `result_ok` is not set is undefined.
16538 pub result: *mut crate::lightning::ln::msgs::TxAddInput,
16539 /// A pointer to the contents in the error state.
16540 /// Reading from this pointer when `result_ok` is set is undefined.
16541 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16544 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
16545 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16546 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16547 pub struct CResult_TxAddInputDecodeErrorZ {
16548 /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
16549 /// `err` or `result` depending on the state of `result_ok`.
16550 pub contents: CResult_TxAddInputDecodeErrorZPtr,
16551 /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
16552 pub result_ok: bool,
16555 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
16556 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
16557 CResult_TxAddInputDecodeErrorZ {
16558 contents: CResult_TxAddInputDecodeErrorZPtr {
16559 result: Box::into_raw(Box::new(o)),
16565 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
16566 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
16567 CResult_TxAddInputDecodeErrorZ {
16568 contents: CResult_TxAddInputDecodeErrorZPtr {
16569 err: Box::into_raw(Box::new(e)),
16574 /// Checks if the given object is currently in the success state
16576 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
16580 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
16581 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
16582 impl Drop for CResult_TxAddInputDecodeErrorZ {
16583 fn drop(&mut self) {
16584 if self.result_ok {
16585 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16586 let _ = unsafe { Box::from_raw(self.contents.result) };
16589 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16590 let _ = unsafe { Box::from_raw(self.contents.err) };
16595 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
16596 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16597 let contents = if o.result_ok {
16598 let result = unsafe { o.contents.result };
16599 unsafe { o.contents.result = core::ptr::null_mut() };
16600 CResult_TxAddInputDecodeErrorZPtr { result }
16602 let err = unsafe { o.contents.err };
16603 unsafe { o.contents.err = core::ptr::null_mut(); }
16604 CResult_TxAddInputDecodeErrorZPtr { err }
16608 result_ok: o.result_ok,
16612 impl Clone for CResult_TxAddInputDecodeErrorZ {
16613 fn clone(&self) -> Self {
16614 if self.result_ok {
16615 Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
16616 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
16619 Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
16620 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16626 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
16627 /// but with all dynamically-allocated buffers duplicated in new buffers.
16628 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
16630 /// The contents of CResult_TxAddOutputDecodeErrorZ
16631 pub union CResult_TxAddOutputDecodeErrorZPtr {
16632 /// A pointer to the contents in the success state.
16633 /// Reading from this pointer when `result_ok` is not set is undefined.
16634 pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
16635 /// A pointer to the contents in the error state.
16636 /// Reading from this pointer when `result_ok` is set is undefined.
16637 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16640 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
16641 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16642 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16643 pub struct CResult_TxAddOutputDecodeErrorZ {
16644 /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
16645 /// `err` or `result` depending on the state of `result_ok`.
16646 pub contents: CResult_TxAddOutputDecodeErrorZPtr,
16647 /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
16648 pub result_ok: bool,
16651 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
16652 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
16653 CResult_TxAddOutputDecodeErrorZ {
16654 contents: CResult_TxAddOutputDecodeErrorZPtr {
16655 result: Box::into_raw(Box::new(o)),
16661 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
16662 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
16663 CResult_TxAddOutputDecodeErrorZ {
16664 contents: CResult_TxAddOutputDecodeErrorZPtr {
16665 err: Box::into_raw(Box::new(e)),
16670 /// Checks if the given object is currently in the success state
16672 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
16676 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
16677 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
16678 impl Drop for CResult_TxAddOutputDecodeErrorZ {
16679 fn drop(&mut self) {
16680 if self.result_ok {
16681 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16682 let _ = unsafe { Box::from_raw(self.contents.result) };
16685 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16686 let _ = unsafe { Box::from_raw(self.contents.err) };
16691 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
16692 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16693 let contents = if o.result_ok {
16694 let result = unsafe { o.contents.result };
16695 unsafe { o.contents.result = core::ptr::null_mut() };
16696 CResult_TxAddOutputDecodeErrorZPtr { result }
16698 let err = unsafe { o.contents.err };
16699 unsafe { o.contents.err = core::ptr::null_mut(); }
16700 CResult_TxAddOutputDecodeErrorZPtr { err }
16704 result_ok: o.result_ok,
16708 impl Clone for CResult_TxAddOutputDecodeErrorZ {
16709 fn clone(&self) -> Self {
16710 if self.result_ok {
16711 Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
16712 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
16715 Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
16716 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16722 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
16723 /// but with all dynamically-allocated buffers duplicated in new buffers.
16724 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
16726 /// The contents of CResult_TxRemoveInputDecodeErrorZ
16727 pub union CResult_TxRemoveInputDecodeErrorZPtr {
16728 /// A pointer to the contents in the success state.
16729 /// Reading from this pointer when `result_ok` is not set is undefined.
16730 pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
16731 /// A pointer to the contents in the error state.
16732 /// Reading from this pointer when `result_ok` is set is undefined.
16733 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16736 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
16737 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16738 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16739 pub struct CResult_TxRemoveInputDecodeErrorZ {
16740 /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
16741 /// `err` or `result` depending on the state of `result_ok`.
16742 pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
16743 /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
16744 pub result_ok: bool,
16747 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
16748 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
16749 CResult_TxRemoveInputDecodeErrorZ {
16750 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16751 result: Box::into_raw(Box::new(o)),
16757 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
16758 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
16759 CResult_TxRemoveInputDecodeErrorZ {
16760 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16761 err: Box::into_raw(Box::new(e)),
16766 /// Checks if the given object is currently in the success state
16768 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
16772 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
16773 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
16774 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
16775 fn drop(&mut self) {
16776 if self.result_ok {
16777 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16778 let _ = unsafe { Box::from_raw(self.contents.result) };
16781 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16782 let _ = unsafe { Box::from_raw(self.contents.err) };
16787 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
16788 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16789 let contents = if o.result_ok {
16790 let result = unsafe { o.contents.result };
16791 unsafe { o.contents.result = core::ptr::null_mut() };
16792 CResult_TxRemoveInputDecodeErrorZPtr { result }
16794 let err = unsafe { o.contents.err };
16795 unsafe { o.contents.err = core::ptr::null_mut(); }
16796 CResult_TxRemoveInputDecodeErrorZPtr { err }
16800 result_ok: o.result_ok,
16804 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
16805 fn clone(&self) -> Self {
16806 if self.result_ok {
16807 Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16808 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
16811 Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16812 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16818 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
16819 /// but with all dynamically-allocated buffers duplicated in new buffers.
16820 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
16822 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
16823 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
16824 /// A pointer to the contents in the success state.
16825 /// Reading from this pointer when `result_ok` is not set is undefined.
16826 pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
16827 /// A pointer to the contents in the error state.
16828 /// Reading from this pointer when `result_ok` is set is undefined.
16829 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16832 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
16833 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16834 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16835 pub struct CResult_TxRemoveOutputDecodeErrorZ {
16836 /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
16837 /// `err` or `result` depending on the state of `result_ok`.
16838 pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
16839 /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
16840 pub result_ok: bool,
16843 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
16844 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
16845 CResult_TxRemoveOutputDecodeErrorZ {
16846 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16847 result: Box::into_raw(Box::new(o)),
16853 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
16854 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
16855 CResult_TxRemoveOutputDecodeErrorZ {
16856 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16857 err: Box::into_raw(Box::new(e)),
16862 /// Checks if the given object is currently in the success state
16864 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
16868 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
16869 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
16870 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
16871 fn drop(&mut self) {
16872 if self.result_ok {
16873 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16874 let _ = unsafe { Box::from_raw(self.contents.result) };
16877 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16878 let _ = unsafe { Box::from_raw(self.contents.err) };
16883 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
16884 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16885 let contents = if o.result_ok {
16886 let result = unsafe { o.contents.result };
16887 unsafe { o.contents.result = core::ptr::null_mut() };
16888 CResult_TxRemoveOutputDecodeErrorZPtr { result }
16890 let err = unsafe { o.contents.err };
16891 unsafe { o.contents.err = core::ptr::null_mut(); }
16892 CResult_TxRemoveOutputDecodeErrorZPtr { err }
16896 result_ok: o.result_ok,
16900 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
16901 fn clone(&self) -> Self {
16902 if self.result_ok {
16903 Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16904 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
16907 Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16908 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16914 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
16915 /// but with all dynamically-allocated buffers duplicated in new buffers.
16916 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
16918 /// The contents of CResult_TxCompleteDecodeErrorZ
16919 pub union CResult_TxCompleteDecodeErrorZPtr {
16920 /// A pointer to the contents in the success state.
16921 /// Reading from this pointer when `result_ok` is not set is undefined.
16922 pub result: *mut crate::lightning::ln::msgs::TxComplete,
16923 /// A pointer to the contents in the error state.
16924 /// Reading from this pointer when `result_ok` is set is undefined.
16925 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16928 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
16929 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
16930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16931 pub struct CResult_TxCompleteDecodeErrorZ {
16932 /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
16933 /// `err` or `result` depending on the state of `result_ok`.
16934 pub contents: CResult_TxCompleteDecodeErrorZPtr,
16935 /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
16936 pub result_ok: bool,
16939 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
16940 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
16941 CResult_TxCompleteDecodeErrorZ {
16942 contents: CResult_TxCompleteDecodeErrorZPtr {
16943 result: Box::into_raw(Box::new(o)),
16949 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
16950 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
16951 CResult_TxCompleteDecodeErrorZ {
16952 contents: CResult_TxCompleteDecodeErrorZPtr {
16953 err: Box::into_raw(Box::new(e)),
16958 /// Checks if the given object is currently in the success state
16960 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
16964 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
16965 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
16966 impl Drop for CResult_TxCompleteDecodeErrorZ {
16967 fn drop(&mut self) {
16968 if self.result_ok {
16969 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16970 let _ = unsafe { Box::from_raw(self.contents.result) };
16973 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16974 let _ = unsafe { Box::from_raw(self.contents.err) };
16979 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
16980 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
16981 let contents = if o.result_ok {
16982 let result = unsafe { o.contents.result };
16983 unsafe { o.contents.result = core::ptr::null_mut() };
16984 CResult_TxCompleteDecodeErrorZPtr { result }
16986 let err = unsafe { o.contents.err };
16987 unsafe { o.contents.err = core::ptr::null_mut(); }
16988 CResult_TxCompleteDecodeErrorZPtr { err }
16992 result_ok: o.result_ok,
16996 impl Clone for CResult_TxCompleteDecodeErrorZ {
16997 fn clone(&self) -> Self {
16998 if self.result_ok {
16999 Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
17000 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
17003 Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
17004 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17010 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
17011 /// but with all dynamically-allocated buffers duplicated in new buffers.
17012 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
17014 /// The contents of CResult_TxSignaturesDecodeErrorZ
17015 pub union CResult_TxSignaturesDecodeErrorZPtr {
17016 /// A pointer to the contents in the success state.
17017 /// Reading from this pointer when `result_ok` is not set is undefined.
17018 pub result: *mut crate::lightning::ln::msgs::TxSignatures,
17019 /// A pointer to the contents in the error state.
17020 /// Reading from this pointer when `result_ok` is set is undefined.
17021 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17024 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
17025 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
17026 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17027 pub struct CResult_TxSignaturesDecodeErrorZ {
17028 /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
17029 /// `err` or `result` depending on the state of `result_ok`.
17030 pub contents: CResult_TxSignaturesDecodeErrorZPtr,
17031 /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
17032 pub result_ok: bool,
17035 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
17036 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
17037 CResult_TxSignaturesDecodeErrorZ {
17038 contents: CResult_TxSignaturesDecodeErrorZPtr {
17039 result: Box::into_raw(Box::new(o)),
17045 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
17046 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
17047 CResult_TxSignaturesDecodeErrorZ {
17048 contents: CResult_TxSignaturesDecodeErrorZPtr {
17049 err: Box::into_raw(Box::new(e)),
17054 /// Checks if the given object is currently in the success state
17056 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
17060 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
17061 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
17062 impl Drop for CResult_TxSignaturesDecodeErrorZ {
17063 fn drop(&mut self) {
17064 if self.result_ok {
17065 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17066 let _ = unsafe { Box::from_raw(self.contents.result) };
17069 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17070 let _ = unsafe { Box::from_raw(self.contents.err) };
17075 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
17076 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
17077 let contents = if o.result_ok {
17078 let result = unsafe { o.contents.result };
17079 unsafe { o.contents.result = core::ptr::null_mut() };
17080 CResult_TxSignaturesDecodeErrorZPtr { result }
17082 let err = unsafe { o.contents.err };
17083 unsafe { o.contents.err = core::ptr::null_mut(); }
17084 CResult_TxSignaturesDecodeErrorZPtr { err }
17088 result_ok: o.result_ok,
17092 impl Clone for CResult_TxSignaturesDecodeErrorZ {
17093 fn clone(&self) -> Self {
17094 if self.result_ok {
17095 Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
17096 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
17099 Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
17100 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17106 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
17107 /// but with all dynamically-allocated buffers duplicated in new buffers.
17108 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
17110 /// The contents of CResult_TxInitRbfDecodeErrorZ
17111 pub union CResult_TxInitRbfDecodeErrorZPtr {
17112 /// A pointer to the contents in the success state.
17113 /// Reading from this pointer when `result_ok` is not set is undefined.
17114 pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
17115 /// A pointer to the contents in the error state.
17116 /// Reading from this pointer when `result_ok` is set is undefined.
17117 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17120 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
17121 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
17122 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17123 pub struct CResult_TxInitRbfDecodeErrorZ {
17124 /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
17125 /// `err` or `result` depending on the state of `result_ok`.
17126 pub contents: CResult_TxInitRbfDecodeErrorZPtr,
17127 /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
17128 pub result_ok: bool,
17131 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
17132 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
17133 CResult_TxInitRbfDecodeErrorZ {
17134 contents: CResult_TxInitRbfDecodeErrorZPtr {
17135 result: Box::into_raw(Box::new(o)),
17141 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
17142 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
17143 CResult_TxInitRbfDecodeErrorZ {
17144 contents: CResult_TxInitRbfDecodeErrorZPtr {
17145 err: Box::into_raw(Box::new(e)),
17150 /// Checks if the given object is currently in the success state
17152 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
17156 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
17157 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
17158 impl Drop for CResult_TxInitRbfDecodeErrorZ {
17159 fn drop(&mut self) {
17160 if self.result_ok {
17161 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17162 let _ = unsafe { Box::from_raw(self.contents.result) };
17165 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17166 let _ = unsafe { Box::from_raw(self.contents.err) };
17171 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
17172 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
17173 let contents = if o.result_ok {
17174 let result = unsafe { o.contents.result };
17175 unsafe { o.contents.result = core::ptr::null_mut() };
17176 CResult_TxInitRbfDecodeErrorZPtr { result }
17178 let err = unsafe { o.contents.err };
17179 unsafe { o.contents.err = core::ptr::null_mut(); }
17180 CResult_TxInitRbfDecodeErrorZPtr { err }
17184 result_ok: o.result_ok,
17188 impl Clone for CResult_TxInitRbfDecodeErrorZ {
17189 fn clone(&self) -> Self {
17190 if self.result_ok {
17191 Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
17192 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
17195 Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
17196 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17202 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
17203 /// but with all dynamically-allocated buffers duplicated in new buffers.
17204 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
17206 /// The contents of CResult_TxAckRbfDecodeErrorZ
17207 pub union CResult_TxAckRbfDecodeErrorZPtr {
17208 /// A pointer to the contents in the success state.
17209 /// Reading from this pointer when `result_ok` is not set is undefined.
17210 pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
17211 /// A pointer to the contents in the error state.
17212 /// Reading from this pointer when `result_ok` is set is undefined.
17213 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17216 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
17217 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
17218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17219 pub struct CResult_TxAckRbfDecodeErrorZ {
17220 /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
17221 /// `err` or `result` depending on the state of `result_ok`.
17222 pub contents: CResult_TxAckRbfDecodeErrorZPtr,
17223 /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
17224 pub result_ok: bool,
17227 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
17228 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
17229 CResult_TxAckRbfDecodeErrorZ {
17230 contents: CResult_TxAckRbfDecodeErrorZPtr {
17231 result: Box::into_raw(Box::new(o)),
17237 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
17238 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
17239 CResult_TxAckRbfDecodeErrorZ {
17240 contents: CResult_TxAckRbfDecodeErrorZPtr {
17241 err: Box::into_raw(Box::new(e)),
17246 /// Checks if the given object is currently in the success state
17248 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
17252 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
17253 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
17254 impl Drop for CResult_TxAckRbfDecodeErrorZ {
17255 fn drop(&mut self) {
17256 if self.result_ok {
17257 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17258 let _ = unsafe { Box::from_raw(self.contents.result) };
17261 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17262 let _ = unsafe { Box::from_raw(self.contents.err) };
17267 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
17268 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
17269 let contents = if o.result_ok {
17270 let result = unsafe { o.contents.result };
17271 unsafe { o.contents.result = core::ptr::null_mut() };
17272 CResult_TxAckRbfDecodeErrorZPtr { result }
17274 let err = unsafe { o.contents.err };
17275 unsafe { o.contents.err = core::ptr::null_mut(); }
17276 CResult_TxAckRbfDecodeErrorZPtr { err }
17280 result_ok: o.result_ok,
17284 impl Clone for CResult_TxAckRbfDecodeErrorZ {
17285 fn clone(&self) -> Self {
17286 if self.result_ok {
17287 Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
17288 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
17291 Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
17292 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17298 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
17299 /// but with all dynamically-allocated buffers duplicated in new buffers.
17300 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
17302 /// The contents of CResult_TxAbortDecodeErrorZ
17303 pub union CResult_TxAbortDecodeErrorZPtr {
17304 /// A pointer to the contents in the success state.
17305 /// Reading from this pointer when `result_ok` is not set is undefined.
17306 pub result: *mut crate::lightning::ln::msgs::TxAbort,
17307 /// A pointer to the contents in the error state.
17308 /// Reading from this pointer when `result_ok` is set is undefined.
17309 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17312 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
17313 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
17314 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17315 pub struct CResult_TxAbortDecodeErrorZ {
17316 /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
17317 /// `err` or `result` depending on the state of `result_ok`.
17318 pub contents: CResult_TxAbortDecodeErrorZPtr,
17319 /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
17320 pub result_ok: bool,
17323 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
17324 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
17325 CResult_TxAbortDecodeErrorZ {
17326 contents: CResult_TxAbortDecodeErrorZPtr {
17327 result: Box::into_raw(Box::new(o)),
17333 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
17334 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
17335 CResult_TxAbortDecodeErrorZ {
17336 contents: CResult_TxAbortDecodeErrorZPtr {
17337 err: Box::into_raw(Box::new(e)),
17342 /// Checks if the given object is currently in the success state
17344 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
17348 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
17349 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
17350 impl Drop for CResult_TxAbortDecodeErrorZ {
17351 fn drop(&mut self) {
17352 if self.result_ok {
17353 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17354 let _ = unsafe { Box::from_raw(self.contents.result) };
17357 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17358 let _ = unsafe { Box::from_raw(self.contents.err) };
17363 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
17364 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
17365 let contents = if o.result_ok {
17366 let result = unsafe { o.contents.result };
17367 unsafe { o.contents.result = core::ptr::null_mut() };
17368 CResult_TxAbortDecodeErrorZPtr { result }
17370 let err = unsafe { o.contents.err };
17371 unsafe { o.contents.err = core::ptr::null_mut(); }
17372 CResult_TxAbortDecodeErrorZPtr { err }
17376 result_ok: o.result_ok,
17380 impl Clone for CResult_TxAbortDecodeErrorZ {
17381 fn clone(&self) -> Self {
17382 if self.result_ok {
17383 Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
17384 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
17387 Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
17388 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17394 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
17395 /// but with all dynamically-allocated buffers duplicated in new buffers.
17396 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
17398 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
17399 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
17400 /// A pointer to the contents in the success state.
17401 /// Reading from this pointer when `result_ok` is not set is undefined.
17402 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
17403 /// A pointer to the contents in the error state.
17404 /// Reading from this pointer when `result_ok` is set is undefined.
17405 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17408 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
17409 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
17410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17411 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
17412 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
17413 /// `err` or `result` depending on the state of `result_ok`.
17414 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
17415 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
17416 pub result_ok: bool,
17419 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
17420 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17421 CResult_AnnouncementSignaturesDecodeErrorZ {
17422 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17423 result: Box::into_raw(Box::new(o)),
17429 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
17430 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17431 CResult_AnnouncementSignaturesDecodeErrorZ {
17432 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17433 err: Box::into_raw(Box::new(e)),
17438 /// Checks if the given object is currently in the success state
17440 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
17444 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
17445 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
17446 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
17447 fn drop(&mut self) {
17448 if self.result_ok {
17449 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17450 let _ = unsafe { Box::from_raw(self.contents.result) };
17453 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17454 let _ = unsafe { Box::from_raw(self.contents.err) };
17459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
17460 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
17461 let contents = if o.result_ok {
17462 let result = unsafe { o.contents.result };
17463 unsafe { o.contents.result = core::ptr::null_mut() };
17464 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
17466 let err = unsafe { o.contents.err };
17467 unsafe { o.contents.err = core::ptr::null_mut(); }
17468 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
17472 result_ok: o.result_ok,
17476 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
17477 fn clone(&self) -> Self {
17478 if self.result_ok {
17479 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17480 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
17483 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17484 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17490 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
17491 /// but with all dynamically-allocated buffers duplicated in new buffers.
17492 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
17494 /// The contents of CResult_ChannelReestablishDecodeErrorZ
17495 pub union CResult_ChannelReestablishDecodeErrorZPtr {
17496 /// A pointer to the contents in the success state.
17497 /// Reading from this pointer when `result_ok` is not set is undefined.
17498 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
17499 /// A pointer to the contents in the error state.
17500 /// Reading from this pointer when `result_ok` is set is undefined.
17501 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17504 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
17505 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
17506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17507 pub struct CResult_ChannelReestablishDecodeErrorZ {
17508 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
17509 /// `err` or `result` depending on the state of `result_ok`.
17510 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
17511 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
17512 pub result_ok: bool,
17515 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
17516 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
17517 CResult_ChannelReestablishDecodeErrorZ {
17518 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17519 result: Box::into_raw(Box::new(o)),
17525 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
17526 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
17527 CResult_ChannelReestablishDecodeErrorZ {
17528 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17529 err: Box::into_raw(Box::new(e)),
17534 /// Checks if the given object is currently in the success state
17536 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
17540 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
17541 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
17542 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
17543 fn drop(&mut self) {
17544 if self.result_ok {
17545 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17546 let _ = unsafe { Box::from_raw(self.contents.result) };
17549 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17550 let _ = unsafe { Box::from_raw(self.contents.err) };
17555 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
17556 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
17557 let contents = if o.result_ok {
17558 let result = unsafe { o.contents.result };
17559 unsafe { o.contents.result = core::ptr::null_mut() };
17560 CResult_ChannelReestablishDecodeErrorZPtr { result }
17562 let err = unsafe { o.contents.err };
17563 unsafe { o.contents.err = core::ptr::null_mut(); }
17564 CResult_ChannelReestablishDecodeErrorZPtr { err }
17568 result_ok: o.result_ok,
17572 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
17573 fn clone(&self) -> Self {
17574 if self.result_ok {
17575 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17576 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
17579 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17580 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17586 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
17587 /// but with all dynamically-allocated buffers duplicated in new buffers.
17588 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
17590 /// The contents of CResult_ClosingSignedDecodeErrorZ
17591 pub union CResult_ClosingSignedDecodeErrorZPtr {
17592 /// A pointer to the contents in the success state.
17593 /// Reading from this pointer when `result_ok` is not set is undefined.
17594 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
17595 /// A pointer to the contents in the error state.
17596 /// Reading from this pointer when `result_ok` is set is undefined.
17597 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17600 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
17601 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17603 pub struct CResult_ClosingSignedDecodeErrorZ {
17604 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
17605 /// `err` or `result` depending on the state of `result_ok`.
17606 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
17607 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
17608 pub result_ok: bool,
17611 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
17612 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
17613 CResult_ClosingSignedDecodeErrorZ {
17614 contents: CResult_ClosingSignedDecodeErrorZPtr {
17615 result: Box::into_raw(Box::new(o)),
17621 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
17622 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
17623 CResult_ClosingSignedDecodeErrorZ {
17624 contents: CResult_ClosingSignedDecodeErrorZPtr {
17625 err: Box::into_raw(Box::new(e)),
17630 /// Checks if the given object is currently in the success state
17632 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
17636 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
17637 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
17638 impl Drop for CResult_ClosingSignedDecodeErrorZ {
17639 fn drop(&mut self) {
17640 if self.result_ok {
17641 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17642 let _ = unsafe { Box::from_raw(self.contents.result) };
17645 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17646 let _ = unsafe { Box::from_raw(self.contents.err) };
17651 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
17652 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17653 let contents = if o.result_ok {
17654 let result = unsafe { o.contents.result };
17655 unsafe { o.contents.result = core::ptr::null_mut() };
17656 CResult_ClosingSignedDecodeErrorZPtr { result }
17658 let err = unsafe { o.contents.err };
17659 unsafe { o.contents.err = core::ptr::null_mut(); }
17660 CResult_ClosingSignedDecodeErrorZPtr { err }
17664 result_ok: o.result_ok,
17668 impl Clone for CResult_ClosingSignedDecodeErrorZ {
17669 fn clone(&self) -> Self {
17670 if self.result_ok {
17671 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
17672 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
17675 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
17676 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17682 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
17683 /// but with all dynamically-allocated buffers duplicated in new buffers.
17684 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
17686 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
17687 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17688 /// A pointer to the contents in the success state.
17689 /// Reading from this pointer when `result_ok` is not set is undefined.
17690 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
17691 /// A pointer to the contents in the error state.
17692 /// Reading from this pointer when `result_ok` is set is undefined.
17693 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17696 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
17697 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17698 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17699 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
17700 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
17701 /// `err` or `result` depending on the state of `result_ok`.
17702 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
17703 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
17704 pub result_ok: bool,
17707 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
17708 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17709 CResult_ClosingSignedFeeRangeDecodeErrorZ {
17710 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17711 result: Box::into_raw(Box::new(o)),
17717 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
17718 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17719 CResult_ClosingSignedFeeRangeDecodeErrorZ {
17720 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17721 err: Box::into_raw(Box::new(e)),
17726 /// Checks if the given object is currently in the success state
17728 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
17732 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
17733 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
17734 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17735 fn drop(&mut self) {
17736 if self.result_ok {
17737 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17738 let _ = unsafe { Box::from_raw(self.contents.result) };
17741 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17742 let _ = unsafe { Box::from_raw(self.contents.err) };
17747 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17748 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17749 let contents = if o.result_ok {
17750 let result = unsafe { o.contents.result };
17751 unsafe { o.contents.result = core::ptr::null_mut() };
17752 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
17754 let err = unsafe { o.contents.err };
17755 unsafe { o.contents.err = core::ptr::null_mut(); }
17756 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
17760 result_ok: o.result_ok,
17764 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17765 fn clone(&self) -> Self {
17766 if self.result_ok {
17767 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17768 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
17771 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17772 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17778 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
17779 /// but with all dynamically-allocated buffers duplicated in new buffers.
17780 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
17782 /// The contents of CResult_CommitmentSignedDecodeErrorZ
17783 pub union CResult_CommitmentSignedDecodeErrorZPtr {
17784 /// A pointer to the contents in the success state.
17785 /// Reading from this pointer when `result_ok` is not set is undefined.
17786 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
17787 /// A pointer to the contents in the error state.
17788 /// Reading from this pointer when `result_ok` is set is undefined.
17789 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17792 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
17793 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17795 pub struct CResult_CommitmentSignedDecodeErrorZ {
17796 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
17797 /// `err` or `result` depending on the state of `result_ok`.
17798 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
17799 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
17800 pub result_ok: bool,
17803 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
17804 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
17805 CResult_CommitmentSignedDecodeErrorZ {
17806 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17807 result: Box::into_raw(Box::new(o)),
17813 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
17814 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
17815 CResult_CommitmentSignedDecodeErrorZ {
17816 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17817 err: Box::into_raw(Box::new(e)),
17822 /// Checks if the given object is currently in the success state
17824 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
17828 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
17829 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
17830 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
17831 fn drop(&mut self) {
17832 if self.result_ok {
17833 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17834 let _ = unsafe { Box::from_raw(self.contents.result) };
17837 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17838 let _ = unsafe { Box::from_raw(self.contents.err) };
17843 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
17844 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17845 let contents = if o.result_ok {
17846 let result = unsafe { o.contents.result };
17847 unsafe { o.contents.result = core::ptr::null_mut() };
17848 CResult_CommitmentSignedDecodeErrorZPtr { result }
17850 let err = unsafe { o.contents.err };
17851 unsafe { o.contents.err = core::ptr::null_mut(); }
17852 CResult_CommitmentSignedDecodeErrorZPtr { err }
17856 result_ok: o.result_ok,
17860 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
17861 fn clone(&self) -> Self {
17862 if self.result_ok {
17863 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17864 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
17867 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17868 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17874 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
17875 /// but with all dynamically-allocated buffers duplicated in new buffers.
17876 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
17878 /// The contents of CResult_FundingCreatedDecodeErrorZ
17879 pub union CResult_FundingCreatedDecodeErrorZPtr {
17880 /// A pointer to the contents in the success state.
17881 /// Reading from this pointer when `result_ok` is not set is undefined.
17882 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
17883 /// A pointer to the contents in the error state.
17884 /// Reading from this pointer when `result_ok` is set is undefined.
17885 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17888 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
17889 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
17890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17891 pub struct CResult_FundingCreatedDecodeErrorZ {
17892 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
17893 /// `err` or `result` depending on the state of `result_ok`.
17894 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
17895 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
17896 pub result_ok: bool,
17899 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
17900 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
17901 CResult_FundingCreatedDecodeErrorZ {
17902 contents: CResult_FundingCreatedDecodeErrorZPtr {
17903 result: Box::into_raw(Box::new(o)),
17909 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
17910 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
17911 CResult_FundingCreatedDecodeErrorZ {
17912 contents: CResult_FundingCreatedDecodeErrorZPtr {
17913 err: Box::into_raw(Box::new(e)),
17918 /// Checks if the given object is currently in the success state
17920 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
17924 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
17925 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
17926 impl Drop for CResult_FundingCreatedDecodeErrorZ {
17927 fn drop(&mut self) {
17928 if self.result_ok {
17929 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17930 let _ = unsafe { Box::from_raw(self.contents.result) };
17933 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17934 let _ = unsafe { Box::from_raw(self.contents.err) };
17939 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
17940 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
17941 let contents = if o.result_ok {
17942 let result = unsafe { o.contents.result };
17943 unsafe { o.contents.result = core::ptr::null_mut() };
17944 CResult_FundingCreatedDecodeErrorZPtr { result }
17946 let err = unsafe { o.contents.err };
17947 unsafe { o.contents.err = core::ptr::null_mut(); }
17948 CResult_FundingCreatedDecodeErrorZPtr { err }
17952 result_ok: o.result_ok,
17956 impl Clone for CResult_FundingCreatedDecodeErrorZ {
17957 fn clone(&self) -> Self {
17958 if self.result_ok {
17959 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
17960 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
17963 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
17964 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17970 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
17971 /// but with all dynamically-allocated buffers duplicated in new buffers.
17972 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
17974 /// The contents of CResult_FundingSignedDecodeErrorZ
17975 pub union CResult_FundingSignedDecodeErrorZPtr {
17976 /// A pointer to the contents in the success state.
17977 /// Reading from this pointer when `result_ok` is not set is undefined.
17978 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
17979 /// A pointer to the contents in the error state.
17980 /// Reading from this pointer when `result_ok` is set is undefined.
17981 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17984 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
17985 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17986 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17987 pub struct CResult_FundingSignedDecodeErrorZ {
17988 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
17989 /// `err` or `result` depending on the state of `result_ok`.
17990 pub contents: CResult_FundingSignedDecodeErrorZPtr,
17991 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
17992 pub result_ok: bool,
17995 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
17996 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
17997 CResult_FundingSignedDecodeErrorZ {
17998 contents: CResult_FundingSignedDecodeErrorZPtr {
17999 result: Box::into_raw(Box::new(o)),
18005 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
18006 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
18007 CResult_FundingSignedDecodeErrorZ {
18008 contents: CResult_FundingSignedDecodeErrorZPtr {
18009 err: Box::into_raw(Box::new(e)),
18014 /// Checks if the given object is currently in the success state
18016 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
18020 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
18021 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
18022 impl Drop for CResult_FundingSignedDecodeErrorZ {
18023 fn drop(&mut self) {
18024 if self.result_ok {
18025 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18026 let _ = unsafe { Box::from_raw(self.contents.result) };
18029 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18030 let _ = unsafe { Box::from_raw(self.contents.err) };
18035 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
18036 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
18037 let contents = if o.result_ok {
18038 let result = unsafe { o.contents.result };
18039 unsafe { o.contents.result = core::ptr::null_mut() };
18040 CResult_FundingSignedDecodeErrorZPtr { result }
18042 let err = unsafe { o.contents.err };
18043 unsafe { o.contents.err = core::ptr::null_mut(); }
18044 CResult_FundingSignedDecodeErrorZPtr { err }
18048 result_ok: o.result_ok,
18052 impl Clone for CResult_FundingSignedDecodeErrorZ {
18053 fn clone(&self) -> Self {
18054 if self.result_ok {
18055 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
18056 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
18059 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
18060 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18066 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
18067 /// but with all dynamically-allocated buffers duplicated in new buffers.
18068 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
18070 /// The contents of CResult_ChannelReadyDecodeErrorZ
18071 pub union CResult_ChannelReadyDecodeErrorZPtr {
18072 /// A pointer to the contents in the success state.
18073 /// Reading from this pointer when `result_ok` is not set is undefined.
18074 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
18075 /// A pointer to the contents in the error state.
18076 /// Reading from this pointer when `result_ok` is set is undefined.
18077 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18080 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
18081 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
18082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18083 pub struct CResult_ChannelReadyDecodeErrorZ {
18084 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
18085 /// `err` or `result` depending on the state of `result_ok`.
18086 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
18087 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
18088 pub result_ok: bool,
18091 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
18092 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
18093 CResult_ChannelReadyDecodeErrorZ {
18094 contents: CResult_ChannelReadyDecodeErrorZPtr {
18095 result: Box::into_raw(Box::new(o)),
18101 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
18102 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
18103 CResult_ChannelReadyDecodeErrorZ {
18104 contents: CResult_ChannelReadyDecodeErrorZPtr {
18105 err: Box::into_raw(Box::new(e)),
18110 /// Checks if the given object is currently in the success state
18112 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
18116 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
18117 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
18118 impl Drop for CResult_ChannelReadyDecodeErrorZ {
18119 fn drop(&mut self) {
18120 if self.result_ok {
18121 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18122 let _ = unsafe { Box::from_raw(self.contents.result) };
18125 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18126 let _ = unsafe { Box::from_raw(self.contents.err) };
18131 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
18132 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
18133 let contents = if o.result_ok {
18134 let result = unsafe { o.contents.result };
18135 unsafe { o.contents.result = core::ptr::null_mut() };
18136 CResult_ChannelReadyDecodeErrorZPtr { result }
18138 let err = unsafe { o.contents.err };
18139 unsafe { o.contents.err = core::ptr::null_mut(); }
18140 CResult_ChannelReadyDecodeErrorZPtr { err }
18144 result_ok: o.result_ok,
18148 impl Clone for CResult_ChannelReadyDecodeErrorZ {
18149 fn clone(&self) -> Self {
18150 if self.result_ok {
18151 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
18152 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
18155 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
18156 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18162 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
18163 /// but with all dynamically-allocated buffers duplicated in new buffers.
18164 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
18166 /// The contents of CResult_InitDecodeErrorZ
18167 pub union CResult_InitDecodeErrorZPtr {
18168 /// A pointer to the contents in the success state.
18169 /// Reading from this pointer when `result_ok` is not set is undefined.
18170 pub result: *mut crate::lightning::ln::msgs::Init,
18171 /// A pointer to the contents in the error state.
18172 /// Reading from this pointer when `result_ok` is set is undefined.
18173 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18176 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
18177 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
18178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18179 pub struct CResult_InitDecodeErrorZ {
18180 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
18181 /// `err` or `result` depending on the state of `result_ok`.
18182 pub contents: CResult_InitDecodeErrorZPtr,
18183 /// Whether this CResult_InitDecodeErrorZ represents a success state.
18184 pub result_ok: bool,
18187 /// Creates a new CResult_InitDecodeErrorZ in the success state.
18188 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
18189 CResult_InitDecodeErrorZ {
18190 contents: CResult_InitDecodeErrorZPtr {
18191 result: Box::into_raw(Box::new(o)),
18197 /// Creates a new CResult_InitDecodeErrorZ in the error state.
18198 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
18199 CResult_InitDecodeErrorZ {
18200 contents: CResult_InitDecodeErrorZPtr {
18201 err: Box::into_raw(Box::new(e)),
18206 /// Checks if the given object is currently in the success state
18208 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
18212 /// Frees any resources used by the CResult_InitDecodeErrorZ.
18213 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
18214 impl Drop for CResult_InitDecodeErrorZ {
18215 fn drop(&mut self) {
18216 if self.result_ok {
18217 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18218 let _ = unsafe { Box::from_raw(self.contents.result) };
18221 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18222 let _ = unsafe { Box::from_raw(self.contents.err) };
18227 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
18228 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
18229 let contents = if o.result_ok {
18230 let result = unsafe { o.contents.result };
18231 unsafe { o.contents.result = core::ptr::null_mut() };
18232 CResult_InitDecodeErrorZPtr { result }
18234 let err = unsafe { o.contents.err };
18235 unsafe { o.contents.err = core::ptr::null_mut(); }
18236 CResult_InitDecodeErrorZPtr { err }
18240 result_ok: o.result_ok,
18244 impl Clone for CResult_InitDecodeErrorZ {
18245 fn clone(&self) -> Self {
18246 if self.result_ok {
18247 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
18248 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
18251 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
18252 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18258 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
18259 /// but with all dynamically-allocated buffers duplicated in new buffers.
18260 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
18262 /// The contents of CResult_OpenChannelDecodeErrorZ
18263 pub union CResult_OpenChannelDecodeErrorZPtr {
18264 /// A pointer to the contents in the success state.
18265 /// Reading from this pointer when `result_ok` is not set is undefined.
18266 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
18267 /// A pointer to the contents in the error state.
18268 /// Reading from this pointer when `result_ok` is set is undefined.
18269 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18272 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
18273 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
18274 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18275 pub struct CResult_OpenChannelDecodeErrorZ {
18276 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
18277 /// `err` or `result` depending on the state of `result_ok`.
18278 pub contents: CResult_OpenChannelDecodeErrorZPtr,
18279 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
18280 pub result_ok: bool,
18283 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
18284 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
18285 CResult_OpenChannelDecodeErrorZ {
18286 contents: CResult_OpenChannelDecodeErrorZPtr {
18287 result: Box::into_raw(Box::new(o)),
18293 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
18294 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
18295 CResult_OpenChannelDecodeErrorZ {
18296 contents: CResult_OpenChannelDecodeErrorZPtr {
18297 err: Box::into_raw(Box::new(e)),
18302 /// Checks if the given object is currently in the success state
18304 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
18308 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
18309 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
18310 impl Drop for CResult_OpenChannelDecodeErrorZ {
18311 fn drop(&mut self) {
18312 if self.result_ok {
18313 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18314 let _ = unsafe { Box::from_raw(self.contents.result) };
18317 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18318 let _ = unsafe { Box::from_raw(self.contents.err) };
18323 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
18324 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
18325 let contents = if o.result_ok {
18326 let result = unsafe { o.contents.result };
18327 unsafe { o.contents.result = core::ptr::null_mut() };
18328 CResult_OpenChannelDecodeErrorZPtr { result }
18330 let err = unsafe { o.contents.err };
18331 unsafe { o.contents.err = core::ptr::null_mut(); }
18332 CResult_OpenChannelDecodeErrorZPtr { err }
18336 result_ok: o.result_ok,
18340 impl Clone for CResult_OpenChannelDecodeErrorZ {
18341 fn clone(&self) -> Self {
18342 if self.result_ok {
18343 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
18344 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
18347 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
18348 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18354 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
18355 /// but with all dynamically-allocated buffers duplicated in new buffers.
18356 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
18358 /// The contents of CResult_OpenChannelV2DecodeErrorZ
18359 pub union CResult_OpenChannelV2DecodeErrorZPtr {
18360 /// A pointer to the contents in the success state.
18361 /// Reading from this pointer when `result_ok` is not set is undefined.
18362 pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
18363 /// A pointer to the contents in the error state.
18364 /// Reading from this pointer when `result_ok` is set is undefined.
18365 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18368 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
18369 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
18370 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18371 pub struct CResult_OpenChannelV2DecodeErrorZ {
18372 /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
18373 /// `err` or `result` depending on the state of `result_ok`.
18374 pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
18375 /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
18376 pub result_ok: bool,
18379 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
18380 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
18381 CResult_OpenChannelV2DecodeErrorZ {
18382 contents: CResult_OpenChannelV2DecodeErrorZPtr {
18383 result: Box::into_raw(Box::new(o)),
18389 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
18390 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
18391 CResult_OpenChannelV2DecodeErrorZ {
18392 contents: CResult_OpenChannelV2DecodeErrorZPtr {
18393 err: Box::into_raw(Box::new(e)),
18398 /// Checks if the given object is currently in the success state
18400 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
18404 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
18405 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
18406 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
18407 fn drop(&mut self) {
18408 if self.result_ok {
18409 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18410 let _ = unsafe { Box::from_raw(self.contents.result) };
18413 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18414 let _ = unsafe { Box::from_raw(self.contents.err) };
18419 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
18420 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
18421 let contents = if o.result_ok {
18422 let result = unsafe { o.contents.result };
18423 unsafe { o.contents.result = core::ptr::null_mut() };
18424 CResult_OpenChannelV2DecodeErrorZPtr { result }
18426 let err = unsafe { o.contents.err };
18427 unsafe { o.contents.err = core::ptr::null_mut(); }
18428 CResult_OpenChannelV2DecodeErrorZPtr { err }
18432 result_ok: o.result_ok,
18436 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
18437 fn clone(&self) -> Self {
18438 if self.result_ok {
18439 Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18440 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
18443 Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18444 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18450 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
18451 /// but with all dynamically-allocated buffers duplicated in new buffers.
18452 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
18454 /// The contents of CResult_RevokeAndACKDecodeErrorZ
18455 pub union CResult_RevokeAndACKDecodeErrorZPtr {
18456 /// A pointer to the contents in the success state.
18457 /// Reading from this pointer when `result_ok` is not set is undefined.
18458 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
18459 /// A pointer to the contents in the error state.
18460 /// Reading from this pointer when `result_ok` is set is undefined.
18461 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18464 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
18465 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
18466 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18467 pub struct CResult_RevokeAndACKDecodeErrorZ {
18468 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
18469 /// `err` or `result` depending on the state of `result_ok`.
18470 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
18471 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
18472 pub result_ok: bool,
18475 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
18476 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
18477 CResult_RevokeAndACKDecodeErrorZ {
18478 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18479 result: Box::into_raw(Box::new(o)),
18485 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
18486 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
18487 CResult_RevokeAndACKDecodeErrorZ {
18488 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18489 err: Box::into_raw(Box::new(e)),
18494 /// Checks if the given object is currently in the success state
18496 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
18500 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
18501 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
18502 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
18503 fn drop(&mut self) {
18504 if self.result_ok {
18505 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18506 let _ = unsafe { Box::from_raw(self.contents.result) };
18509 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18510 let _ = unsafe { Box::from_raw(self.contents.err) };
18515 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
18516 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
18517 let contents = if o.result_ok {
18518 let result = unsafe { o.contents.result };
18519 unsafe { o.contents.result = core::ptr::null_mut() };
18520 CResult_RevokeAndACKDecodeErrorZPtr { result }
18522 let err = unsafe { o.contents.err };
18523 unsafe { o.contents.err = core::ptr::null_mut(); }
18524 CResult_RevokeAndACKDecodeErrorZPtr { err }
18528 result_ok: o.result_ok,
18532 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
18533 fn clone(&self) -> Self {
18534 if self.result_ok {
18535 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18536 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
18539 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18540 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18546 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
18547 /// but with all dynamically-allocated buffers duplicated in new buffers.
18548 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
18550 /// The contents of CResult_ShutdownDecodeErrorZ
18551 pub union CResult_ShutdownDecodeErrorZPtr {
18552 /// A pointer to the contents in the success state.
18553 /// Reading from this pointer when `result_ok` is not set is undefined.
18554 pub result: *mut crate::lightning::ln::msgs::Shutdown,
18555 /// A pointer to the contents in the error state.
18556 /// Reading from this pointer when `result_ok` is set is undefined.
18557 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18560 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
18561 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
18562 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18563 pub struct CResult_ShutdownDecodeErrorZ {
18564 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
18565 /// `err` or `result` depending on the state of `result_ok`.
18566 pub contents: CResult_ShutdownDecodeErrorZPtr,
18567 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
18568 pub result_ok: bool,
18571 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
18572 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
18573 CResult_ShutdownDecodeErrorZ {
18574 contents: CResult_ShutdownDecodeErrorZPtr {
18575 result: Box::into_raw(Box::new(o)),
18581 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
18582 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
18583 CResult_ShutdownDecodeErrorZ {
18584 contents: CResult_ShutdownDecodeErrorZPtr {
18585 err: Box::into_raw(Box::new(e)),
18590 /// Checks if the given object is currently in the success state
18592 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
18596 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
18597 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
18598 impl Drop for CResult_ShutdownDecodeErrorZ {
18599 fn drop(&mut self) {
18600 if self.result_ok {
18601 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18602 let _ = unsafe { Box::from_raw(self.contents.result) };
18605 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18606 let _ = unsafe { Box::from_raw(self.contents.err) };
18611 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
18612 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
18613 let contents = if o.result_ok {
18614 let result = unsafe { o.contents.result };
18615 unsafe { o.contents.result = core::ptr::null_mut() };
18616 CResult_ShutdownDecodeErrorZPtr { result }
18618 let err = unsafe { o.contents.err };
18619 unsafe { o.contents.err = core::ptr::null_mut(); }
18620 CResult_ShutdownDecodeErrorZPtr { err }
18624 result_ok: o.result_ok,
18628 impl Clone for CResult_ShutdownDecodeErrorZ {
18629 fn clone(&self) -> Self {
18630 if self.result_ok {
18631 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
18632 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
18635 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
18636 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18642 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
18643 /// but with all dynamically-allocated buffers duplicated in new buffers.
18644 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
18646 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
18647 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
18648 /// A pointer to the contents in the success state.
18649 /// Reading from this pointer when `result_ok` is not set is undefined.
18650 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
18651 /// A pointer to the contents in the error state.
18652 /// Reading from this pointer when `result_ok` is set is undefined.
18653 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18656 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
18657 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18658 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18659 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
18660 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
18661 /// `err` or `result` depending on the state of `result_ok`.
18662 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
18663 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
18664 pub result_ok: bool,
18667 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
18668 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
18669 CResult_UpdateFailHTLCDecodeErrorZ {
18670 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18671 result: Box::into_raw(Box::new(o)),
18677 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
18678 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
18679 CResult_UpdateFailHTLCDecodeErrorZ {
18680 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18681 err: Box::into_raw(Box::new(e)),
18686 /// Checks if the given object is currently in the success state
18688 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
18692 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
18693 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
18694 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
18695 fn drop(&mut self) {
18696 if self.result_ok {
18697 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18698 let _ = unsafe { Box::from_raw(self.contents.result) };
18701 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18702 let _ = unsafe { Box::from_raw(self.contents.err) };
18707 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
18708 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18709 let contents = if o.result_ok {
18710 let result = unsafe { o.contents.result };
18711 unsafe { o.contents.result = core::ptr::null_mut() };
18712 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
18714 let err = unsafe { o.contents.err };
18715 unsafe { o.contents.err = core::ptr::null_mut(); }
18716 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
18720 result_ok: o.result_ok,
18724 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
18725 fn clone(&self) -> Self {
18726 if self.result_ok {
18727 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18728 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
18731 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18732 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18738 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
18739 /// but with all dynamically-allocated buffers duplicated in new buffers.
18740 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
18742 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
18743 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18744 /// A pointer to the contents in the success state.
18745 /// Reading from this pointer when `result_ok` is not set is undefined.
18746 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
18747 /// A pointer to the contents in the error state.
18748 /// Reading from this pointer when `result_ok` is set is undefined.
18749 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18752 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
18753 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18754 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18755 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18756 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
18757 /// `err` or `result` depending on the state of `result_ok`.
18758 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
18759 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
18760 pub result_ok: bool,
18763 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
18764 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18765 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18766 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18767 result: Box::into_raw(Box::new(o)),
18773 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
18774 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18775 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18776 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18777 err: Box::into_raw(Box::new(e)),
18782 /// Checks if the given object is currently in the success state
18784 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
18788 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
18789 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
18790 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18791 fn drop(&mut self) {
18792 if self.result_ok {
18793 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18794 let _ = unsafe { Box::from_raw(self.contents.result) };
18797 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18798 let _ = unsafe { Box::from_raw(self.contents.err) };
18803 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18804 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18805 let contents = if o.result_ok {
18806 let result = unsafe { o.contents.result };
18807 unsafe { o.contents.result = core::ptr::null_mut() };
18808 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
18810 let err = unsafe { o.contents.err };
18811 unsafe { o.contents.err = core::ptr::null_mut(); }
18812 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
18816 result_ok: o.result_ok,
18820 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18821 fn clone(&self) -> Self {
18822 if self.result_ok {
18823 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18824 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
18827 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18828 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18834 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
18835 /// but with all dynamically-allocated buffers duplicated in new buffers.
18836 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
18838 /// The contents of CResult_UpdateFeeDecodeErrorZ
18839 pub union CResult_UpdateFeeDecodeErrorZPtr {
18840 /// A pointer to the contents in the success state.
18841 /// Reading from this pointer when `result_ok` is not set is undefined.
18842 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
18843 /// A pointer to the contents in the error state.
18844 /// Reading from this pointer when `result_ok` is set is undefined.
18845 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18848 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
18849 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
18850 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18851 pub struct CResult_UpdateFeeDecodeErrorZ {
18852 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
18853 /// `err` or `result` depending on the state of `result_ok`.
18854 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
18855 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
18856 pub result_ok: bool,
18859 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
18860 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
18861 CResult_UpdateFeeDecodeErrorZ {
18862 contents: CResult_UpdateFeeDecodeErrorZPtr {
18863 result: Box::into_raw(Box::new(o)),
18869 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
18870 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
18871 CResult_UpdateFeeDecodeErrorZ {
18872 contents: CResult_UpdateFeeDecodeErrorZPtr {
18873 err: Box::into_raw(Box::new(e)),
18878 /// Checks if the given object is currently in the success state
18880 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
18884 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
18885 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
18886 impl Drop for CResult_UpdateFeeDecodeErrorZ {
18887 fn drop(&mut self) {
18888 if self.result_ok {
18889 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18890 let _ = unsafe { Box::from_raw(self.contents.result) };
18893 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18894 let _ = unsafe { Box::from_raw(self.contents.err) };
18899 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
18900 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
18901 let contents = if o.result_ok {
18902 let result = unsafe { o.contents.result };
18903 unsafe { o.contents.result = core::ptr::null_mut() };
18904 CResult_UpdateFeeDecodeErrorZPtr { result }
18906 let err = unsafe { o.contents.err };
18907 unsafe { o.contents.err = core::ptr::null_mut(); }
18908 CResult_UpdateFeeDecodeErrorZPtr { err }
18912 result_ok: o.result_ok,
18916 impl Clone for CResult_UpdateFeeDecodeErrorZ {
18917 fn clone(&self) -> Self {
18918 if self.result_ok {
18919 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
18920 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
18923 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
18924 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18930 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
18931 /// but with all dynamically-allocated buffers duplicated in new buffers.
18932 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
18934 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
18935 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18936 /// A pointer to the contents in the success state.
18937 /// Reading from this pointer when `result_ok` is not set is undefined.
18938 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
18939 /// A pointer to the contents in the error state.
18940 /// Reading from this pointer when `result_ok` is set is undefined.
18941 pub err: *mut crate::lightning::ln::msgs::DecodeError,
18944 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
18945 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18946 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18947 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
18948 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
18949 /// `err` or `result` depending on the state of `result_ok`.
18950 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
18951 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
18952 pub result_ok: bool,
18955 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
18956 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18957 CResult_UpdateFulfillHTLCDecodeErrorZ {
18958 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18959 result: Box::into_raw(Box::new(o)),
18965 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
18966 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18967 CResult_UpdateFulfillHTLCDecodeErrorZ {
18968 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18969 err: Box::into_raw(Box::new(e)),
18974 /// Checks if the given object is currently in the success state
18976 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
18980 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
18981 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
18982 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
18983 fn drop(&mut self) {
18984 if self.result_ok {
18985 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18986 let _ = unsafe { Box::from_raw(self.contents.result) };
18989 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18990 let _ = unsafe { Box::from_raw(self.contents.err) };
18995 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
18996 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18997 let contents = if o.result_ok {
18998 let result = unsafe { o.contents.result };
18999 unsafe { o.contents.result = core::ptr::null_mut() };
19000 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
19002 let err = unsafe { o.contents.err };
19003 unsafe { o.contents.err = core::ptr::null_mut(); }
19004 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
19008 result_ok: o.result_ok,
19012 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
19013 fn clone(&self) -> Self {
19014 if self.result_ok {
19015 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
19016 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
19019 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
19020 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19026 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
19027 /// but with all dynamically-allocated buffers duplicated in new buffers.
19028 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
19030 /// The contents of CResult_OnionPacketDecodeErrorZ
19031 pub union CResult_OnionPacketDecodeErrorZPtr {
19032 /// A pointer to the contents in the success state.
19033 /// Reading from this pointer when `result_ok` is not set is undefined.
19034 pub result: *mut crate::lightning::ln::msgs::OnionPacket,
19035 /// A pointer to the contents in the error state.
19036 /// Reading from this pointer when `result_ok` is set is undefined.
19037 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19040 /// A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation,
19041 /// containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure.
19042 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19043 pub struct CResult_OnionPacketDecodeErrorZ {
19044 /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either
19045 /// `err` or `result` depending on the state of `result_ok`.
19046 pub contents: CResult_OnionPacketDecodeErrorZPtr,
19047 /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state.
19048 pub result_ok: bool,
19051 /// Creates a new CResult_OnionPacketDecodeErrorZ in the success state.
19052 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ {
19053 CResult_OnionPacketDecodeErrorZ {
19054 contents: CResult_OnionPacketDecodeErrorZPtr {
19055 result: Box::into_raw(Box::new(o)),
19061 /// Creates a new CResult_OnionPacketDecodeErrorZ in the error state.
19062 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ {
19063 CResult_OnionPacketDecodeErrorZ {
19064 contents: CResult_OnionPacketDecodeErrorZPtr {
19065 err: Box::into_raw(Box::new(e)),
19070 /// Checks if the given object is currently in the success state
19072 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool {
19076 /// Frees any resources used by the CResult_OnionPacketDecodeErrorZ.
19077 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { }
19078 impl Drop for CResult_OnionPacketDecodeErrorZ {
19079 fn drop(&mut self) {
19080 if self.result_ok {
19081 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19082 let _ = unsafe { Box::from_raw(self.contents.result) };
19085 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19086 let _ = unsafe { Box::from_raw(self.contents.err) };
19091 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionPacketDecodeErrorZ {
19092 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>) -> Self {
19093 let contents = if o.result_ok {
19094 let result = unsafe { o.contents.result };
19095 unsafe { o.contents.result = core::ptr::null_mut() };
19096 CResult_OnionPacketDecodeErrorZPtr { result }
19098 let err = unsafe { o.contents.err };
19099 unsafe { o.contents.err = core::ptr::null_mut(); }
19100 CResult_OnionPacketDecodeErrorZPtr { err }
19104 result_ok: o.result_ok,
19108 impl Clone for CResult_OnionPacketDecodeErrorZ {
19109 fn clone(&self) -> Self {
19110 if self.result_ok {
19111 Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr {
19112 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionPacket>::clone(unsafe { &*self.contents.result })))
19115 Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr {
19116 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19122 /// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig`
19123 /// but with all dynamically-allocated buffers duplicated in new buffers.
19124 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) }
19126 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
19127 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
19128 /// A pointer to the contents in the success state.
19129 /// Reading from this pointer when `result_ok` is not set is undefined.
19130 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
19131 /// A pointer to the contents in the error state.
19132 /// Reading from this pointer when `result_ok` is set is undefined.
19133 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19136 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
19137 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
19138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19139 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
19140 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
19141 /// `err` or `result` depending on the state of `result_ok`.
19142 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
19143 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
19144 pub result_ok: bool,
19147 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
19148 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
19149 CResult_UpdateAddHTLCDecodeErrorZ {
19150 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
19151 result: Box::into_raw(Box::new(o)),
19157 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
19158 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
19159 CResult_UpdateAddHTLCDecodeErrorZ {
19160 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
19161 err: Box::into_raw(Box::new(e)),
19166 /// Checks if the given object is currently in the success state
19168 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
19172 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
19173 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
19174 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
19175 fn drop(&mut self) {
19176 if self.result_ok {
19177 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19178 let _ = unsafe { Box::from_raw(self.contents.result) };
19181 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19182 let _ = unsafe { Box::from_raw(self.contents.err) };
19187 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
19188 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
19189 let contents = if o.result_ok {
19190 let result = unsafe { o.contents.result };
19191 unsafe { o.contents.result = core::ptr::null_mut() };
19192 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
19194 let err = unsafe { o.contents.err };
19195 unsafe { o.contents.err = core::ptr::null_mut(); }
19196 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
19200 result_ok: o.result_ok,
19204 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
19205 fn clone(&self) -> Self {
19206 if self.result_ok {
19207 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
19208 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
19211 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
19212 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19218 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
19219 /// but with all dynamically-allocated buffers duplicated in new buffers.
19220 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
19222 /// The contents of CResult_OnionMessageDecodeErrorZ
19223 pub union CResult_OnionMessageDecodeErrorZPtr {
19224 /// A pointer to the contents in the success state.
19225 /// Reading from this pointer when `result_ok` is not set is undefined.
19226 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
19227 /// A pointer to the contents in the error state.
19228 /// Reading from this pointer when `result_ok` is set is undefined.
19229 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19232 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
19233 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19234 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19235 pub struct CResult_OnionMessageDecodeErrorZ {
19236 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
19237 /// `err` or `result` depending on the state of `result_ok`.
19238 pub contents: CResult_OnionMessageDecodeErrorZPtr,
19239 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
19240 pub result_ok: bool,
19243 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
19244 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
19245 CResult_OnionMessageDecodeErrorZ {
19246 contents: CResult_OnionMessageDecodeErrorZPtr {
19247 result: Box::into_raw(Box::new(o)),
19253 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
19254 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
19255 CResult_OnionMessageDecodeErrorZ {
19256 contents: CResult_OnionMessageDecodeErrorZPtr {
19257 err: Box::into_raw(Box::new(e)),
19262 /// Checks if the given object is currently in the success state
19264 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
19268 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
19269 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
19270 impl Drop for CResult_OnionMessageDecodeErrorZ {
19271 fn drop(&mut self) {
19272 if self.result_ok {
19273 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19274 let _ = unsafe { Box::from_raw(self.contents.result) };
19277 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19278 let _ = unsafe { Box::from_raw(self.contents.err) };
19283 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
19284 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19285 let contents = if o.result_ok {
19286 let result = unsafe { o.contents.result };
19287 unsafe { o.contents.result = core::ptr::null_mut() };
19288 CResult_OnionMessageDecodeErrorZPtr { result }
19290 let err = unsafe { o.contents.err };
19291 unsafe { o.contents.err = core::ptr::null_mut(); }
19292 CResult_OnionMessageDecodeErrorZPtr { err }
19296 result_ok: o.result_ok,
19300 impl Clone for CResult_OnionMessageDecodeErrorZ {
19301 fn clone(&self) -> Self {
19302 if self.result_ok {
19303 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
19304 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
19307 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
19308 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19314 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
19315 /// but with all dynamically-allocated buffers duplicated in new buffers.
19316 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
19318 /// The contents of CResult_FinalOnionHopDataDecodeErrorZ
19319 pub union CResult_FinalOnionHopDataDecodeErrorZPtr {
19320 /// A pointer to the contents in the success state.
19321 /// Reading from this pointer when `result_ok` is not set is undefined.
19322 pub result: *mut crate::lightning::ln::msgs::FinalOnionHopData,
19323 /// A pointer to the contents in the error state.
19324 /// Reading from this pointer when `result_ok` is set is undefined.
19325 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19328 /// A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation,
19329 /// containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure.
19330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19331 pub struct CResult_FinalOnionHopDataDecodeErrorZ {
19332 /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either
19333 /// `err` or `result` depending on the state of `result_ok`.
19334 pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr,
19335 /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state.
19336 pub result_ok: bool,
19339 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state.
19340 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ {
19341 CResult_FinalOnionHopDataDecodeErrorZ {
19342 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19343 result: Box::into_raw(Box::new(o)),
19349 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state.
19350 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ {
19351 CResult_FinalOnionHopDataDecodeErrorZ {
19352 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19353 err: Box::into_raw(Box::new(e)),
19358 /// Checks if the given object is currently in the success state
19360 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool {
19364 /// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ.
19365 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { }
19366 impl Drop for CResult_FinalOnionHopDataDecodeErrorZ {
19367 fn drop(&mut self) {
19368 if self.result_ok {
19369 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19370 let _ = unsafe { Box::from_raw(self.contents.result) };
19373 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19374 let _ = unsafe { Box::from_raw(self.contents.err) };
19379 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>> for CResult_FinalOnionHopDataDecodeErrorZ {
19380 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>) -> Self {
19381 let contents = if o.result_ok {
19382 let result = unsafe { o.contents.result };
19383 unsafe { o.contents.result = core::ptr::null_mut() };
19384 CResult_FinalOnionHopDataDecodeErrorZPtr { result }
19386 let err = unsafe { o.contents.err };
19387 unsafe { o.contents.err = core::ptr::null_mut(); }
19388 CResult_FinalOnionHopDataDecodeErrorZPtr { err }
19392 result_ok: o.result_ok,
19396 impl Clone for CResult_FinalOnionHopDataDecodeErrorZ {
19397 fn clone(&self) -> Self {
19398 if self.result_ok {
19399 Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19400 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FinalOnionHopData>::clone(unsafe { &*self.contents.result })))
19403 Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19404 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19410 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig`
19411 /// but with all dynamically-allocated buffers duplicated in new buffers.
19412 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) }
19414 /// The contents of CResult_PingDecodeErrorZ
19415 pub union CResult_PingDecodeErrorZPtr {
19416 /// A pointer to the contents in the success state.
19417 /// Reading from this pointer when `result_ok` is not set is undefined.
19418 pub result: *mut crate::lightning::ln::msgs::Ping,
19419 /// A pointer to the contents in the error state.
19420 /// Reading from this pointer when `result_ok` is set is undefined.
19421 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19424 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
19425 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
19426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19427 pub struct CResult_PingDecodeErrorZ {
19428 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
19429 /// `err` or `result` depending on the state of `result_ok`.
19430 pub contents: CResult_PingDecodeErrorZPtr,
19431 /// Whether this CResult_PingDecodeErrorZ represents a success state.
19432 pub result_ok: bool,
19435 /// Creates a new CResult_PingDecodeErrorZ in the success state.
19436 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
19437 CResult_PingDecodeErrorZ {
19438 contents: CResult_PingDecodeErrorZPtr {
19439 result: Box::into_raw(Box::new(o)),
19445 /// Creates a new CResult_PingDecodeErrorZ in the error state.
19446 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
19447 CResult_PingDecodeErrorZ {
19448 contents: CResult_PingDecodeErrorZPtr {
19449 err: Box::into_raw(Box::new(e)),
19454 /// Checks if the given object is currently in the success state
19456 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
19460 /// Frees any resources used by the CResult_PingDecodeErrorZ.
19461 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
19462 impl Drop for CResult_PingDecodeErrorZ {
19463 fn drop(&mut self) {
19464 if self.result_ok {
19465 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19466 let _ = unsafe { Box::from_raw(self.contents.result) };
19469 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19470 let _ = unsafe { Box::from_raw(self.contents.err) };
19475 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
19476 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
19477 let contents = if o.result_ok {
19478 let result = unsafe { o.contents.result };
19479 unsafe { o.contents.result = core::ptr::null_mut() };
19480 CResult_PingDecodeErrorZPtr { result }
19482 let err = unsafe { o.contents.err };
19483 unsafe { o.contents.err = core::ptr::null_mut(); }
19484 CResult_PingDecodeErrorZPtr { err }
19488 result_ok: o.result_ok,
19492 impl Clone for CResult_PingDecodeErrorZ {
19493 fn clone(&self) -> Self {
19494 if self.result_ok {
19495 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
19496 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
19499 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
19500 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19506 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
19507 /// but with all dynamically-allocated buffers duplicated in new buffers.
19508 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
19510 /// The contents of CResult_PongDecodeErrorZ
19511 pub union CResult_PongDecodeErrorZPtr {
19512 /// A pointer to the contents in the success state.
19513 /// Reading from this pointer when `result_ok` is not set is undefined.
19514 pub result: *mut crate::lightning::ln::msgs::Pong,
19515 /// A pointer to the contents in the error state.
19516 /// Reading from this pointer when `result_ok` is set is undefined.
19517 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19520 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
19521 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
19522 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19523 pub struct CResult_PongDecodeErrorZ {
19524 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
19525 /// `err` or `result` depending on the state of `result_ok`.
19526 pub contents: CResult_PongDecodeErrorZPtr,
19527 /// Whether this CResult_PongDecodeErrorZ represents a success state.
19528 pub result_ok: bool,
19531 /// Creates a new CResult_PongDecodeErrorZ in the success state.
19532 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
19533 CResult_PongDecodeErrorZ {
19534 contents: CResult_PongDecodeErrorZPtr {
19535 result: Box::into_raw(Box::new(o)),
19541 /// Creates a new CResult_PongDecodeErrorZ in the error state.
19542 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
19543 CResult_PongDecodeErrorZ {
19544 contents: CResult_PongDecodeErrorZPtr {
19545 err: Box::into_raw(Box::new(e)),
19550 /// Checks if the given object is currently in the success state
19552 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
19556 /// Frees any resources used by the CResult_PongDecodeErrorZ.
19557 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
19558 impl Drop for CResult_PongDecodeErrorZ {
19559 fn drop(&mut self) {
19560 if self.result_ok {
19561 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19562 let _ = unsafe { Box::from_raw(self.contents.result) };
19565 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19566 let _ = unsafe { Box::from_raw(self.contents.err) };
19571 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
19572 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
19573 let contents = if o.result_ok {
19574 let result = unsafe { o.contents.result };
19575 unsafe { o.contents.result = core::ptr::null_mut() };
19576 CResult_PongDecodeErrorZPtr { result }
19578 let err = unsafe { o.contents.err };
19579 unsafe { o.contents.err = core::ptr::null_mut(); }
19580 CResult_PongDecodeErrorZPtr { err }
19584 result_ok: o.result_ok,
19588 impl Clone for CResult_PongDecodeErrorZ {
19589 fn clone(&self) -> Self {
19590 if self.result_ok {
19591 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
19592 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
19595 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
19596 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19602 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
19603 /// but with all dynamically-allocated buffers duplicated in new buffers.
19604 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
19606 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
19607 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19608 /// A pointer to the contents in the success state.
19609 /// Reading from this pointer when `result_ok` is not set is undefined.
19610 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
19611 /// A pointer to the contents in the error state.
19612 /// Reading from this pointer when `result_ok` is set is undefined.
19613 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19616 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19617 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19619 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19620 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
19621 /// `err` or `result` depending on the state of `result_ok`.
19622 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
19623 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
19624 pub result_ok: bool,
19627 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
19628 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19629 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19630 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19631 result: Box::into_raw(Box::new(o)),
19637 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
19638 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19639 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19640 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19641 err: Box::into_raw(Box::new(e)),
19646 /// Checks if the given object is currently in the success state
19648 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
19652 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
19653 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
19654 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19655 fn drop(&mut self) {
19656 if self.result_ok {
19657 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19658 let _ = unsafe { Box::from_raw(self.contents.result) };
19661 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19662 let _ = unsafe { Box::from_raw(self.contents.err) };
19667 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19668 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19669 let contents = if o.result_ok {
19670 let result = unsafe { o.contents.result };
19671 unsafe { o.contents.result = core::ptr::null_mut() };
19672 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
19674 let err = unsafe { o.contents.err };
19675 unsafe { o.contents.err = core::ptr::null_mut(); }
19676 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
19680 result_ok: o.result_ok,
19684 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19685 fn clone(&self) -> Self {
19686 if self.result_ok {
19687 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19688 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19691 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19692 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19698 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19699 /// but with all dynamically-allocated buffers duplicated in new buffers.
19700 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19702 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
19703 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
19704 /// A pointer to the contents in the success state.
19705 /// Reading from this pointer when `result_ok` is not set is undefined.
19706 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
19707 /// A pointer to the contents in the error state.
19708 /// Reading from this pointer when `result_ok` is set is undefined.
19709 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19712 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19713 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19714 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19715 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
19716 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
19717 /// `err` or `result` depending on the state of `result_ok`.
19718 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
19719 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
19720 pub result_ok: bool,
19723 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
19724 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
19725 CResult_ChannelAnnouncementDecodeErrorZ {
19726 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19727 result: Box::into_raw(Box::new(o)),
19733 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
19734 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
19735 CResult_ChannelAnnouncementDecodeErrorZ {
19736 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19737 err: Box::into_raw(Box::new(e)),
19742 /// Checks if the given object is currently in the success state
19744 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
19748 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
19749 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
19750 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
19751 fn drop(&mut self) {
19752 if self.result_ok {
19753 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19754 let _ = unsafe { Box::from_raw(self.contents.result) };
19757 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19758 let _ = unsafe { Box::from_raw(self.contents.err) };
19763 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
19764 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19765 let contents = if o.result_ok {
19766 let result = unsafe { o.contents.result };
19767 unsafe { o.contents.result = core::ptr::null_mut() };
19768 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
19770 let err = unsafe { o.contents.err };
19771 unsafe { o.contents.err = core::ptr::null_mut(); }
19772 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
19776 result_ok: o.result_ok,
19780 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
19781 fn clone(&self) -> Self {
19782 if self.result_ok {
19783 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19784 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19787 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19788 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19794 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19795 /// but with all dynamically-allocated buffers duplicated in new buffers.
19796 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19798 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
19799 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19800 /// A pointer to the contents in the success state.
19801 /// Reading from this pointer when `result_ok` is not set is undefined.
19802 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
19803 /// A pointer to the contents in the error state.
19804 /// Reading from this pointer when `result_ok` is set is undefined.
19805 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19808 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19809 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19810 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19811 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
19812 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
19813 /// `err` or `result` depending on the state of `result_ok`.
19814 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
19815 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
19816 pub result_ok: bool,
19819 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
19820 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19821 CResult_UnsignedChannelUpdateDecodeErrorZ {
19822 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19823 result: Box::into_raw(Box::new(o)),
19829 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
19830 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19831 CResult_UnsignedChannelUpdateDecodeErrorZ {
19832 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19833 err: Box::into_raw(Box::new(e)),
19838 /// Checks if the given object is currently in the success state
19840 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
19844 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
19845 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
19846 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
19847 fn drop(&mut self) {
19848 if self.result_ok {
19849 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19850 let _ = unsafe { Box::from_raw(self.contents.result) };
19853 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19854 let _ = unsafe { Box::from_raw(self.contents.err) };
19859 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
19860 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19861 let contents = if o.result_ok {
19862 let result = unsafe { o.contents.result };
19863 unsafe { o.contents.result = core::ptr::null_mut() };
19864 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
19866 let err = unsafe { o.contents.err };
19867 unsafe { o.contents.err = core::ptr::null_mut(); }
19868 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
19872 result_ok: o.result_ok,
19876 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
19877 fn clone(&self) -> Self {
19878 if self.result_ok {
19879 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19880 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
19883 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19884 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19890 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
19891 /// but with all dynamically-allocated buffers duplicated in new buffers.
19892 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19894 /// The contents of CResult_ChannelUpdateDecodeErrorZ
19895 pub union CResult_ChannelUpdateDecodeErrorZPtr {
19896 /// A pointer to the contents in the success state.
19897 /// Reading from this pointer when `result_ok` is not set is undefined.
19898 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
19899 /// A pointer to the contents in the error state.
19900 /// Reading from this pointer when `result_ok` is set is undefined.
19901 pub err: *mut crate::lightning::ln::msgs::DecodeError,
19904 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19905 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19907 pub struct CResult_ChannelUpdateDecodeErrorZ {
19908 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
19909 /// `err` or `result` depending on the state of `result_ok`.
19910 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
19911 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
19912 pub result_ok: bool,
19915 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
19916 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
19917 CResult_ChannelUpdateDecodeErrorZ {
19918 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19919 result: Box::into_raw(Box::new(o)),
19925 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
19926 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
19927 CResult_ChannelUpdateDecodeErrorZ {
19928 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19929 err: Box::into_raw(Box::new(e)),
19934 /// Checks if the given object is currently in the success state
19936 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
19940 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
19941 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
19942 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
19943 fn drop(&mut self) {
19944 if self.result_ok {
19945 if unsafe { !(self.contents.result as *mut ()).is_null() } {
19946 let _ = unsafe { Box::from_raw(self.contents.result) };
19949 if unsafe { !(self.contents.err as *mut ()).is_null() } {
19950 let _ = unsafe { Box::from_raw(self.contents.err) };
19955 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
19956 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19957 let contents = if o.result_ok {
19958 let result = unsafe { o.contents.result };
19959 unsafe { o.contents.result = core::ptr::null_mut() };
19960 CResult_ChannelUpdateDecodeErrorZPtr { result }
19962 let err = unsafe { o.contents.err };
19963 unsafe { o.contents.err = core::ptr::null_mut(); }
19964 CResult_ChannelUpdateDecodeErrorZPtr { err }
19968 result_ok: o.result_ok,
19972 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
19973 fn clone(&self) -> Self {
19974 if self.result_ok {
19975 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19976 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
19979 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19980 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19986 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
19987 /// but with all dynamically-allocated buffers duplicated in new buffers.
19988 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19990 /// The contents of CResult_ErrorMessageDecodeErrorZ
19991 pub union CResult_ErrorMessageDecodeErrorZPtr {
19992 /// A pointer to the contents in the success state.
19993 /// Reading from this pointer when `result_ok` is not set is undefined.
19994 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
19995 /// A pointer to the contents in the error state.
19996 /// Reading from this pointer when `result_ok` is set is undefined.
19997 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20000 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
20001 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
20002 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20003 pub struct CResult_ErrorMessageDecodeErrorZ {
20004 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
20005 /// `err` or `result` depending on the state of `result_ok`.
20006 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
20007 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
20008 pub result_ok: bool,
20011 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
20012 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
20013 CResult_ErrorMessageDecodeErrorZ {
20014 contents: CResult_ErrorMessageDecodeErrorZPtr {
20015 result: Box::into_raw(Box::new(o)),
20021 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
20022 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
20023 CResult_ErrorMessageDecodeErrorZ {
20024 contents: CResult_ErrorMessageDecodeErrorZPtr {
20025 err: Box::into_raw(Box::new(e)),
20030 /// Checks if the given object is currently in the success state
20032 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
20036 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
20037 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
20038 impl Drop for CResult_ErrorMessageDecodeErrorZ {
20039 fn drop(&mut self) {
20040 if self.result_ok {
20041 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20042 let _ = unsafe { Box::from_raw(self.contents.result) };
20045 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20046 let _ = unsafe { Box::from_raw(self.contents.err) };
20051 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
20052 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
20053 let contents = if o.result_ok {
20054 let result = unsafe { o.contents.result };
20055 unsafe { o.contents.result = core::ptr::null_mut() };
20056 CResult_ErrorMessageDecodeErrorZPtr { result }
20058 let err = unsafe { o.contents.err };
20059 unsafe { o.contents.err = core::ptr::null_mut(); }
20060 CResult_ErrorMessageDecodeErrorZPtr { err }
20064 result_ok: o.result_ok,
20068 impl Clone for CResult_ErrorMessageDecodeErrorZ {
20069 fn clone(&self) -> Self {
20070 if self.result_ok {
20071 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
20072 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
20075 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
20076 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20082 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
20083 /// but with all dynamically-allocated buffers duplicated in new buffers.
20084 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
20086 /// The contents of CResult_WarningMessageDecodeErrorZ
20087 pub union CResult_WarningMessageDecodeErrorZPtr {
20088 /// A pointer to the contents in the success state.
20089 /// Reading from this pointer when `result_ok` is not set is undefined.
20090 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
20091 /// A pointer to the contents in the error state.
20092 /// Reading from this pointer when `result_ok` is set is undefined.
20093 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20096 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
20097 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
20098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20099 pub struct CResult_WarningMessageDecodeErrorZ {
20100 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
20101 /// `err` or `result` depending on the state of `result_ok`.
20102 pub contents: CResult_WarningMessageDecodeErrorZPtr,
20103 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
20104 pub result_ok: bool,
20107 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
20108 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
20109 CResult_WarningMessageDecodeErrorZ {
20110 contents: CResult_WarningMessageDecodeErrorZPtr {
20111 result: Box::into_raw(Box::new(o)),
20117 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
20118 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
20119 CResult_WarningMessageDecodeErrorZ {
20120 contents: CResult_WarningMessageDecodeErrorZPtr {
20121 err: Box::into_raw(Box::new(e)),
20126 /// Checks if the given object is currently in the success state
20128 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
20132 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
20133 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
20134 impl Drop for CResult_WarningMessageDecodeErrorZ {
20135 fn drop(&mut self) {
20136 if self.result_ok {
20137 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20138 let _ = unsafe { Box::from_raw(self.contents.result) };
20141 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20142 let _ = unsafe { Box::from_raw(self.contents.err) };
20147 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
20148 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
20149 let contents = if o.result_ok {
20150 let result = unsafe { o.contents.result };
20151 unsafe { o.contents.result = core::ptr::null_mut() };
20152 CResult_WarningMessageDecodeErrorZPtr { result }
20154 let err = unsafe { o.contents.err };
20155 unsafe { o.contents.err = core::ptr::null_mut(); }
20156 CResult_WarningMessageDecodeErrorZPtr { err }
20160 result_ok: o.result_ok,
20164 impl Clone for CResult_WarningMessageDecodeErrorZ {
20165 fn clone(&self) -> Self {
20166 if self.result_ok {
20167 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
20168 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
20171 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
20172 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20178 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
20179 /// but with all dynamically-allocated buffers duplicated in new buffers.
20180 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
20182 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
20183 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20184 /// A pointer to the contents in the success state.
20185 /// Reading from this pointer when `result_ok` is not set is undefined.
20186 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
20187 /// A pointer to the contents in the error state.
20188 /// Reading from this pointer when `result_ok` is set is undefined.
20189 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20192 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
20193 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
20194 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20195 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20196 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
20197 /// `err` or `result` depending on the state of `result_ok`.
20198 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
20199 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
20200 pub result_ok: bool,
20203 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
20204 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20205 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20206 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20207 result: Box::into_raw(Box::new(o)),
20213 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
20214 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20215 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20216 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20217 err: Box::into_raw(Box::new(e)),
20222 /// Checks if the given object is currently in the success state
20224 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
20228 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
20229 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
20230 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20231 fn drop(&mut self) {
20232 if self.result_ok {
20233 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20234 let _ = unsafe { Box::from_raw(self.contents.result) };
20237 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20238 let _ = unsafe { Box::from_raw(self.contents.err) };
20243 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20244 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
20245 let contents = if o.result_ok {
20246 let result = unsafe { o.contents.result };
20247 unsafe { o.contents.result = core::ptr::null_mut() };
20248 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
20250 let err = unsafe { o.contents.err };
20251 unsafe { o.contents.err = core::ptr::null_mut(); }
20252 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
20256 result_ok: o.result_ok,
20260 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20261 fn clone(&self) -> Self {
20262 if self.result_ok {
20263 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20264 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
20267 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20268 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20274 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
20275 /// but with all dynamically-allocated buffers duplicated in new buffers.
20276 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
20278 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
20279 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
20280 /// A pointer to the contents in the success state.
20281 /// Reading from this pointer when `result_ok` is not set is undefined.
20282 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
20283 /// A pointer to the contents in the error state.
20284 /// Reading from this pointer when `result_ok` is set is undefined.
20285 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20288 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
20289 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
20290 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20291 pub struct CResult_NodeAnnouncementDecodeErrorZ {
20292 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
20293 /// `err` or `result` depending on the state of `result_ok`.
20294 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
20295 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
20296 pub result_ok: bool,
20299 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
20300 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
20301 CResult_NodeAnnouncementDecodeErrorZ {
20302 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20303 result: Box::into_raw(Box::new(o)),
20309 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
20310 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
20311 CResult_NodeAnnouncementDecodeErrorZ {
20312 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20313 err: Box::into_raw(Box::new(e)),
20318 /// Checks if the given object is currently in the success state
20320 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
20324 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
20325 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
20326 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
20327 fn drop(&mut self) {
20328 if self.result_ok {
20329 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20330 let _ = unsafe { Box::from_raw(self.contents.result) };
20333 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20334 let _ = unsafe { Box::from_raw(self.contents.err) };
20339 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
20340 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
20341 let contents = if o.result_ok {
20342 let result = unsafe { o.contents.result };
20343 unsafe { o.contents.result = core::ptr::null_mut() };
20344 CResult_NodeAnnouncementDecodeErrorZPtr { result }
20346 let err = unsafe { o.contents.err };
20347 unsafe { o.contents.err = core::ptr::null_mut(); }
20348 CResult_NodeAnnouncementDecodeErrorZPtr { err }
20352 result_ok: o.result_ok,
20356 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
20357 fn clone(&self) -> Self {
20358 if self.result_ok {
20359 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20360 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
20363 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20364 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20370 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
20371 /// but with all dynamically-allocated buffers duplicated in new buffers.
20372 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
20374 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
20375 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
20376 /// A pointer to the contents in the success state.
20377 /// Reading from this pointer when `result_ok` is not set is undefined.
20378 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
20379 /// A pointer to the contents in the error state.
20380 /// Reading from this pointer when `result_ok` is set is undefined.
20381 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20384 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
20385 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
20386 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20387 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
20388 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
20389 /// `err` or `result` depending on the state of `result_ok`.
20390 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
20391 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
20392 pub result_ok: bool,
20395 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
20396 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
20397 CResult_QueryShortChannelIdsDecodeErrorZ {
20398 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20399 result: Box::into_raw(Box::new(o)),
20405 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
20406 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
20407 CResult_QueryShortChannelIdsDecodeErrorZ {
20408 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20409 err: Box::into_raw(Box::new(e)),
20414 /// Checks if the given object is currently in the success state
20416 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
20420 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
20421 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
20422 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
20423 fn drop(&mut self) {
20424 if self.result_ok {
20425 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20426 let _ = unsafe { Box::from_raw(self.contents.result) };
20429 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20430 let _ = unsafe { Box::from_raw(self.contents.err) };
20435 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
20436 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
20437 let contents = if o.result_ok {
20438 let result = unsafe { o.contents.result };
20439 unsafe { o.contents.result = core::ptr::null_mut() };
20440 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
20442 let err = unsafe { o.contents.err };
20443 unsafe { o.contents.err = core::ptr::null_mut(); }
20444 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
20448 result_ok: o.result_ok,
20452 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
20453 fn clone(&self) -> Self {
20454 if self.result_ok {
20455 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20456 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
20459 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20460 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20466 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
20467 /// but with all dynamically-allocated buffers duplicated in new buffers.
20468 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
20470 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
20471 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20472 /// A pointer to the contents in the success state.
20473 /// Reading from this pointer when `result_ok` is not set is undefined.
20474 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
20475 /// A pointer to the contents in the error state.
20476 /// Reading from this pointer when `result_ok` is set is undefined.
20477 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20480 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
20481 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
20482 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20483 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20484 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
20485 /// `err` or `result` depending on the state of `result_ok`.
20486 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
20487 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
20488 pub result_ok: bool,
20491 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
20492 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20493 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20494 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20495 result: Box::into_raw(Box::new(o)),
20501 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
20502 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20503 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20504 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20505 err: Box::into_raw(Box::new(e)),
20510 /// Checks if the given object is currently in the success state
20512 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
20516 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
20517 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
20518 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20519 fn drop(&mut self) {
20520 if self.result_ok {
20521 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20522 let _ = unsafe { Box::from_raw(self.contents.result) };
20525 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20526 let _ = unsafe { Box::from_raw(self.contents.err) };
20531 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20532 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
20533 let contents = if o.result_ok {
20534 let result = unsafe { o.contents.result };
20535 unsafe { o.contents.result = core::ptr::null_mut() };
20536 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
20538 let err = unsafe { o.contents.err };
20539 unsafe { o.contents.err = core::ptr::null_mut(); }
20540 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
20544 result_ok: o.result_ok,
20548 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20549 fn clone(&self) -> Self {
20550 if self.result_ok {
20551 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20552 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
20555 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20556 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20562 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
20563 /// but with all dynamically-allocated buffers duplicated in new buffers.
20564 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
20566 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
20567 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
20568 /// A pointer to the contents in the success state.
20569 /// Reading from this pointer when `result_ok` is not set is undefined.
20570 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
20571 /// A pointer to the contents in the error state.
20572 /// Reading from this pointer when `result_ok` is set is undefined.
20573 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20576 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
20577 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20578 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20579 pub struct CResult_QueryChannelRangeDecodeErrorZ {
20580 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
20581 /// `err` or `result` depending on the state of `result_ok`.
20582 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
20583 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
20584 pub result_ok: bool,
20587 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
20588 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
20589 CResult_QueryChannelRangeDecodeErrorZ {
20590 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20591 result: Box::into_raw(Box::new(o)),
20597 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
20598 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
20599 CResult_QueryChannelRangeDecodeErrorZ {
20600 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20601 err: Box::into_raw(Box::new(e)),
20606 /// Checks if the given object is currently in the success state
20608 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
20612 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
20613 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
20614 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
20615 fn drop(&mut self) {
20616 if self.result_ok {
20617 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20618 let _ = unsafe { Box::from_raw(self.contents.result) };
20621 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20622 let _ = unsafe { Box::from_raw(self.contents.err) };
20627 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
20628 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20629 let contents = if o.result_ok {
20630 let result = unsafe { o.contents.result };
20631 unsafe { o.contents.result = core::ptr::null_mut() };
20632 CResult_QueryChannelRangeDecodeErrorZPtr { result }
20634 let err = unsafe { o.contents.err };
20635 unsafe { o.contents.err = core::ptr::null_mut(); }
20636 CResult_QueryChannelRangeDecodeErrorZPtr { err }
20640 result_ok: o.result_ok,
20644 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
20645 fn clone(&self) -> Self {
20646 if self.result_ok {
20647 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20648 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
20651 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20652 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20658 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
20659 /// but with all dynamically-allocated buffers duplicated in new buffers.
20660 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20662 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
20663 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
20664 /// A pointer to the contents in the success state.
20665 /// Reading from this pointer when `result_ok` is not set is undefined.
20666 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
20667 /// A pointer to the contents in the error state.
20668 /// Reading from this pointer when `result_ok` is set is undefined.
20669 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20672 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
20673 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20674 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20675 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
20676 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
20677 /// `err` or `result` depending on the state of `result_ok`.
20678 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
20679 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
20680 pub result_ok: bool,
20683 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
20684 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
20685 CResult_ReplyChannelRangeDecodeErrorZ {
20686 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20687 result: Box::into_raw(Box::new(o)),
20693 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
20694 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
20695 CResult_ReplyChannelRangeDecodeErrorZ {
20696 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20697 err: Box::into_raw(Box::new(e)),
20702 /// Checks if the given object is currently in the success state
20704 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
20708 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
20709 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
20710 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
20711 fn drop(&mut self) {
20712 if self.result_ok {
20713 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20714 let _ = unsafe { Box::from_raw(self.contents.result) };
20717 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20718 let _ = unsafe { Box::from_raw(self.contents.err) };
20723 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
20724 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20725 let contents = if o.result_ok {
20726 let result = unsafe { o.contents.result };
20727 unsafe { o.contents.result = core::ptr::null_mut() };
20728 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
20730 let err = unsafe { o.contents.err };
20731 unsafe { o.contents.err = core::ptr::null_mut(); }
20732 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
20736 result_ok: o.result_ok,
20740 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
20741 fn clone(&self) -> Self {
20742 if self.result_ok {
20743 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20744 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
20747 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20748 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20754 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
20755 /// but with all dynamically-allocated buffers duplicated in new buffers.
20756 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20758 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
20759 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
20760 /// A pointer to the contents in the success state.
20761 /// Reading from this pointer when `result_ok` is not set is undefined.
20762 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
20763 /// A pointer to the contents in the error state.
20764 /// Reading from this pointer when `result_ok` is set is undefined.
20765 pub err: *mut crate::lightning::ln::msgs::DecodeError,
20768 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
20769 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
20770 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20771 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
20772 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
20773 /// `err` or `result` depending on the state of `result_ok`.
20774 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
20775 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
20776 pub result_ok: bool,
20779 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
20780 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
20781 CResult_GossipTimestampFilterDecodeErrorZ {
20782 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20783 result: Box::into_raw(Box::new(o)),
20789 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
20790 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
20791 CResult_GossipTimestampFilterDecodeErrorZ {
20792 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20793 err: Box::into_raw(Box::new(e)),
20798 /// Checks if the given object is currently in the success state
20800 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
20804 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
20805 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
20806 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
20807 fn drop(&mut self) {
20808 if self.result_ok {
20809 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20810 let _ = unsafe { Box::from_raw(self.contents.result) };
20813 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20814 let _ = unsafe { Box::from_raw(self.contents.err) };
20819 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
20820 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
20821 let contents = if o.result_ok {
20822 let result = unsafe { o.contents.result };
20823 unsafe { o.contents.result = core::ptr::null_mut() };
20824 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
20826 let err = unsafe { o.contents.err };
20827 unsafe { o.contents.err = core::ptr::null_mut(); }
20828 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
20832 result_ok: o.result_ok,
20836 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
20837 fn clone(&self) -> Self {
20838 if self.result_ok {
20839 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20840 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
20843 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20844 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20850 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
20851 /// but with all dynamically-allocated buffers duplicated in new buffers.
20852 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
20854 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
20855 /// This corresponds to std::vector in C++
20856 pub struct CVec_PhantomRouteHintsZ {
20857 /// The elements in the array.
20858 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20859 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
20860 /// The number of elements pointed to by `data`.
20863 impl CVec_PhantomRouteHintsZ {
20864 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
20865 if self.datalen == 0 { return Vec::new(); }
20866 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20867 self.data = core::ptr::null_mut();
20871 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
20872 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20875 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
20876 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
20877 let datalen = v.len();
20878 let data = Box::into_raw(v.into_boxed_slice());
20879 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20883 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20884 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
20885 impl Drop for CVec_PhantomRouteHintsZ {
20886 fn drop(&mut self) {
20887 if self.datalen == 0 { return; }
20888 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20891 impl Clone for CVec_PhantomRouteHintsZ {
20892 fn clone(&self) -> Self {
20893 let mut res = Vec::new();
20894 if self.datalen == 0 { return Self::from(res); }
20895 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20900 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
20901 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20902 /// A pointer to the contents in the success state.
20903 /// Reading from this pointer when `result_ok` is not set is undefined.
20904 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20905 /// A pointer to the contents in the error state.
20906 /// Reading from this pointer when `result_ok` is set is undefined.
20907 pub err: *mut crate::lightning_invoice::SignOrCreationError,
20910 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
20911 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
20912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20913 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
20914 /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
20915 /// `err` or `result` depending on the state of `result_ok`.
20916 pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
20917 /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
20918 pub result_ok: bool,
20921 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
20922 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20923 CResult_Bolt11InvoiceSignOrCreationErrorZ {
20924 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20925 result: Box::into_raw(Box::new(o)),
20931 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
20932 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20933 CResult_Bolt11InvoiceSignOrCreationErrorZ {
20934 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20935 err: Box::into_raw(Box::new(e)),
20940 /// Checks if the given object is currently in the success state
20942 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
20946 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
20947 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
20948 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20949 fn drop(&mut self) {
20950 if self.result_ok {
20951 if unsafe { !(self.contents.result as *mut ()).is_null() } {
20952 let _ = unsafe { Box::from_raw(self.contents.result) };
20955 if unsafe { !(self.contents.err as *mut ()).is_null() } {
20956 let _ = unsafe { Box::from_raw(self.contents.err) };
20961 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20962 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
20963 let contents = if o.result_ok {
20964 let result = unsafe { o.contents.result };
20965 unsafe { o.contents.result = core::ptr::null_mut() };
20966 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
20968 let err = unsafe { o.contents.err };
20969 unsafe { o.contents.err = core::ptr::null_mut(); }
20970 CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
20974 result_ok: o.result_ok,
20978 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20979 fn clone(&self) -> Self {
20980 if self.result_ok {
20981 Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20982 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20985 Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20986 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
20992 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
20993 /// but with all dynamically-allocated buffers duplicated in new buffers.
20994 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
20996 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
20997 /// This corresponds to std::vector in C++
20998 pub struct CVec_FutureZ {
20999 /// The elements in the array.
21000 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21001 pub data: *mut crate::lightning::util::wakers::Future,
21002 /// The number of elements pointed to by `data`.
21005 impl CVec_FutureZ {
21006 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
21007 if self.datalen == 0 { return Vec::new(); }
21008 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21009 self.data = core::ptr::null_mut();
21013 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
21014 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21017 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
21018 fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
21019 let datalen = v.len();
21020 let data = Box::into_raw(v.into_boxed_slice());
21021 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21025 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21026 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
21027 impl Drop for CVec_FutureZ {
21028 fn drop(&mut self) {
21029 if self.datalen == 0 { return; }
21030 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21034 /// The contents of CResult_OffersMessageDecodeErrorZ
21035 pub union CResult_OffersMessageDecodeErrorZPtr {
21036 /// A pointer to the contents in the success state.
21037 /// Reading from this pointer when `result_ok` is not set is undefined.
21038 pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
21039 /// A pointer to the contents in the error state.
21040 /// Reading from this pointer when `result_ok` is set is undefined.
21041 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21044 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
21045 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
21046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21047 pub struct CResult_OffersMessageDecodeErrorZ {
21048 /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
21049 /// `err` or `result` depending on the state of `result_ok`.
21050 pub contents: CResult_OffersMessageDecodeErrorZPtr,
21051 /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
21052 pub result_ok: bool,
21055 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
21056 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
21057 CResult_OffersMessageDecodeErrorZ {
21058 contents: CResult_OffersMessageDecodeErrorZPtr {
21059 result: Box::into_raw(Box::new(o)),
21065 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
21066 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
21067 CResult_OffersMessageDecodeErrorZ {
21068 contents: CResult_OffersMessageDecodeErrorZPtr {
21069 err: Box::into_raw(Box::new(e)),
21074 /// Checks if the given object is currently in the success state
21076 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
21080 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
21081 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
21082 impl Drop for CResult_OffersMessageDecodeErrorZ {
21083 fn drop(&mut self) {
21084 if self.result_ok {
21085 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21086 let _ = unsafe { Box::from_raw(self.contents.result) };
21089 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21090 let _ = unsafe { Box::from_raw(self.contents.err) };
21095 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
21096 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
21097 let contents = if o.result_ok {
21098 let result = unsafe { o.contents.result };
21099 unsafe { o.contents.result = core::ptr::null_mut() };
21100 CResult_OffersMessageDecodeErrorZPtr { result }
21102 let err = unsafe { o.contents.err };
21103 unsafe { o.contents.err = core::ptr::null_mut(); }
21104 CResult_OffersMessageDecodeErrorZPtr { err }
21108 result_ok: o.result_ok,
21112 impl Clone for CResult_OffersMessageDecodeErrorZ {
21113 fn clone(&self) -> Self {
21114 if self.result_ok {
21115 Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
21116 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
21119 Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
21120 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21126 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
21127 /// but with all dynamically-allocated buffers duplicated in new buffers.
21128 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
21130 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
21131 pub enum COption_HTLCClaimZ {
21132 /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
21133 Some(crate::lightning::ln::chan_utils::HTLCClaim),
21134 /// When we're in this state, this COption_HTLCClaimZ contains nothing
21137 impl COption_HTLCClaimZ {
21138 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21139 if let Self::None = self { false } else { true }
21141 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21144 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
21145 if let Self::Some(v) = self { v } else { unreachable!() }
21149 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
21150 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
21151 COption_HTLCClaimZ::Some(o)
21154 /// Constructs a new COption_HTLCClaimZ containing nothing
21155 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
21156 COption_HTLCClaimZ::None
21159 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
21160 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
21162 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
21163 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21164 /// A pointer to the contents in the success state.
21165 /// Reading from this pointer when `result_ok` is not set is undefined.
21166 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
21167 /// A pointer to the contents in the error state.
21168 /// Reading from this pointer when `result_ok` is set is undefined.
21169 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21172 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
21173 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
21174 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21175 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21176 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
21177 /// `err` or `result` depending on the state of `result_ok`.
21178 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
21179 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
21180 pub result_ok: bool,
21183 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
21184 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21185 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21186 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21187 result: Box::into_raw(Box::new(o)),
21193 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
21194 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21195 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21196 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21197 err: Box::into_raw(Box::new(e)),
21202 /// Checks if the given object is currently in the success state
21204 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
21208 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
21209 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
21210 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21211 fn drop(&mut self) {
21212 if self.result_ok {
21213 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21214 let _ = unsafe { Box::from_raw(self.contents.result) };
21217 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21218 let _ = unsafe { Box::from_raw(self.contents.err) };
21223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
21225 let contents = if o.result_ok {
21226 let result = unsafe { o.contents.result };
21227 unsafe { o.contents.result = core::ptr::null_mut() };
21228 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
21230 let err = unsafe { o.contents.err };
21231 unsafe { o.contents.err = core::ptr::null_mut(); }
21232 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
21236 result_ok: o.result_ok,
21240 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21241 fn clone(&self) -> Self {
21242 if self.result_ok {
21243 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21244 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
21247 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21248 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21254 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
21255 /// but with all dynamically-allocated buffers duplicated in new buffers.
21256 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
21258 /// The contents of CResult_TxCreationKeysDecodeErrorZ
21259 pub union CResult_TxCreationKeysDecodeErrorZPtr {
21260 /// A pointer to the contents in the success state.
21261 /// Reading from this pointer when `result_ok` is not set is undefined.
21262 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
21263 /// A pointer to the contents in the error state.
21264 /// Reading from this pointer when `result_ok` is set is undefined.
21265 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21268 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
21269 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
21270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21271 pub struct CResult_TxCreationKeysDecodeErrorZ {
21272 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
21273 /// `err` or `result` depending on the state of `result_ok`.
21274 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
21275 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
21276 pub result_ok: bool,
21279 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
21280 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
21281 CResult_TxCreationKeysDecodeErrorZ {
21282 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21283 result: Box::into_raw(Box::new(o)),
21289 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
21290 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
21291 CResult_TxCreationKeysDecodeErrorZ {
21292 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21293 err: Box::into_raw(Box::new(e)),
21298 /// Checks if the given object is currently in the success state
21300 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
21304 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
21305 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
21306 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
21307 fn drop(&mut self) {
21308 if self.result_ok {
21309 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21310 let _ = unsafe { Box::from_raw(self.contents.result) };
21313 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21314 let _ = unsafe { Box::from_raw(self.contents.err) };
21319 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
21320 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
21321 let contents = if o.result_ok {
21322 let result = unsafe { o.contents.result };
21323 unsafe { o.contents.result = core::ptr::null_mut() };
21324 CResult_TxCreationKeysDecodeErrorZPtr { result }
21326 let err = unsafe { o.contents.err };
21327 unsafe { o.contents.err = core::ptr::null_mut(); }
21328 CResult_TxCreationKeysDecodeErrorZPtr { err }
21332 result_ok: o.result_ok,
21336 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
21337 fn clone(&self) -> Self {
21338 if self.result_ok {
21339 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21340 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
21343 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21344 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21350 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
21351 /// but with all dynamically-allocated buffers duplicated in new buffers.
21352 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
21354 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
21355 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
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::chan_utils::ChannelPublicKeys,
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_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
21365 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys 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_ChannelPublicKeysDecodeErrorZ {
21368 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
21369 /// `err` or `result` depending on the state of `result_ok`.
21370 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
21371 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
21372 pub result_ok: bool,
21375 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
21376 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
21377 CResult_ChannelPublicKeysDecodeErrorZ {
21378 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21379 result: Box::into_raw(Box::new(o)),
21385 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
21386 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
21387 CResult_ChannelPublicKeysDecodeErrorZ {
21388 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
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_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
21400 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
21401 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
21402 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
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::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
21416 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, 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_ChannelPublicKeysDecodeErrorZPtr { result }
21422 let err = unsafe { o.contents.err };
21423 unsafe { o.contents.err = core::ptr::null_mut(); }
21424 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
21428 result_ok: o.result_ok,
21432 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
21433 fn clone(&self) -> Self {
21434 if self.result_ok {
21435 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21436 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
21439 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21440 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21446 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
21447 /// but with all dynamically-allocated buffers duplicated in new buffers.
21448 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
21450 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
21451 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
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::chan_utils::HTLCOutputInCommitment,
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_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
21461 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment 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_HTLCOutputInCommitmentDecodeErrorZ {
21464 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
21465 /// `err` or `result` depending on the state of `result_ok`.
21466 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
21467 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
21468 pub result_ok: bool,
21471 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
21472 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
21473 CResult_HTLCOutputInCommitmentDecodeErrorZ {
21474 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21475 result: Box::into_raw(Box::new(o)),
21481 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
21482 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
21483 CResult_HTLCOutputInCommitmentDecodeErrorZ {
21484 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
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_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
21496 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
21497 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
21498 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
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::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
21512 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, 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_HTLCOutputInCommitmentDecodeErrorZPtr { result }
21518 let err = unsafe { o.contents.err };
21519 unsafe { o.contents.err = core::ptr::null_mut(); }
21520 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
21524 result_ok: o.result_ok,
21528 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
21529 fn clone(&self) -> Self {
21530 if self.result_ok {
21531 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21532 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
21535 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21536 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21542 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
21543 /// but with all dynamically-allocated buffers duplicated in new buffers.
21544 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
21546 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
21547 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21548 /// A pointer to the contents in the success state.
21549 /// Reading from this pointer when `result_ok` is not set is undefined.
21550 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
21551 /// A pointer to the contents in the error state.
21552 /// Reading from this pointer when `result_ok` is set is undefined.
21553 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21556 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
21557 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
21558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21559 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21560 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
21561 /// `err` or `result` depending on the state of `result_ok`.
21562 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
21563 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
21564 pub result_ok: bool,
21567 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
21568 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21569 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21570 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21571 result: Box::into_raw(Box::new(o)),
21577 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
21578 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21579 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21580 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21581 err: Box::into_raw(Box::new(e)),
21586 /// Checks if the given object is currently in the success state
21588 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
21592 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
21593 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
21594 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21595 fn drop(&mut self) {
21596 if self.result_ok {
21597 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21598 let _ = unsafe { Box::from_raw(self.contents.result) };
21601 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21602 let _ = unsafe { Box::from_raw(self.contents.err) };
21607 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21608 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
21609 let contents = if o.result_ok {
21610 let result = unsafe { o.contents.result };
21611 unsafe { o.contents.result = core::ptr::null_mut() };
21612 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
21614 let err = unsafe { o.contents.err };
21615 unsafe { o.contents.err = core::ptr::null_mut(); }
21616 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
21620 result_ok: o.result_ok,
21624 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21625 fn clone(&self) -> Self {
21626 if self.result_ok {
21627 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21628 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
21631 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21632 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21638 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
21639 /// but with all dynamically-allocated buffers duplicated in new buffers.
21640 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
21642 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
21643 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
21644 /// A pointer to the contents in the success state.
21645 /// Reading from this pointer when `result_ok` is not set is undefined.
21646 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
21647 /// A pointer to the contents in the error state.
21648 /// Reading from this pointer when `result_ok` is set is undefined.
21649 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21652 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
21653 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
21654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21655 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
21656 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
21657 /// `err` or `result` depending on the state of `result_ok`.
21658 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
21659 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
21660 pub result_ok: bool,
21663 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
21664 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
21665 CResult_ChannelTransactionParametersDecodeErrorZ {
21666 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21667 result: Box::into_raw(Box::new(o)),
21673 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
21674 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
21675 CResult_ChannelTransactionParametersDecodeErrorZ {
21676 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21677 err: Box::into_raw(Box::new(e)),
21682 /// Checks if the given object is currently in the success state
21684 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
21688 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
21689 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
21690 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
21691 fn drop(&mut self) {
21692 if self.result_ok {
21693 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21694 let _ = unsafe { Box::from_raw(self.contents.result) };
21697 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21698 let _ = unsafe { Box::from_raw(self.contents.err) };
21703 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
21704 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
21705 let contents = if o.result_ok {
21706 let result = unsafe { o.contents.result };
21707 unsafe { o.contents.result = core::ptr::null_mut() };
21708 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
21710 let err = unsafe { o.contents.err };
21711 unsafe { o.contents.err = core::ptr::null_mut(); }
21712 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
21716 result_ok: o.result_ok,
21720 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
21721 fn clone(&self) -> Self {
21722 if self.result_ok {
21723 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21724 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
21727 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21728 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21734 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
21735 /// but with all dynamically-allocated buffers duplicated in new buffers.
21736 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
21738 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
21739 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21740 /// A pointer to the contents in the success state.
21741 /// Reading from this pointer when `result_ok` is not set is undefined.
21742 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
21743 /// A pointer to the contents in the error state.
21744 /// Reading from this pointer when `result_ok` is set is undefined.
21745 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21748 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
21749 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
21750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21751 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
21752 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
21753 /// `err` or `result` depending on the state of `result_ok`.
21754 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
21755 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
21756 pub result_ok: bool,
21759 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
21760 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
21761 CResult_HolderCommitmentTransactionDecodeErrorZ {
21762 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21763 result: Box::into_raw(Box::new(o)),
21769 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
21770 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
21771 CResult_HolderCommitmentTransactionDecodeErrorZ {
21772 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21773 err: Box::into_raw(Box::new(e)),
21778 /// Checks if the given object is currently in the success state
21780 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
21784 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
21785 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
21786 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
21787 fn drop(&mut self) {
21788 if self.result_ok {
21789 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21790 let _ = unsafe { Box::from_raw(self.contents.result) };
21793 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21794 let _ = unsafe { Box::from_raw(self.contents.err) };
21799 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
21800 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
21801 let contents = if o.result_ok {
21802 let result = unsafe { o.contents.result };
21803 unsafe { o.contents.result = core::ptr::null_mut() };
21804 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
21806 let err = unsafe { o.contents.err };
21807 unsafe { o.contents.err = core::ptr::null_mut(); }
21808 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
21812 result_ok: o.result_ok,
21816 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
21817 fn clone(&self) -> Self {
21818 if self.result_ok {
21819 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21820 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
21823 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21824 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21830 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
21831 /// but with all dynamically-allocated buffers duplicated in new buffers.
21832 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
21834 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
21835 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21836 /// A pointer to the contents in the success state.
21837 /// Reading from this pointer when `result_ok` is not set is undefined.
21838 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
21839 /// A pointer to the contents in the error state.
21840 /// Reading from this pointer when `result_ok` is set is undefined.
21841 pub err: *mut crate::lightning::ln::msgs::DecodeError,
21844 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
21845 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
21846 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21847 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
21848 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
21849 /// `err` or `result` depending on the state of `result_ok`.
21850 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
21851 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
21852 pub result_ok: bool,
21855 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
21856 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
21857 CResult_BuiltCommitmentTransactionDecodeErrorZ {
21858 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21859 result: Box::into_raw(Box::new(o)),
21865 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
21866 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
21867 CResult_BuiltCommitmentTransactionDecodeErrorZ {
21868 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21869 err: Box::into_raw(Box::new(e)),
21874 /// Checks if the given object is currently in the success state
21876 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
21880 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
21881 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
21882 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21883 fn drop(&mut self) {
21884 if self.result_ok {
21885 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21886 let _ = unsafe { Box::from_raw(self.contents.result) };
21889 if unsafe { !(self.contents.err as *mut ()).is_null() } {
21890 let _ = unsafe { Box::from_raw(self.contents.err) };
21895 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21896 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
21897 let contents = if o.result_ok {
21898 let result = unsafe { o.contents.result };
21899 unsafe { o.contents.result = core::ptr::null_mut() };
21900 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
21902 let err = unsafe { o.contents.err };
21903 unsafe { o.contents.err = core::ptr::null_mut(); }
21904 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
21908 result_ok: o.result_ok,
21912 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21913 fn clone(&self) -> Self {
21914 if self.result_ok {
21915 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21916 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
21919 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21920 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21926 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
21927 /// but with all dynamically-allocated buffers duplicated in new buffers.
21928 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
21930 /// The contents of CResult_TrustedClosingTransactionNoneZ
21931 pub union CResult_TrustedClosingTransactionNoneZPtr {
21932 /// A pointer to the contents in the success state.
21933 /// Reading from this pointer when `result_ok` is not set is undefined.
21934 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
21935 /// Note that this value is always NULL, as there are no contents in the Err variant
21936 pub err: *mut core::ffi::c_void,
21939 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
21940 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
21941 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21942 pub struct CResult_TrustedClosingTransactionNoneZ {
21943 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
21944 /// `err` or `result` depending on the state of `result_ok`.
21945 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
21946 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
21947 pub result_ok: bool,
21950 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
21951 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
21952 CResult_TrustedClosingTransactionNoneZ {
21953 contents: CResult_TrustedClosingTransactionNoneZPtr {
21954 result: Box::into_raw(Box::new(o)),
21960 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
21961 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
21962 CResult_TrustedClosingTransactionNoneZ {
21963 contents: CResult_TrustedClosingTransactionNoneZPtr {
21964 err: core::ptr::null_mut(),
21969 /// Checks if the given object is currently in the success state
21971 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
21975 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
21976 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
21977 impl Drop for CResult_TrustedClosingTransactionNoneZ {
21978 fn drop(&mut self) {
21979 if self.result_ok {
21980 if unsafe { !(self.contents.result as *mut ()).is_null() } {
21981 let _ = unsafe { Box::from_raw(self.contents.result) };
21987 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
21988 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
21989 let contents = if o.result_ok {
21990 let result = unsafe { o.contents.result };
21991 unsafe { o.contents.result = core::ptr::null_mut() };
21992 CResult_TrustedClosingTransactionNoneZPtr { result }
21994 let _ = unsafe { Box::from_raw(o.contents.err) };
21995 o.contents.err = core::ptr::null_mut();
21996 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
22000 result_ok: o.result_ok,
22005 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
22006 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
22007 /// A pointer to the contents in the success state.
22008 /// Reading from this pointer when `result_ok` is not set is undefined.
22009 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
22010 /// A pointer to the contents in the error state.
22011 /// Reading from this pointer when `result_ok` is set is undefined.
22012 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22015 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
22016 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
22017 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22018 pub struct CResult_CommitmentTransactionDecodeErrorZ {
22019 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
22020 /// `err` or `result` depending on the state of `result_ok`.
22021 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
22022 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
22023 pub result_ok: bool,
22026 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
22027 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
22028 CResult_CommitmentTransactionDecodeErrorZ {
22029 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22030 result: Box::into_raw(Box::new(o)),
22036 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
22037 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
22038 CResult_CommitmentTransactionDecodeErrorZ {
22039 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22040 err: Box::into_raw(Box::new(e)),
22045 /// Checks if the given object is currently in the success state
22047 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
22051 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
22052 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
22053 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
22054 fn drop(&mut self) {
22055 if self.result_ok {
22056 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22057 let _ = unsafe { Box::from_raw(self.contents.result) };
22060 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22061 let _ = unsafe { Box::from_raw(self.contents.err) };
22066 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
22067 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
22068 let contents = if o.result_ok {
22069 let result = unsafe { o.contents.result };
22070 unsafe { o.contents.result = core::ptr::null_mut() };
22071 CResult_CommitmentTransactionDecodeErrorZPtr { result }
22073 let err = unsafe { o.contents.err };
22074 unsafe { o.contents.err = core::ptr::null_mut(); }
22075 CResult_CommitmentTransactionDecodeErrorZPtr { err }
22079 result_ok: o.result_ok,
22083 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
22084 fn clone(&self) -> Self {
22085 if self.result_ok {
22086 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22087 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
22090 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22091 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22097 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
22098 /// but with all dynamically-allocated buffers duplicated in new buffers.
22099 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
22101 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
22102 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
22103 /// A pointer to the contents in the success state.
22104 /// Reading from this pointer when `result_ok` is not set is undefined.
22105 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
22106 /// Note that this value is always NULL, as there are no contents in the Err variant
22107 pub err: *mut core::ffi::c_void,
22110 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
22111 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
22112 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22113 pub struct CResult_TrustedCommitmentTransactionNoneZ {
22114 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
22115 /// `err` or `result` depending on the state of `result_ok`.
22116 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
22117 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
22118 pub result_ok: bool,
22121 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
22122 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
22123 CResult_TrustedCommitmentTransactionNoneZ {
22124 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
22125 result: Box::into_raw(Box::new(o)),
22131 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
22132 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
22133 CResult_TrustedCommitmentTransactionNoneZ {
22134 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
22135 err: core::ptr::null_mut(),
22140 /// Checks if the given object is currently in the success state
22142 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
22146 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
22147 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
22148 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
22149 fn drop(&mut self) {
22150 if self.result_ok {
22151 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22152 let _ = unsafe { Box::from_raw(self.contents.result) };
22158 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
22159 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
22160 let contents = if o.result_ok {
22161 let result = unsafe { o.contents.result };
22162 unsafe { o.contents.result = core::ptr::null_mut() };
22163 CResult_TrustedCommitmentTransactionNoneZPtr { result }
22165 let _ = unsafe { Box::from_raw(o.contents.err) };
22166 o.contents.err = core::ptr::null_mut();
22167 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
22171 result_ok: o.result_ok,
22176 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
22177 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
22178 /// A pointer to the contents in the success state.
22179 /// Reading from this pointer when `result_ok` is not set is undefined.
22180 pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
22181 /// Note that this value is always NULL, as there are no contents in the Err variant
22182 pub err: *mut core::ffi::c_void,
22185 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
22186 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
22187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22188 pub struct CResult_CVec_ECDSASignatureZNoneZ {
22189 /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
22190 /// `err` or `result` depending on the state of `result_ok`.
22191 pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
22192 /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
22193 pub result_ok: bool,
22196 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
22197 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
22198 CResult_CVec_ECDSASignatureZNoneZ {
22199 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22200 result: Box::into_raw(Box::new(o)),
22206 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
22207 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
22208 CResult_CVec_ECDSASignatureZNoneZ {
22209 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22210 err: core::ptr::null_mut(),
22215 /// Checks if the given object is currently in the success state
22217 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
22221 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
22222 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
22223 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
22224 fn drop(&mut self) {
22225 if self.result_ok {
22226 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22227 let _ = unsafe { Box::from_raw(self.contents.result) };
22233 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
22234 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> Self {
22235 let contents = if o.result_ok {
22236 let result = unsafe { o.contents.result };
22237 unsafe { o.contents.result = core::ptr::null_mut() };
22238 CResult_CVec_ECDSASignatureZNoneZPtr { result }
22240 let _ = unsafe { Box::from_raw(o.contents.err) };
22241 o.contents.err = core::ptr::null_mut();
22242 CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
22246 result_ok: o.result_ok,
22250 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
22251 fn clone(&self) -> Self {
22252 if self.result_ok {
22253 Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22254 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
22257 Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22258 err: core::ptr::null_mut()
22264 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
22265 /// but with all dynamically-allocated buffers duplicated in new buffers.
22266 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
22269 /// An enum which can either contain a usize or not
22270 pub enum COption_usizeZ {
22271 /// When we're in this state, this COption_usizeZ contains a usize
22273 /// When we're in this state, this COption_usizeZ contains nothing
22276 impl COption_usizeZ {
22277 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22278 if let Self::None = self { false } else { true }
22280 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22283 #[allow(unused)] pub(crate) fn take(mut self) -> usize {
22284 if let Self::Some(v) = self { v } else { unreachable!() }
22288 /// Constructs a new COption_usizeZ containing a usize
22289 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
22290 COption_usizeZ::Some(o)
22293 /// Constructs a new COption_usizeZ containing nothing
22294 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
22295 COption_usizeZ::None
22298 /// Frees any resources associated with the usize, if we are in the Some state
22299 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
22301 /// Creates a new COption_usizeZ which has the same data as `orig`
22302 /// but with all dynamically-allocated buffers duplicated in new buffers.
22303 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
22305 /// The contents of CResult_ShutdownScriptDecodeErrorZ
22306 pub union CResult_ShutdownScriptDecodeErrorZPtr {
22307 /// A pointer to the contents in the success state.
22308 /// Reading from this pointer when `result_ok` is not set is undefined.
22309 pub result: *mut crate::lightning::ln::script::ShutdownScript,
22310 /// A pointer to the contents in the error state.
22311 /// Reading from this pointer when `result_ok` is set is undefined.
22312 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22315 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
22316 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
22317 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22318 pub struct CResult_ShutdownScriptDecodeErrorZ {
22319 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
22320 /// `err` or `result` depending on the state of `result_ok`.
22321 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
22322 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
22323 pub result_ok: bool,
22326 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
22327 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
22328 CResult_ShutdownScriptDecodeErrorZ {
22329 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22330 result: Box::into_raw(Box::new(o)),
22336 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
22337 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
22338 CResult_ShutdownScriptDecodeErrorZ {
22339 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22340 err: Box::into_raw(Box::new(e)),
22345 /// Checks if the given object is currently in the success state
22347 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
22351 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
22352 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
22353 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
22354 fn drop(&mut self) {
22355 if self.result_ok {
22356 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22357 let _ = unsafe { Box::from_raw(self.contents.result) };
22360 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22361 let _ = unsafe { Box::from_raw(self.contents.err) };
22366 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
22367 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
22368 let contents = if o.result_ok {
22369 let result = unsafe { o.contents.result };
22370 unsafe { o.contents.result = core::ptr::null_mut() };
22371 CResult_ShutdownScriptDecodeErrorZPtr { result }
22373 let err = unsafe { o.contents.err };
22374 unsafe { o.contents.err = core::ptr::null_mut(); }
22375 CResult_ShutdownScriptDecodeErrorZPtr { err }
22379 result_ok: o.result_ok,
22383 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
22384 fn clone(&self) -> Self {
22385 if self.result_ok {
22386 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22387 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
22390 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22391 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22397 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
22398 /// but with all dynamically-allocated buffers duplicated in new buffers.
22399 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
22401 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
22402 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22403 /// A pointer to the contents in the success state.
22404 /// Reading from this pointer when `result_ok` is not set is undefined.
22405 pub result: *mut crate::lightning::ln::script::ShutdownScript,
22406 /// A pointer to the contents in the error state.
22407 /// Reading from this pointer when `result_ok` is set is undefined.
22408 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
22411 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
22412 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
22413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22414 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
22415 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
22416 /// `err` or `result` depending on the state of `result_ok`.
22417 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
22418 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
22419 pub result_ok: bool,
22422 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
22423 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22424 CResult_ShutdownScriptInvalidShutdownScriptZ {
22425 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22426 result: Box::into_raw(Box::new(o)),
22432 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
22433 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22434 CResult_ShutdownScriptInvalidShutdownScriptZ {
22435 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22436 err: Box::into_raw(Box::new(e)),
22441 /// Checks if the given object is currently in the success state
22443 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
22447 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
22448 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
22449 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
22450 fn drop(&mut self) {
22451 if self.result_ok {
22452 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22453 let _ = unsafe { Box::from_raw(self.contents.result) };
22456 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22457 let _ = unsafe { Box::from_raw(self.contents.err) };
22462 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
22463 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
22464 let contents = if o.result_ok {
22465 let result = unsafe { o.contents.result };
22466 unsafe { o.contents.result = core::ptr::null_mut() };
22467 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
22469 let err = unsafe { o.contents.err };
22470 unsafe { o.contents.err = core::ptr::null_mut(); }
22471 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
22475 result_ok: o.result_ok,
22479 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
22480 fn clone(&self) -> Self {
22481 if self.result_ok {
22482 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22483 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
22486 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22487 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
22493 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
22494 /// but with all dynamically-allocated buffers duplicated in new buffers.
22495 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
22497 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
22498 /// This corresponds to std::vector in C++
22499 pub struct CVec_TransactionZ {
22500 /// The elements in the array.
22501 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
22502 pub data: *mut crate::c_types::Transaction,
22503 /// The number of elements pointed to by `data`.
22506 impl CVec_TransactionZ {
22507 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
22508 if self.datalen == 0 { return Vec::new(); }
22509 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
22510 self.data = core::ptr::null_mut();
22514 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
22515 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
22518 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
22519 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
22520 let datalen = v.len();
22521 let data = Box::into_raw(v.into_boxed_slice());
22522 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
22526 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
22527 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
22528 impl Drop for CVec_TransactionZ {
22529 fn drop(&mut self) {
22530 if self.datalen == 0 { return; }
22531 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
22534 impl Clone for CVec_TransactionZ {
22535 fn clone(&self) -> Self {
22536 let mut res = Vec::new();
22537 if self.datalen == 0 { return Self::from(res); }
22538 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
22543 /// The contents of CResult_PaymentPurposeDecodeErrorZ
22544 pub union CResult_PaymentPurposeDecodeErrorZPtr {
22545 /// A pointer to the contents in the success state.
22546 /// Reading from this pointer when `result_ok` is not set is undefined.
22547 pub result: *mut crate::lightning::events::PaymentPurpose,
22548 /// A pointer to the contents in the error state.
22549 /// Reading from this pointer when `result_ok` is set is undefined.
22550 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22553 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
22554 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
22555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22556 pub struct CResult_PaymentPurposeDecodeErrorZ {
22557 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
22558 /// `err` or `result` depending on the state of `result_ok`.
22559 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
22560 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
22561 pub result_ok: bool,
22564 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
22565 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
22566 CResult_PaymentPurposeDecodeErrorZ {
22567 contents: CResult_PaymentPurposeDecodeErrorZPtr {
22568 result: Box::into_raw(Box::new(o)),
22574 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
22575 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
22576 CResult_PaymentPurposeDecodeErrorZ {
22577 contents: CResult_PaymentPurposeDecodeErrorZPtr {
22578 err: Box::into_raw(Box::new(e)),
22583 /// Checks if the given object is currently in the success state
22585 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
22589 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
22590 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
22591 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
22592 fn drop(&mut self) {
22593 if self.result_ok {
22594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22595 let _ = unsafe { Box::from_raw(self.contents.result) };
22598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22599 let _ = unsafe { Box::from_raw(self.contents.err) };
22604 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
22605 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
22606 let contents = if o.result_ok {
22607 let result = unsafe { o.contents.result };
22608 unsafe { o.contents.result = core::ptr::null_mut() };
22609 CResult_PaymentPurposeDecodeErrorZPtr { result }
22611 let err = unsafe { o.contents.err };
22612 unsafe { o.contents.err = core::ptr::null_mut(); }
22613 CResult_PaymentPurposeDecodeErrorZPtr { err }
22617 result_ok: o.result_ok,
22621 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
22622 fn clone(&self) -> Self {
22623 if self.result_ok {
22624 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
22625 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
22628 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
22629 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22635 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
22636 /// but with all dynamically-allocated buffers duplicated in new buffers.
22637 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
22639 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
22640 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
22641 /// A pointer to the contents in the success state.
22642 /// Reading from this pointer when `result_ok` is not set is undefined.
22643 pub result: *mut crate::lightning::events::ClaimedHTLC,
22644 /// A pointer to the contents in the error state.
22645 /// Reading from this pointer when `result_ok` is set is undefined.
22646 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22649 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
22650 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
22651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22652 pub struct CResult_ClaimedHTLCDecodeErrorZ {
22653 /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
22654 /// `err` or `result` depending on the state of `result_ok`.
22655 pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
22656 /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
22657 pub result_ok: bool,
22660 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
22661 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
22662 CResult_ClaimedHTLCDecodeErrorZ {
22663 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22664 result: Box::into_raw(Box::new(o)),
22670 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
22671 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
22672 CResult_ClaimedHTLCDecodeErrorZ {
22673 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22674 err: Box::into_raw(Box::new(e)),
22679 /// Checks if the given object is currently in the success state
22681 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
22685 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
22686 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
22687 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
22688 fn drop(&mut self) {
22689 if self.result_ok {
22690 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22691 let _ = unsafe { Box::from_raw(self.contents.result) };
22694 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22695 let _ = unsafe { Box::from_raw(self.contents.err) };
22700 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
22701 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
22702 let contents = if o.result_ok {
22703 let result = unsafe { o.contents.result };
22704 unsafe { o.contents.result = core::ptr::null_mut() };
22705 CResult_ClaimedHTLCDecodeErrorZPtr { result }
22707 let err = unsafe { o.contents.err };
22708 unsafe { o.contents.err = core::ptr::null_mut(); }
22709 CResult_ClaimedHTLCDecodeErrorZPtr { err }
22713 result_ok: o.result_ok,
22717 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
22718 fn clone(&self) -> Self {
22719 if self.result_ok {
22720 Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22721 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
22724 Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22725 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22731 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
22732 /// but with all dynamically-allocated buffers duplicated in new buffers.
22733 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
22736 /// An enum which can either contain a crate::lightning::events::PathFailure or not
22737 pub enum COption_PathFailureZ {
22738 /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
22739 Some(crate::lightning::events::PathFailure),
22740 /// When we're in this state, this COption_PathFailureZ contains nothing
22743 impl COption_PathFailureZ {
22744 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22745 if let Self::None = self { false } else { true }
22747 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22750 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
22751 if let Self::Some(v) = self { v } else { unreachable!() }
22755 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
22756 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
22757 COption_PathFailureZ::Some(o)
22760 /// Constructs a new COption_PathFailureZ containing nothing
22761 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
22762 COption_PathFailureZ::None
22765 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
22766 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
22768 /// Creates a new COption_PathFailureZ which has the same data as `orig`
22769 /// but with all dynamically-allocated buffers duplicated in new buffers.
22770 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
22772 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
22773 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
22774 /// A pointer to the contents in the success state.
22775 /// Reading from this pointer when `result_ok` is not set is undefined.
22776 pub result: *mut crate::c_types::derived::COption_PathFailureZ,
22777 /// A pointer to the contents in the error state.
22778 /// Reading from this pointer when `result_ok` is set is undefined.
22779 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22782 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
22783 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
22784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22785 pub struct CResult_COption_PathFailureZDecodeErrorZ {
22786 /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
22787 /// `err` or `result` depending on the state of `result_ok`.
22788 pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
22789 /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
22790 pub result_ok: bool,
22793 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
22794 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
22795 CResult_COption_PathFailureZDecodeErrorZ {
22796 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22797 result: Box::into_raw(Box::new(o)),
22803 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
22804 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
22805 CResult_COption_PathFailureZDecodeErrorZ {
22806 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22807 err: Box::into_raw(Box::new(e)),
22812 /// Checks if the given object is currently in the success state
22814 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
22818 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
22819 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
22820 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
22821 fn drop(&mut self) {
22822 if self.result_ok {
22823 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22824 let _ = unsafe { Box::from_raw(self.contents.result) };
22827 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22828 let _ = unsafe { Box::from_raw(self.contents.err) };
22833 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
22834 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
22835 let contents = if o.result_ok {
22836 let result = unsafe { o.contents.result };
22837 unsafe { o.contents.result = core::ptr::null_mut() };
22838 CResult_COption_PathFailureZDecodeErrorZPtr { result }
22840 let err = unsafe { o.contents.err };
22841 unsafe { o.contents.err = core::ptr::null_mut(); }
22842 CResult_COption_PathFailureZDecodeErrorZPtr { err }
22846 result_ok: o.result_ok,
22850 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
22851 fn clone(&self) -> Self {
22852 if self.result_ok {
22853 Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22854 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
22857 Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22858 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22864 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
22865 /// but with all dynamically-allocated buffers duplicated in new buffers.
22866 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
22869 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
22870 pub enum COption_ClosureReasonZ {
22871 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
22872 Some(crate::lightning::events::ClosureReason),
22873 /// When we're in this state, this COption_ClosureReasonZ contains nothing
22876 impl COption_ClosureReasonZ {
22877 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22878 if let Self::None = self { false } else { true }
22880 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22883 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
22884 if let Self::Some(v) = self { v } else { unreachable!() }
22888 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
22889 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
22890 COption_ClosureReasonZ::Some(o)
22893 /// Constructs a new COption_ClosureReasonZ containing nothing
22894 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
22895 COption_ClosureReasonZ::None
22898 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
22899 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
22901 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
22902 /// but with all dynamically-allocated buffers duplicated in new buffers.
22903 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
22905 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
22906 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
22907 /// A pointer to the contents in the success state.
22908 /// Reading from this pointer when `result_ok` is not set is undefined.
22909 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
22910 /// A pointer to the contents in the error state.
22911 /// Reading from this pointer when `result_ok` is set is undefined.
22912 pub err: *mut crate::lightning::ln::msgs::DecodeError,
22915 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
22916 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
22917 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22918 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
22919 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
22920 /// `err` or `result` depending on the state of `result_ok`.
22921 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
22922 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
22923 pub result_ok: bool,
22926 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
22927 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
22928 CResult_COption_ClosureReasonZDecodeErrorZ {
22929 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22930 result: Box::into_raw(Box::new(o)),
22936 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
22937 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
22938 CResult_COption_ClosureReasonZDecodeErrorZ {
22939 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22940 err: Box::into_raw(Box::new(e)),
22945 /// Checks if the given object is currently in the success state
22947 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
22951 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
22952 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
22953 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
22954 fn drop(&mut self) {
22955 if self.result_ok {
22956 if unsafe { !(self.contents.result as *mut ()).is_null() } {
22957 let _ = unsafe { Box::from_raw(self.contents.result) };
22960 if unsafe { !(self.contents.err as *mut ()).is_null() } {
22961 let _ = unsafe { Box::from_raw(self.contents.err) };
22966 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
22967 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
22968 let contents = if o.result_ok {
22969 let result = unsafe { o.contents.result };
22970 unsafe { o.contents.result = core::ptr::null_mut() };
22971 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
22973 let err = unsafe { o.contents.err };
22974 unsafe { o.contents.err = core::ptr::null_mut(); }
22975 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
22979 result_ok: o.result_ok,
22983 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
22984 fn clone(&self) -> Self {
22985 if self.result_ok {
22986 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22987 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
22990 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22991 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22997 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
22998 /// but with all dynamically-allocated buffers duplicated in new buffers.
22999 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
23002 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
23003 pub enum COption_HTLCDestinationZ {
23004 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
23005 Some(crate::lightning::events::HTLCDestination),
23006 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
23009 impl COption_HTLCDestinationZ {
23010 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23011 if let Self::None = self { false } else { true }
23013 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23016 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
23017 if let Self::Some(v) = self { v } else { unreachable!() }
23021 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
23022 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
23023 COption_HTLCDestinationZ::Some(o)
23026 /// Constructs a new COption_HTLCDestinationZ containing nothing
23027 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
23028 COption_HTLCDestinationZ::None
23031 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
23032 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
23034 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
23035 /// but with all dynamically-allocated buffers duplicated in new buffers.
23036 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
23038 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
23039 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23040 /// A pointer to the contents in the success state.
23041 /// Reading from this pointer when `result_ok` is not set is undefined.
23042 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
23043 /// A pointer to the contents in the error state.
23044 /// Reading from this pointer when `result_ok` is set is undefined.
23045 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23048 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
23049 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23051 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
23052 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
23053 /// `err` or `result` depending on the state of `result_ok`.
23054 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
23055 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
23056 pub result_ok: bool,
23059 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
23060 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
23061 CResult_COption_HTLCDestinationZDecodeErrorZ {
23062 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23063 result: Box::into_raw(Box::new(o)),
23069 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
23070 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
23071 CResult_COption_HTLCDestinationZDecodeErrorZ {
23072 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23073 err: Box::into_raw(Box::new(e)),
23078 /// Checks if the given object is currently in the success state
23080 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
23084 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
23085 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
23086 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
23087 fn drop(&mut self) {
23088 if self.result_ok {
23089 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23090 let _ = unsafe { Box::from_raw(self.contents.result) };
23093 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23094 let _ = unsafe { Box::from_raw(self.contents.err) };
23099 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
23100 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23101 let contents = if o.result_ok {
23102 let result = unsafe { o.contents.result };
23103 unsafe { o.contents.result = core::ptr::null_mut() };
23104 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
23106 let err = unsafe { o.contents.err };
23107 unsafe { o.contents.err = core::ptr::null_mut(); }
23108 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
23112 result_ok: o.result_ok,
23116 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
23117 fn clone(&self) -> Self {
23118 if self.result_ok {
23119 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23120 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
23123 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23124 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23130 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
23131 /// but with all dynamically-allocated buffers duplicated in new buffers.
23132 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
23134 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
23135 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
23136 /// A pointer to the contents in the success state.
23137 /// Reading from this pointer when `result_ok` is not set is undefined.
23138 pub result: *mut crate::lightning::events::PaymentFailureReason,
23139 /// A pointer to the contents in the error state.
23140 /// Reading from this pointer when `result_ok` is set is undefined.
23141 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23144 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
23145 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
23146 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23147 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
23148 /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
23149 /// `err` or `result` depending on the state of `result_ok`.
23150 pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
23151 /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
23152 pub result_ok: bool,
23155 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
23156 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
23157 CResult_PaymentFailureReasonDecodeErrorZ {
23158 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23159 result: Box::into_raw(Box::new(o)),
23165 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
23166 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
23167 CResult_PaymentFailureReasonDecodeErrorZ {
23168 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23169 err: Box::into_raw(Box::new(e)),
23174 /// Checks if the given object is currently in the success state
23176 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
23180 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
23181 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
23182 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
23183 fn drop(&mut self) {
23184 if self.result_ok {
23185 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23186 let _ = unsafe { Box::from_raw(self.contents.result) };
23189 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23190 let _ = unsafe { Box::from_raw(self.contents.err) };
23195 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
23196 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
23197 let contents = if o.result_ok {
23198 let result = unsafe { o.contents.result };
23199 unsafe { o.contents.result = core::ptr::null_mut() };
23200 CResult_PaymentFailureReasonDecodeErrorZPtr { result }
23202 let err = unsafe { o.contents.err };
23203 unsafe { o.contents.err = core::ptr::null_mut(); }
23204 CResult_PaymentFailureReasonDecodeErrorZPtr { err }
23208 result_ok: o.result_ok,
23212 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
23213 fn clone(&self) -> Self {
23214 if self.result_ok {
23215 Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23216 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
23219 Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23220 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23226 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
23227 /// but with all dynamically-allocated buffers duplicated in new buffers.
23228 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
23231 /// An enum which can either contain a crate::c_types::U128 or not
23232 pub enum COption_U128Z {
23233 /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
23234 Some(crate::c_types::U128),
23235 /// When we're in this state, this COption_U128Z contains nothing
23238 impl COption_U128Z {
23239 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23240 if let Self::None = self { false } else { true }
23242 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23245 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
23246 if let Self::Some(v) = self { v } else { unreachable!() }
23250 /// Constructs a new COption_U128Z containing a crate::c_types::U128
23251 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
23252 COption_U128Z::Some(o)
23255 /// Constructs a new COption_U128Z containing nothing
23256 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
23257 COption_U128Z::None
23260 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
23261 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
23263 /// Creates a new COption_U128Z which has the same data as `orig`
23264 /// but with all dynamically-allocated buffers duplicated in new buffers.
23265 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
23267 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
23268 /// This corresponds to std::vector in C++
23269 pub struct CVec_ClaimedHTLCZ {
23270 /// The elements in the array.
23271 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23272 pub data: *mut crate::lightning::events::ClaimedHTLC,
23273 /// The number of elements pointed to by `data`.
23276 impl CVec_ClaimedHTLCZ {
23277 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
23278 if self.datalen == 0 { return Vec::new(); }
23279 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23280 self.data = core::ptr::null_mut();
23284 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
23285 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23288 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
23289 fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
23290 let datalen = v.len();
23291 let data = Box::into_raw(v.into_boxed_slice());
23292 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23296 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23297 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
23298 impl Drop for CVec_ClaimedHTLCZ {
23299 fn drop(&mut self) {
23300 if self.datalen == 0 { return; }
23301 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23304 impl Clone for CVec_ClaimedHTLCZ {
23305 fn clone(&self) -> Self {
23306 let mut res = Vec::new();
23307 if self.datalen == 0 { return Self::from(res); }
23308 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23314 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
23315 pub enum COption_PaymentFailureReasonZ {
23316 /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
23317 Some(crate::lightning::events::PaymentFailureReason),
23318 /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
23321 impl COption_PaymentFailureReasonZ {
23322 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23323 if let Self::None = self { false } else { true }
23325 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23328 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
23329 if let Self::Some(v) = self { v } else { unreachable!() }
23333 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
23334 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
23335 COption_PaymentFailureReasonZ::Some(o)
23338 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
23339 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
23340 COption_PaymentFailureReasonZ::None
23343 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
23344 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
23346 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
23347 /// but with all dynamically-allocated buffers duplicated in new buffers.
23348 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
23351 /// An enum which can either contain a crate::lightning::events::Event or not
23352 pub enum COption_EventZ {
23353 /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
23354 Some(crate::lightning::events::Event),
23355 /// When we're in this state, this COption_EventZ contains nothing
23358 impl COption_EventZ {
23359 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23360 if let Self::None = self { false } else { true }
23362 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23365 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
23366 if let Self::Some(v) = self { v } else { unreachable!() }
23370 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
23371 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
23372 COption_EventZ::Some(o)
23375 /// Constructs a new COption_EventZ containing nothing
23376 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
23377 COption_EventZ::None
23380 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
23381 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
23383 /// Creates a new COption_EventZ which has the same data as `orig`
23384 /// but with all dynamically-allocated buffers duplicated in new buffers.
23385 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
23387 /// The contents of CResult_COption_EventZDecodeErrorZ
23388 pub union CResult_COption_EventZDecodeErrorZPtr {
23389 /// A pointer to the contents in the success state.
23390 /// Reading from this pointer when `result_ok` is not set is undefined.
23391 pub result: *mut crate::c_types::derived::COption_EventZ,
23392 /// A pointer to the contents in the error state.
23393 /// Reading from this pointer when `result_ok` is set is undefined.
23394 pub err: *mut crate::lightning::ln::msgs::DecodeError,
23397 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
23398 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23400 pub struct CResult_COption_EventZDecodeErrorZ {
23401 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
23402 /// `err` or `result` depending on the state of `result_ok`.
23403 pub contents: CResult_COption_EventZDecodeErrorZPtr,
23404 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
23405 pub result_ok: bool,
23408 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
23409 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
23410 CResult_COption_EventZDecodeErrorZ {
23411 contents: CResult_COption_EventZDecodeErrorZPtr {
23412 result: Box::into_raw(Box::new(o)),
23418 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
23419 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
23420 CResult_COption_EventZDecodeErrorZ {
23421 contents: CResult_COption_EventZDecodeErrorZPtr {
23422 err: Box::into_raw(Box::new(e)),
23427 /// Checks if the given object is currently in the success state
23429 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
23433 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
23434 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
23435 impl Drop for CResult_COption_EventZDecodeErrorZ {
23436 fn drop(&mut self) {
23437 if self.result_ok {
23438 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23439 let _ = unsafe { Box::from_raw(self.contents.result) };
23442 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23443 let _ = unsafe { Box::from_raw(self.contents.err) };
23448 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
23449 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23450 let contents = if o.result_ok {
23451 let result = unsafe { o.contents.result };
23452 unsafe { o.contents.result = core::ptr::null_mut() };
23453 CResult_COption_EventZDecodeErrorZPtr { result }
23455 let err = unsafe { o.contents.err };
23456 unsafe { o.contents.err = core::ptr::null_mut(); }
23457 CResult_COption_EventZDecodeErrorZPtr { err }
23461 result_ok: o.result_ok,
23465 impl Clone for CResult_COption_EventZDecodeErrorZ {
23466 fn clone(&self) -> Self {
23467 if self.result_ok {
23468 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
23469 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
23472 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
23473 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23479 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
23480 /// but with all dynamically-allocated buffers duplicated in new buffers.
23481 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
23483 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
23484 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
23485 /// A pointer to the contents in the success state.
23486 /// Reading from this pointer when `result_ok` is not set is undefined.
23487 pub result: *mut crate::lightning_invoice::SiPrefix,
23488 /// A pointer to the contents in the error state.
23489 /// Reading from this pointer when `result_ok` is set is undefined.
23490 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
23493 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
23494 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
23495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23496 pub struct CResult_SiPrefixBolt11ParseErrorZ {
23497 /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
23498 /// `err` or `result` depending on the state of `result_ok`.
23499 pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
23500 /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
23501 pub result_ok: bool,
23504 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
23505 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
23506 CResult_SiPrefixBolt11ParseErrorZ {
23507 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23508 result: Box::into_raw(Box::new(o)),
23514 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
23515 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
23516 CResult_SiPrefixBolt11ParseErrorZ {
23517 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23518 err: Box::into_raw(Box::new(e)),
23523 /// Checks if the given object is currently in the success state
23525 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
23529 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
23530 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
23531 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
23532 fn drop(&mut self) {
23533 if self.result_ok {
23534 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23535 let _ = unsafe { Box::from_raw(self.contents.result) };
23538 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23539 let _ = unsafe { Box::from_raw(self.contents.err) };
23544 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
23545 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
23546 let contents = if o.result_ok {
23547 let result = unsafe { o.contents.result };
23548 unsafe { o.contents.result = core::ptr::null_mut() };
23549 CResult_SiPrefixBolt11ParseErrorZPtr { result }
23551 let err = unsafe { o.contents.err };
23552 unsafe { o.contents.err = core::ptr::null_mut(); }
23553 CResult_SiPrefixBolt11ParseErrorZPtr { err }
23557 result_ok: o.result_ok,
23561 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
23562 fn clone(&self) -> Self {
23563 if self.result_ok {
23564 Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23565 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
23568 Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23569 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
23575 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
23576 /// but with all dynamically-allocated buffers duplicated in new buffers.
23577 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
23579 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
23580 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23581 /// A pointer to the contents in the success state.
23582 /// Reading from this pointer when `result_ok` is not set is undefined.
23583 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
23584 /// A pointer to the contents in the error state.
23585 /// Reading from this pointer when `result_ok` is set is undefined.
23586 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
23589 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
23590 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
23591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23592 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23593 /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
23594 /// `err` or `result` depending on the state of `result_ok`.
23595 pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
23596 /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
23597 pub result_ok: bool,
23600 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
23601 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23602 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23603 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23604 result: Box::into_raw(Box::new(o)),
23610 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
23611 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23612 CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23613 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23614 err: Box::into_raw(Box::new(e)),
23619 /// Checks if the given object is currently in the success state
23621 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
23625 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
23626 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
23627 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23628 fn drop(&mut self) {
23629 if self.result_ok {
23630 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23631 let _ = unsafe { Box::from_raw(self.contents.result) };
23634 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23635 let _ = unsafe { Box::from_raw(self.contents.err) };
23640 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23641 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
23642 let contents = if o.result_ok {
23643 let result = unsafe { o.contents.result };
23644 unsafe { o.contents.result = core::ptr::null_mut() };
23645 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
23647 let err = unsafe { o.contents.err };
23648 unsafe { o.contents.err = core::ptr::null_mut(); }
23649 CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
23653 result_ok: o.result_ok,
23657 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23658 fn clone(&self) -> Self {
23659 if self.result_ok {
23660 Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23661 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
23664 Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23665 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
23671 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
23672 /// but with all dynamically-allocated buffers duplicated in new buffers.
23673 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
23675 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
23676 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23677 /// A pointer to the contents in the success state.
23678 /// Reading from this pointer when `result_ok` is not set is undefined.
23679 pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
23680 /// A pointer to the contents in the error state.
23681 /// Reading from this pointer when `result_ok` is set is undefined.
23682 pub err: *mut crate::lightning_invoice::Bolt11ParseError,
23685 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
23686 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
23687 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23688 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23689 /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
23690 /// `err` or `result` depending on the state of `result_ok`.
23691 pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
23692 /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
23693 pub result_ok: bool,
23696 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
23697 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23698 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23699 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23700 result: Box::into_raw(Box::new(o)),
23706 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
23707 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23708 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23709 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23710 err: Box::into_raw(Box::new(e)),
23715 /// Checks if the given object is currently in the success state
23717 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
23721 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
23722 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
23723 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23724 fn drop(&mut self) {
23725 if self.result_ok {
23726 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23727 let _ = unsafe { Box::from_raw(self.contents.result) };
23730 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23731 let _ = unsafe { Box::from_raw(self.contents.err) };
23736 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23737 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
23738 let contents = if o.result_ok {
23739 let result = unsafe { o.contents.result };
23740 unsafe { o.contents.result = core::ptr::null_mut() };
23741 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
23743 let err = unsafe { o.contents.err };
23744 unsafe { o.contents.err = core::ptr::null_mut(); }
23745 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
23749 result_ok: o.result_ok,
23753 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23754 fn clone(&self) -> Self {
23755 if self.result_ok {
23756 Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23757 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
23760 Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23761 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
23767 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
23768 /// but with all dynamically-allocated buffers duplicated in new buffers.
23769 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
23771 /// A tuple of 3 elements. See the individual fields for the types contained.
23772 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23773 /// The element at position 0
23774 pub a: crate::lightning_invoice::RawBolt11Invoice,
23775 /// The element at position 1
23776 pub b: crate::c_types::ThirtyTwoBytes,
23777 /// The element at position 2
23778 pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
23780 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23781 fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
23789 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23790 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
23791 (self.a, self.b, self.c)
23794 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23795 fn clone(&self) -> Self {
23797 a: Clone::clone(&self.a),
23798 b: Clone::clone(&self.b),
23799 c: Clone::clone(&self.c),
23804 /// Creates a new tuple which has the same data as `orig`
23805 /// but with all dynamically-allocated buffers duplicated in new buffers.
23806 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
23807 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
23809 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 {
23810 C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
23814 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
23815 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
23817 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
23818 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
23819 /// A pointer to the contents in the success state.
23820 /// Reading from this pointer when `result_ok` is not set is undefined.
23821 pub result: *mut crate::lightning_invoice::PayeePubKey,
23822 /// A pointer to the contents in the error state.
23823 /// Reading from this pointer when `result_ok` is set is undefined.
23824 pub err: *mut crate::c_types::Secp256k1Error,
23827 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
23828 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
23829 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23830 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
23831 /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
23832 /// `err` or `result` depending on the state of `result_ok`.
23833 pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
23834 /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
23835 pub result_ok: bool,
23838 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
23839 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
23840 CResult_PayeePubKeySecp256k1ErrorZ {
23841 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23842 result: Box::into_raw(Box::new(o)),
23848 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
23849 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
23850 CResult_PayeePubKeySecp256k1ErrorZ {
23851 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23852 err: Box::into_raw(Box::new(e)),
23857 /// Checks if the given object is currently in the success state
23859 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
23863 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
23864 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
23865 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
23866 fn drop(&mut self) {
23867 if self.result_ok {
23868 if unsafe { !(self.contents.result as *mut ()).is_null() } {
23869 let _ = unsafe { Box::from_raw(self.contents.result) };
23872 if unsafe { !(self.contents.err as *mut ()).is_null() } {
23873 let _ = unsafe { Box::from_raw(self.contents.err) };
23878 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
23879 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
23880 let contents = if o.result_ok {
23881 let result = unsafe { o.contents.result };
23882 unsafe { o.contents.result = core::ptr::null_mut() };
23883 CResult_PayeePubKeySecp256k1ErrorZPtr { result }
23885 let err = unsafe { o.contents.err };
23886 unsafe { o.contents.err = core::ptr::null_mut(); }
23887 CResult_PayeePubKeySecp256k1ErrorZPtr { err }
23891 result_ok: o.result_ok,
23895 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
23896 fn clone(&self) -> Self {
23897 if self.result_ok {
23898 Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23899 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
23902 Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23903 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
23909 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
23910 /// but with all dynamically-allocated buffers duplicated in new buffers.
23911 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
23913 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
23914 /// This corresponds to std::vector in C++
23915 pub struct CVec_PrivateRouteZ {
23916 /// The elements in the array.
23917 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23918 pub data: *mut crate::lightning_invoice::PrivateRoute,
23919 /// The number of elements pointed to by `data`.
23922 impl CVec_PrivateRouteZ {
23923 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
23924 if self.datalen == 0 { return Vec::new(); }
23925 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23926 self.data = core::ptr::null_mut();
23930 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
23931 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23934 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
23935 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
23936 let datalen = v.len();
23937 let data = Box::into_raw(v.into_boxed_slice());
23938 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23942 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23943 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
23944 impl Drop for CVec_PrivateRouteZ {
23945 fn drop(&mut self) {
23946 if self.datalen == 0 { return; }
23947 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23950 impl Clone for CVec_PrivateRouteZ {
23951 fn clone(&self) -> Self {
23952 let mut res = Vec::new();
23953 if self.datalen == 0 { return Self::from(res); }
23954 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23959 /// The contents of CResult_PositiveTimestampCreationErrorZ
23960 pub union CResult_PositiveTimestampCreationErrorZPtr {
23961 /// A pointer to the contents in the success state.
23962 /// Reading from this pointer when `result_ok` is not set is undefined.
23963 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
23964 /// A pointer to the contents in the error state.
23965 /// Reading from this pointer when `result_ok` is set is undefined.
23966 pub err: *mut crate::lightning_invoice::CreationError,
23969 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
23970 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
23971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23972 pub struct CResult_PositiveTimestampCreationErrorZ {
23973 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
23974 /// `err` or `result` depending on the state of `result_ok`.
23975 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
23976 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
23977 pub result_ok: bool,
23980 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
23981 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
23982 CResult_PositiveTimestampCreationErrorZ {
23983 contents: CResult_PositiveTimestampCreationErrorZPtr {
23984 result: Box::into_raw(Box::new(o)),
23990 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
23991 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
23992 CResult_PositiveTimestampCreationErrorZ {
23993 contents: CResult_PositiveTimestampCreationErrorZPtr {
23994 err: Box::into_raw(Box::new(e)),
23999 /// Checks if the given object is currently in the success state
24001 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
24005 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
24006 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
24007 impl Drop for CResult_PositiveTimestampCreationErrorZ {
24008 fn drop(&mut self) {
24009 if self.result_ok {
24010 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24011 let _ = unsafe { Box::from_raw(self.contents.result) };
24014 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24015 let _ = unsafe { Box::from_raw(self.contents.err) };
24020 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
24021 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
24022 let contents = if o.result_ok {
24023 let result = unsafe { o.contents.result };
24024 unsafe { o.contents.result = core::ptr::null_mut() };
24025 CResult_PositiveTimestampCreationErrorZPtr { result }
24027 let err = unsafe { o.contents.err };
24028 unsafe { o.contents.err = core::ptr::null_mut(); }
24029 CResult_PositiveTimestampCreationErrorZPtr { err }
24033 result_ok: o.result_ok,
24037 impl Clone for CResult_PositiveTimestampCreationErrorZ {
24038 fn clone(&self) -> Self {
24039 if self.result_ok {
24040 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
24041 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
24044 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
24045 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24051 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
24052 /// but with all dynamically-allocated buffers duplicated in new buffers.
24053 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
24055 /// The contents of CResult_NoneBolt11SemanticErrorZ
24056 pub union CResult_NoneBolt11SemanticErrorZPtr {
24057 /// Note that this value is always NULL, as there are no contents in the OK variant
24058 pub result: *mut core::ffi::c_void,
24059 /// A pointer to the contents in the error state.
24060 /// Reading from this pointer when `result_ok` is set is undefined.
24061 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
24064 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
24065 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
24066 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24067 pub struct CResult_NoneBolt11SemanticErrorZ {
24068 /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
24069 /// `err` or `result` depending on the state of `result_ok`.
24070 pub contents: CResult_NoneBolt11SemanticErrorZPtr,
24071 /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
24072 pub result_ok: bool,
24075 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
24076 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
24077 CResult_NoneBolt11SemanticErrorZ {
24078 contents: CResult_NoneBolt11SemanticErrorZPtr {
24079 result: core::ptr::null_mut(),
24085 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
24086 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
24087 CResult_NoneBolt11SemanticErrorZ {
24088 contents: CResult_NoneBolt11SemanticErrorZPtr {
24089 err: Box::into_raw(Box::new(e)),
24094 /// Checks if the given object is currently in the success state
24096 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
24100 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
24101 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
24102 impl Drop for CResult_NoneBolt11SemanticErrorZ {
24103 fn drop(&mut self) {
24104 if self.result_ok {
24106 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24107 let _ = unsafe { Box::from_raw(self.contents.err) };
24112 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
24113 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
24114 let contents = if o.result_ok {
24115 let _ = unsafe { Box::from_raw(o.contents.result) };
24116 o.contents.result = core::ptr::null_mut();
24117 CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
24119 let err = unsafe { o.contents.err };
24120 unsafe { o.contents.err = core::ptr::null_mut(); }
24121 CResult_NoneBolt11SemanticErrorZPtr { err }
24125 result_ok: o.result_ok,
24129 impl Clone for CResult_NoneBolt11SemanticErrorZ {
24130 fn clone(&self) -> Self {
24131 if self.result_ok {
24132 Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
24133 result: core::ptr::null_mut()
24136 Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
24137 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
24143 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
24144 /// but with all dynamically-allocated buffers duplicated in new buffers.
24145 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
24147 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
24148 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24149 /// A pointer to the contents in the success state.
24150 /// Reading from this pointer when `result_ok` is not set is undefined.
24151 pub result: *mut crate::lightning_invoice::Bolt11Invoice,
24152 /// A pointer to the contents in the error state.
24153 /// Reading from this pointer when `result_ok` is set is undefined.
24154 pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
24157 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
24158 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
24159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24160 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24161 /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
24162 /// `err` or `result` depending on the state of `result_ok`.
24163 pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
24164 /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
24165 pub result_ok: bool,
24168 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
24169 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24170 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24171 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24172 result: Box::into_raw(Box::new(o)),
24178 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
24179 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24180 CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24181 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24182 err: Box::into_raw(Box::new(e)),
24187 /// Checks if the given object is currently in the success state
24189 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
24193 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
24194 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
24195 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24196 fn drop(&mut self) {
24197 if self.result_ok {
24198 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24199 let _ = unsafe { Box::from_raw(self.contents.result) };
24202 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24203 let _ = unsafe { Box::from_raw(self.contents.err) };
24208 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24209 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
24210 let contents = if o.result_ok {
24211 let result = unsafe { o.contents.result };
24212 unsafe { o.contents.result = core::ptr::null_mut() };
24213 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
24215 let err = unsafe { o.contents.err };
24216 unsafe { o.contents.err = core::ptr::null_mut(); }
24217 CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
24221 result_ok: o.result_ok,
24225 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24226 fn clone(&self) -> Self {
24227 if self.result_ok {
24228 Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24229 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
24232 Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24233 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
24239 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
24240 /// but with all dynamically-allocated buffers duplicated in new buffers.
24241 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
24243 /// The contents of CResult_DescriptionCreationErrorZ
24244 pub union CResult_DescriptionCreationErrorZPtr {
24245 /// A pointer to the contents in the success state.
24246 /// Reading from this pointer when `result_ok` is not set is undefined.
24247 pub result: *mut crate::lightning_invoice::Description,
24248 /// A pointer to the contents in the error state.
24249 /// Reading from this pointer when `result_ok` is set is undefined.
24250 pub err: *mut crate::lightning_invoice::CreationError,
24253 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
24254 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
24255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24256 pub struct CResult_DescriptionCreationErrorZ {
24257 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
24258 /// `err` or `result` depending on the state of `result_ok`.
24259 pub contents: CResult_DescriptionCreationErrorZPtr,
24260 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
24261 pub result_ok: bool,
24264 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
24265 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
24266 CResult_DescriptionCreationErrorZ {
24267 contents: CResult_DescriptionCreationErrorZPtr {
24268 result: Box::into_raw(Box::new(o)),
24274 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
24275 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
24276 CResult_DescriptionCreationErrorZ {
24277 contents: CResult_DescriptionCreationErrorZPtr {
24278 err: Box::into_raw(Box::new(e)),
24283 /// Checks if the given object is currently in the success state
24285 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
24289 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
24290 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
24291 impl Drop for CResult_DescriptionCreationErrorZ {
24292 fn drop(&mut self) {
24293 if self.result_ok {
24294 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24295 let _ = unsafe { Box::from_raw(self.contents.result) };
24298 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24299 let _ = unsafe { Box::from_raw(self.contents.err) };
24304 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
24305 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
24306 let contents = if o.result_ok {
24307 let result = unsafe { o.contents.result };
24308 unsafe { o.contents.result = core::ptr::null_mut() };
24309 CResult_DescriptionCreationErrorZPtr { result }
24311 let err = unsafe { o.contents.err };
24312 unsafe { o.contents.err = core::ptr::null_mut(); }
24313 CResult_DescriptionCreationErrorZPtr { err }
24317 result_ok: o.result_ok,
24321 impl Clone for CResult_DescriptionCreationErrorZ {
24322 fn clone(&self) -> Self {
24323 if self.result_ok {
24324 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
24325 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
24328 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
24329 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24335 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
24336 /// but with all dynamically-allocated buffers duplicated in new buffers.
24337 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
24339 /// The contents of CResult_PrivateRouteCreationErrorZ
24340 pub union CResult_PrivateRouteCreationErrorZPtr {
24341 /// A pointer to the contents in the success state.
24342 /// Reading from this pointer when `result_ok` is not set is undefined.
24343 pub result: *mut crate::lightning_invoice::PrivateRoute,
24344 /// A pointer to the contents in the error state.
24345 /// Reading from this pointer when `result_ok` is set is undefined.
24346 pub err: *mut crate::lightning_invoice::CreationError,
24349 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
24350 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
24351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24352 pub struct CResult_PrivateRouteCreationErrorZ {
24353 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
24354 /// `err` or `result` depending on the state of `result_ok`.
24355 pub contents: CResult_PrivateRouteCreationErrorZPtr,
24356 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
24357 pub result_ok: bool,
24360 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
24361 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
24362 CResult_PrivateRouteCreationErrorZ {
24363 contents: CResult_PrivateRouteCreationErrorZPtr {
24364 result: Box::into_raw(Box::new(o)),
24370 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
24371 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
24372 CResult_PrivateRouteCreationErrorZ {
24373 contents: CResult_PrivateRouteCreationErrorZPtr {
24374 err: Box::into_raw(Box::new(e)),
24379 /// Checks if the given object is currently in the success state
24381 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
24385 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
24386 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
24387 impl Drop for CResult_PrivateRouteCreationErrorZ {
24388 fn drop(&mut self) {
24389 if self.result_ok {
24390 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24391 let _ = unsafe { Box::from_raw(self.contents.result) };
24394 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24395 let _ = unsafe { Box::from_raw(self.contents.err) };
24400 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
24401 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
24402 let contents = if o.result_ok {
24403 let result = unsafe { o.contents.result };
24404 unsafe { o.contents.result = core::ptr::null_mut() };
24405 CResult_PrivateRouteCreationErrorZPtr { result }
24407 let err = unsafe { o.contents.err };
24408 unsafe { o.contents.err = core::ptr::null_mut(); }
24409 CResult_PrivateRouteCreationErrorZPtr { err }
24413 result_ok: o.result_ok,
24417 impl Clone for CResult_PrivateRouteCreationErrorZ {
24418 fn clone(&self) -> Self {
24419 if self.result_ok {
24420 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
24421 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
24424 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
24425 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24431 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
24432 /// but with all dynamically-allocated buffers duplicated in new buffers.
24433 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
24435 /// The contents of CResult_OutPointDecodeErrorZ
24436 pub union CResult_OutPointDecodeErrorZPtr {
24437 /// A pointer to the contents in the success state.
24438 /// Reading from this pointer when `result_ok` is not set is undefined.
24439 pub result: *mut crate::lightning::chain::transaction::OutPoint,
24440 /// A pointer to the contents in the error state.
24441 /// Reading from this pointer when `result_ok` is set is undefined.
24442 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24445 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
24446 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
24447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24448 pub struct CResult_OutPointDecodeErrorZ {
24449 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
24450 /// `err` or `result` depending on the state of `result_ok`.
24451 pub contents: CResult_OutPointDecodeErrorZPtr,
24452 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
24453 pub result_ok: bool,
24456 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
24457 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
24458 CResult_OutPointDecodeErrorZ {
24459 contents: CResult_OutPointDecodeErrorZPtr {
24460 result: Box::into_raw(Box::new(o)),
24466 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
24467 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
24468 CResult_OutPointDecodeErrorZ {
24469 contents: CResult_OutPointDecodeErrorZPtr {
24470 err: Box::into_raw(Box::new(e)),
24475 /// Checks if the given object is currently in the success state
24477 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
24481 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
24482 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
24483 impl Drop for CResult_OutPointDecodeErrorZ {
24484 fn drop(&mut self) {
24485 if self.result_ok {
24486 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24487 let _ = unsafe { Box::from_raw(self.contents.result) };
24490 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24491 let _ = unsafe { Box::from_raw(self.contents.err) };
24496 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
24497 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
24498 let contents = if o.result_ok {
24499 let result = unsafe { o.contents.result };
24500 unsafe { o.contents.result = core::ptr::null_mut() };
24501 CResult_OutPointDecodeErrorZPtr { result }
24503 let err = unsafe { o.contents.err };
24504 unsafe { o.contents.err = core::ptr::null_mut(); }
24505 CResult_OutPointDecodeErrorZPtr { err }
24509 result_ok: o.result_ok,
24513 impl Clone for CResult_OutPointDecodeErrorZ {
24514 fn clone(&self) -> Self {
24515 if self.result_ok {
24516 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
24517 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
24520 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
24521 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24527 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
24528 /// but with all dynamically-allocated buffers duplicated in new buffers.
24529 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
24531 /// The contents of CResult_BigSizeDecodeErrorZ
24532 pub union CResult_BigSizeDecodeErrorZPtr {
24533 /// A pointer to the contents in the success state.
24534 /// Reading from this pointer when `result_ok` is not set is undefined.
24535 pub result: *mut crate::lightning::util::ser::BigSize,
24536 /// A pointer to the contents in the error state.
24537 /// Reading from this pointer when `result_ok` is set is undefined.
24538 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24541 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
24542 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
24543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24544 pub struct CResult_BigSizeDecodeErrorZ {
24545 /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
24546 /// `err` or `result` depending on the state of `result_ok`.
24547 pub contents: CResult_BigSizeDecodeErrorZPtr,
24548 /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
24549 pub result_ok: bool,
24552 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
24553 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
24554 CResult_BigSizeDecodeErrorZ {
24555 contents: CResult_BigSizeDecodeErrorZPtr {
24556 result: Box::into_raw(Box::new(o)),
24562 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
24563 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
24564 CResult_BigSizeDecodeErrorZ {
24565 contents: CResult_BigSizeDecodeErrorZPtr {
24566 err: Box::into_raw(Box::new(e)),
24571 /// Checks if the given object is currently in the success state
24573 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
24577 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
24578 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
24579 impl Drop for CResult_BigSizeDecodeErrorZ {
24580 fn drop(&mut self) {
24581 if self.result_ok {
24582 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24583 let _ = unsafe { Box::from_raw(self.contents.result) };
24586 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24587 let _ = unsafe { Box::from_raw(self.contents.err) };
24592 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
24593 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
24594 let contents = if o.result_ok {
24595 let result = unsafe { o.contents.result };
24596 unsafe { o.contents.result = core::ptr::null_mut() };
24597 CResult_BigSizeDecodeErrorZPtr { result }
24599 let err = unsafe { o.contents.err };
24600 unsafe { o.contents.err = core::ptr::null_mut(); }
24601 CResult_BigSizeDecodeErrorZPtr { err }
24605 result_ok: o.result_ok,
24609 impl Clone for CResult_BigSizeDecodeErrorZ {
24610 fn clone(&self) -> Self {
24611 if self.result_ok {
24612 Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
24613 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
24616 Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
24617 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24623 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
24624 /// but with all dynamically-allocated buffers duplicated in new buffers.
24625 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
24627 /// The contents of CResult_HostnameDecodeErrorZ
24628 pub union CResult_HostnameDecodeErrorZPtr {
24629 /// A pointer to the contents in the success state.
24630 /// Reading from this pointer when `result_ok` is not set is undefined.
24631 pub result: *mut crate::lightning::util::ser::Hostname,
24632 /// A pointer to the contents in the error state.
24633 /// Reading from this pointer when `result_ok` is set is undefined.
24634 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24637 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
24638 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
24639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24640 pub struct CResult_HostnameDecodeErrorZ {
24641 /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
24642 /// `err` or `result` depending on the state of `result_ok`.
24643 pub contents: CResult_HostnameDecodeErrorZPtr,
24644 /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
24645 pub result_ok: bool,
24648 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
24649 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
24650 CResult_HostnameDecodeErrorZ {
24651 contents: CResult_HostnameDecodeErrorZPtr {
24652 result: Box::into_raw(Box::new(o)),
24658 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
24659 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
24660 CResult_HostnameDecodeErrorZ {
24661 contents: CResult_HostnameDecodeErrorZPtr {
24662 err: Box::into_raw(Box::new(e)),
24667 /// Checks if the given object is currently in the success state
24669 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
24673 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
24674 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
24675 impl Drop for CResult_HostnameDecodeErrorZ {
24676 fn drop(&mut self) {
24677 if self.result_ok {
24678 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24679 let _ = unsafe { Box::from_raw(self.contents.result) };
24682 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24683 let _ = unsafe { Box::from_raw(self.contents.err) };
24688 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
24689 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
24690 let contents = if o.result_ok {
24691 let result = unsafe { o.contents.result };
24692 unsafe { o.contents.result = core::ptr::null_mut() };
24693 CResult_HostnameDecodeErrorZPtr { result }
24695 let err = unsafe { o.contents.err };
24696 unsafe { o.contents.err = core::ptr::null_mut(); }
24697 CResult_HostnameDecodeErrorZPtr { err }
24701 result_ok: o.result_ok,
24705 impl Clone for CResult_HostnameDecodeErrorZ {
24706 fn clone(&self) -> Self {
24707 if self.result_ok {
24708 Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
24709 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
24712 Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
24713 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24719 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
24720 /// but with all dynamically-allocated buffers duplicated in new buffers.
24721 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
24723 /// The contents of CResult_TransactionU16LenLimitedNoneZ
24724 pub union CResult_TransactionU16LenLimitedNoneZPtr {
24725 /// A pointer to the contents in the success state.
24726 /// Reading from this pointer when `result_ok` is not set is undefined.
24727 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
24728 /// Note that this value is always NULL, as there are no contents in the Err variant
24729 pub err: *mut core::ffi::c_void,
24732 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
24733 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
24734 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24735 pub struct CResult_TransactionU16LenLimitedNoneZ {
24736 /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
24737 /// `err` or `result` depending on the state of `result_ok`.
24738 pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
24739 /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
24740 pub result_ok: bool,
24743 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
24744 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
24745 CResult_TransactionU16LenLimitedNoneZ {
24746 contents: CResult_TransactionU16LenLimitedNoneZPtr {
24747 result: Box::into_raw(Box::new(o)),
24753 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
24754 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
24755 CResult_TransactionU16LenLimitedNoneZ {
24756 contents: CResult_TransactionU16LenLimitedNoneZPtr {
24757 err: core::ptr::null_mut(),
24762 /// Checks if the given object is currently in the success state
24764 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
24768 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
24769 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
24770 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
24771 fn drop(&mut self) {
24772 if self.result_ok {
24773 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24774 let _ = unsafe { Box::from_raw(self.contents.result) };
24780 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
24781 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
24782 let contents = if o.result_ok {
24783 let result = unsafe { o.contents.result };
24784 unsafe { o.contents.result = core::ptr::null_mut() };
24785 CResult_TransactionU16LenLimitedNoneZPtr { result }
24787 let _ = unsafe { Box::from_raw(o.contents.err) };
24788 o.contents.err = core::ptr::null_mut();
24789 CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
24793 result_ok: o.result_ok,
24797 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
24798 fn clone(&self) -> Self {
24799 if self.result_ok {
24800 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
24801 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
24804 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
24805 err: core::ptr::null_mut()
24811 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
24812 /// but with all dynamically-allocated buffers duplicated in new buffers.
24813 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
24815 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
24816 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24817 /// A pointer to the contents in the success state.
24818 /// Reading from this pointer when `result_ok` is not set is undefined.
24819 pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
24820 /// A pointer to the contents in the error state.
24821 /// Reading from this pointer when `result_ok` is set is undefined.
24822 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24825 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
24826 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
24827 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24828 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
24829 /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
24830 /// `err` or `result` depending on the state of `result_ok`.
24831 pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
24832 /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
24833 pub result_ok: bool,
24836 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
24837 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
24838 CResult_TransactionU16LenLimitedDecodeErrorZ {
24839 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24840 result: Box::into_raw(Box::new(o)),
24846 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
24847 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
24848 CResult_TransactionU16LenLimitedDecodeErrorZ {
24849 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24850 err: Box::into_raw(Box::new(e)),
24855 /// Checks if the given object is currently in the success state
24857 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
24861 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
24862 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
24863 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
24864 fn drop(&mut self) {
24865 if self.result_ok {
24866 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24867 let _ = unsafe { Box::from_raw(self.contents.result) };
24870 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24871 let _ = unsafe { Box::from_raw(self.contents.err) };
24876 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
24877 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
24878 let contents = if o.result_ok {
24879 let result = unsafe { o.contents.result };
24880 unsafe { o.contents.result = core::ptr::null_mut() };
24881 CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
24883 let err = unsafe { o.contents.err };
24884 unsafe { o.contents.err = core::ptr::null_mut(); }
24885 CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
24889 result_ok: o.result_ok,
24893 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
24894 fn clone(&self) -> Self {
24895 if self.result_ok {
24896 Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24897 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
24900 Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24901 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24907 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
24908 /// but with all dynamically-allocated buffers duplicated in new buffers.
24909 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
24911 /// The contents of CResult_UntrustedStringDecodeErrorZ
24912 pub union CResult_UntrustedStringDecodeErrorZPtr {
24913 /// A pointer to the contents in the success state.
24914 /// Reading from this pointer when `result_ok` is not set is undefined.
24915 pub result: *mut crate::lightning::util::string::UntrustedString,
24916 /// A pointer to the contents in the error state.
24917 /// Reading from this pointer when `result_ok` is set is undefined.
24918 pub err: *mut crate::lightning::ln::msgs::DecodeError,
24921 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
24922 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
24923 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24924 pub struct CResult_UntrustedStringDecodeErrorZ {
24925 /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
24926 /// `err` or `result` depending on the state of `result_ok`.
24927 pub contents: CResult_UntrustedStringDecodeErrorZPtr,
24928 /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
24929 pub result_ok: bool,
24932 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
24933 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
24934 CResult_UntrustedStringDecodeErrorZ {
24935 contents: CResult_UntrustedStringDecodeErrorZPtr {
24936 result: Box::into_raw(Box::new(o)),
24942 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
24943 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
24944 CResult_UntrustedStringDecodeErrorZ {
24945 contents: CResult_UntrustedStringDecodeErrorZPtr {
24946 err: Box::into_raw(Box::new(e)),
24951 /// Checks if the given object is currently in the success state
24953 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
24957 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
24958 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
24959 impl Drop for CResult_UntrustedStringDecodeErrorZ {
24960 fn drop(&mut self) {
24961 if self.result_ok {
24962 if unsafe { !(self.contents.result as *mut ()).is_null() } {
24963 let _ = unsafe { Box::from_raw(self.contents.result) };
24966 if unsafe { !(self.contents.err as *mut ()).is_null() } {
24967 let _ = unsafe { Box::from_raw(self.contents.err) };
24972 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
24973 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
24974 let contents = if o.result_ok {
24975 let result = unsafe { o.contents.result };
24976 unsafe { o.contents.result = core::ptr::null_mut() };
24977 CResult_UntrustedStringDecodeErrorZPtr { result }
24979 let err = unsafe { o.contents.err };
24980 unsafe { o.contents.err = core::ptr::null_mut(); }
24981 CResult_UntrustedStringDecodeErrorZPtr { err }
24985 result_ok: o.result_ok,
24989 impl Clone for CResult_UntrustedStringDecodeErrorZ {
24990 fn clone(&self) -> Self {
24991 if self.result_ok {
24992 Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
24993 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
24996 Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
24997 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25003 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
25004 /// but with all dynamically-allocated buffers duplicated in new buffers.
25005 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
25007 /// The contents of CResult_ChannelIdDecodeErrorZ
25008 pub union CResult_ChannelIdDecodeErrorZPtr {
25009 /// A pointer to the contents in the success state.
25010 /// Reading from this pointer when `result_ok` is not set is undefined.
25011 pub result: *mut crate::lightning::ln::types::ChannelId,
25012 /// A pointer to the contents in the error state.
25013 /// Reading from this pointer when `result_ok` is set is undefined.
25014 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25017 /// A CResult_ChannelIdDecodeErrorZ represents the result of a fallible operation,
25018 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::ln::msgs::DecodeError on failure.
25019 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25020 pub struct CResult_ChannelIdDecodeErrorZ {
25021 /// The contents of this CResult_ChannelIdDecodeErrorZ, accessible via either
25022 /// `err` or `result` depending on the state of `result_ok`.
25023 pub contents: CResult_ChannelIdDecodeErrorZPtr,
25024 /// Whether this CResult_ChannelIdDecodeErrorZ represents a success state.
25025 pub result_ok: bool,
25028 /// Creates a new CResult_ChannelIdDecodeErrorZ in the success state.
25029 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdDecodeErrorZ {
25030 CResult_ChannelIdDecodeErrorZ {
25031 contents: CResult_ChannelIdDecodeErrorZPtr {
25032 result: Box::into_raw(Box::new(o)),
25038 /// Creates a new CResult_ChannelIdDecodeErrorZ in the error state.
25039 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelIdDecodeErrorZ {
25040 CResult_ChannelIdDecodeErrorZ {
25041 contents: CResult_ChannelIdDecodeErrorZPtr {
25042 err: Box::into_raw(Box::new(e)),
25047 /// Checks if the given object is currently in the success state
25049 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_is_ok(o: &CResult_ChannelIdDecodeErrorZ) -> bool {
25053 /// Frees any resources used by the CResult_ChannelIdDecodeErrorZ.
25054 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_free(_res: CResult_ChannelIdDecodeErrorZ) { }
25055 impl Drop for CResult_ChannelIdDecodeErrorZ {
25056 fn drop(&mut self) {
25057 if self.result_ok {
25058 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25059 let _ = unsafe { Box::from_raw(self.contents.result) };
25062 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25063 let _ = unsafe { Box::from_raw(self.contents.err) };
25068 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelIdDecodeErrorZ {
25069 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>) -> Self {
25070 let contents = if o.result_ok {
25071 let result = unsafe { o.contents.result };
25072 unsafe { o.contents.result = core::ptr::null_mut() };
25073 CResult_ChannelIdDecodeErrorZPtr { result }
25075 let err = unsafe { o.contents.err };
25076 unsafe { o.contents.err = core::ptr::null_mut(); }
25077 CResult_ChannelIdDecodeErrorZPtr { err }
25081 result_ok: o.result_ok,
25085 impl Clone for CResult_ChannelIdDecodeErrorZ {
25086 fn clone(&self) -> Self {
25087 if self.result_ok {
25088 Self { result_ok: true, contents: CResult_ChannelIdDecodeErrorZPtr {
25089 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
25092 Self { result_ok: false, contents: CResult_ChannelIdDecodeErrorZPtr {
25093 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25099 /// Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig`
25100 /// but with all dynamically-allocated buffers duplicated in new buffers.
25101 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_clone(orig: &CResult_ChannelIdDecodeErrorZ) -> CResult_ChannelIdDecodeErrorZ { Clone::clone(&orig) }
25103 /// A tuple of 2 elements. See the individual fields for the types contained.
25104 pub struct C2Tuple__u832u16Z {
25105 /// The element at position 0
25106 pub a: crate::c_types::ThirtyTwoBytes,
25107 /// The element at position 1
25110 impl From<(crate::c_types::ThirtyTwoBytes, u16)> for C2Tuple__u832u16Z {
25111 fn from (tup: (crate::c_types::ThirtyTwoBytes, u16)) -> Self {
25118 impl C2Tuple__u832u16Z {
25119 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u16) {
25123 impl Clone for C2Tuple__u832u16Z {
25124 fn clone(&self) -> Self {
25126 a: Clone::clone(&self.a),
25127 b: Clone::clone(&self.b),
25132 /// Creates a new tuple which has the same data as `orig`
25133 /// but with all dynamically-allocated buffers duplicated in new buffers.
25134 pub extern "C" fn C2Tuple__u832u16Z_clone(orig: &C2Tuple__u832u16Z) -> C2Tuple__u832u16Z { Clone::clone(&orig) }
25135 /// Creates a new C2Tuple__u832u16Z from the contained elements.
25137 pub extern "C" fn C2Tuple__u832u16Z_new(a: crate::c_types::ThirtyTwoBytes, b: u16) -> C2Tuple__u832u16Z {
25138 C2Tuple__u832u16Z { a, b, }
25142 /// Frees any resources used by the C2Tuple__u832u16Z.
25143 pub extern "C" fn C2Tuple__u832u16Z_free(_res: C2Tuple__u832u16Z) { }
25145 /// The contents of CResult_PaymentRelayDecodeErrorZ
25146 pub union CResult_PaymentRelayDecodeErrorZPtr {
25147 /// A pointer to the contents in the success state.
25148 /// Reading from this pointer when `result_ok` is not set is undefined.
25149 pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay,
25150 /// A pointer to the contents in the error state.
25151 /// Reading from this pointer when `result_ok` is set is undefined.
25152 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25155 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
25156 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
25157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25158 pub struct CResult_PaymentRelayDecodeErrorZ {
25159 /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
25160 /// `err` or `result` depending on the state of `result_ok`.
25161 pub contents: CResult_PaymentRelayDecodeErrorZPtr,
25162 /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
25163 pub result_ok: bool,
25166 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
25167 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
25168 CResult_PaymentRelayDecodeErrorZ {
25169 contents: CResult_PaymentRelayDecodeErrorZPtr {
25170 result: Box::into_raw(Box::new(o)),
25176 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
25177 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
25178 CResult_PaymentRelayDecodeErrorZ {
25179 contents: CResult_PaymentRelayDecodeErrorZPtr {
25180 err: Box::into_raw(Box::new(e)),
25185 /// Checks if the given object is currently in the success state
25187 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
25191 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
25192 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
25193 impl Drop for CResult_PaymentRelayDecodeErrorZ {
25194 fn drop(&mut self) {
25195 if self.result_ok {
25196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25197 let _ = unsafe { Box::from_raw(self.contents.result) };
25200 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25201 let _ = unsafe { Box::from_raw(self.contents.err) };
25206 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
25207 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> Self {
25208 let contents = if o.result_ok {
25209 let result = unsafe { o.contents.result };
25210 unsafe { o.contents.result = core::ptr::null_mut() };
25211 CResult_PaymentRelayDecodeErrorZPtr { result }
25213 let err = unsafe { o.contents.err };
25214 unsafe { o.contents.err = core::ptr::null_mut(); }
25215 CResult_PaymentRelayDecodeErrorZPtr { err }
25219 result_ok: o.result_ok,
25223 impl Clone for CResult_PaymentRelayDecodeErrorZ {
25224 fn clone(&self) -> Self {
25225 if self.result_ok {
25226 Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
25227 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
25230 Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
25231 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25237 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
25238 /// but with all dynamically-allocated buffers duplicated in new buffers.
25239 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
25241 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
25242 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
25243 /// A pointer to the contents in the success state.
25244 /// Reading from this pointer when `result_ok` is not set is undefined.
25245 pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
25246 /// A pointer to the contents in the error state.
25247 /// Reading from this pointer when `result_ok` is set is undefined.
25248 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25251 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
25252 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
25253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25254 pub struct CResult_PaymentConstraintsDecodeErrorZ {
25255 /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
25256 /// `err` or `result` depending on the state of `result_ok`.
25257 pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
25258 /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
25259 pub result_ok: bool,
25262 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
25263 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
25264 CResult_PaymentConstraintsDecodeErrorZ {
25265 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25266 result: Box::into_raw(Box::new(o)),
25272 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
25273 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
25274 CResult_PaymentConstraintsDecodeErrorZ {
25275 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25276 err: Box::into_raw(Box::new(e)),
25281 /// Checks if the given object is currently in the success state
25283 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
25287 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
25288 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
25289 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
25290 fn drop(&mut self) {
25291 if self.result_ok {
25292 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25293 let _ = unsafe { Box::from_raw(self.contents.result) };
25296 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25297 let _ = unsafe { Box::from_raw(self.contents.err) };
25302 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
25303 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
25304 let contents = if o.result_ok {
25305 let result = unsafe { o.contents.result };
25306 unsafe { o.contents.result = core::ptr::null_mut() };
25307 CResult_PaymentConstraintsDecodeErrorZPtr { result }
25309 let err = unsafe { o.contents.err };
25310 unsafe { o.contents.err = core::ptr::null_mut(); }
25311 CResult_PaymentConstraintsDecodeErrorZPtr { err }
25315 result_ok: o.result_ok,
25319 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
25320 fn clone(&self) -> Self {
25321 if self.result_ok {
25322 Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25323 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
25326 Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25327 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25333 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
25334 /// but with all dynamically-allocated buffers duplicated in new buffers.
25335 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
25337 /// The contents of CResult_PaymentContextDecodeErrorZ
25338 pub union CResult_PaymentContextDecodeErrorZPtr {
25339 /// A pointer to the contents in the success state.
25340 /// Reading from this pointer when `result_ok` is not set is undefined.
25341 pub result: *mut crate::lightning::blinded_path::payment::PaymentContext,
25342 /// A pointer to the contents in the error state.
25343 /// Reading from this pointer when `result_ok` is set is undefined.
25344 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25347 /// A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation,
25348 /// containing a crate::lightning::blinded_path::payment::PaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25350 pub struct CResult_PaymentContextDecodeErrorZ {
25351 /// The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either
25352 /// `err` or `result` depending on the state of `result_ok`.
25353 pub contents: CResult_PaymentContextDecodeErrorZPtr,
25354 /// Whether this CResult_PaymentContextDecodeErrorZ represents a success state.
25355 pub result_ok: bool,
25358 /// Creates a new CResult_PaymentContextDecodeErrorZ in the success state.
25359 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentContext) -> CResult_PaymentContextDecodeErrorZ {
25360 CResult_PaymentContextDecodeErrorZ {
25361 contents: CResult_PaymentContextDecodeErrorZPtr {
25362 result: Box::into_raw(Box::new(o)),
25368 /// Creates a new CResult_PaymentContextDecodeErrorZ in the error state.
25369 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentContextDecodeErrorZ {
25370 CResult_PaymentContextDecodeErrorZ {
25371 contents: CResult_PaymentContextDecodeErrorZPtr {
25372 err: Box::into_raw(Box::new(e)),
25377 /// Checks if the given object is currently in the success state
25379 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_is_ok(o: &CResult_PaymentContextDecodeErrorZ) -> bool {
25383 /// Frees any resources used by the CResult_PaymentContextDecodeErrorZ.
25384 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_free(_res: CResult_PaymentContextDecodeErrorZ) { }
25385 impl Drop for CResult_PaymentContextDecodeErrorZ {
25386 fn drop(&mut self) {
25387 if self.result_ok {
25388 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25389 let _ = unsafe { Box::from_raw(self.contents.result) };
25392 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25393 let _ = unsafe { Box::from_raw(self.contents.err) };
25398 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentContextDecodeErrorZ {
25399 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25400 let contents = if o.result_ok {
25401 let result = unsafe { o.contents.result };
25402 unsafe { o.contents.result = core::ptr::null_mut() };
25403 CResult_PaymentContextDecodeErrorZPtr { result }
25405 let err = unsafe { o.contents.err };
25406 unsafe { o.contents.err = core::ptr::null_mut(); }
25407 CResult_PaymentContextDecodeErrorZPtr { err }
25411 result_ok: o.result_ok,
25415 impl Clone for CResult_PaymentContextDecodeErrorZ {
25416 fn clone(&self) -> Self {
25417 if self.result_ok {
25418 Self { result_ok: true, contents: CResult_PaymentContextDecodeErrorZPtr {
25419 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentContext>::clone(unsafe { &*self.contents.result })))
25422 Self { result_ok: false, contents: CResult_PaymentContextDecodeErrorZPtr {
25423 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25429 /// Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig`
25430 /// but with all dynamically-allocated buffers duplicated in new buffers.
25431 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_clone(orig: &CResult_PaymentContextDecodeErrorZ) -> CResult_PaymentContextDecodeErrorZ { Clone::clone(&orig) }
25433 /// The contents of CResult_UnknownPaymentContextDecodeErrorZ
25434 pub union CResult_UnknownPaymentContextDecodeErrorZPtr {
25435 /// A pointer to the contents in the success state.
25436 /// Reading from this pointer when `result_ok` is not set is undefined.
25437 pub result: *mut crate::lightning::blinded_path::payment::UnknownPaymentContext,
25438 /// A pointer to the contents in the error state.
25439 /// Reading from this pointer when `result_ok` is set is undefined.
25440 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25443 /// A CResult_UnknownPaymentContextDecodeErrorZ represents the result of a fallible operation,
25444 /// containing a crate::lightning::blinded_path::payment::UnknownPaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25445 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25446 pub struct CResult_UnknownPaymentContextDecodeErrorZ {
25447 /// The contents of this CResult_UnknownPaymentContextDecodeErrorZ, accessible via either
25448 /// `err` or `result` depending on the state of `result_ok`.
25449 pub contents: CResult_UnknownPaymentContextDecodeErrorZPtr,
25450 /// Whether this CResult_UnknownPaymentContextDecodeErrorZ represents a success state.
25451 pub result_ok: bool,
25454 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the success state.
25455 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::UnknownPaymentContext) -> CResult_UnknownPaymentContextDecodeErrorZ {
25456 CResult_UnknownPaymentContextDecodeErrorZ {
25457 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25458 result: Box::into_raw(Box::new(o)),
25464 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the error state.
25465 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnknownPaymentContextDecodeErrorZ {
25466 CResult_UnknownPaymentContextDecodeErrorZ {
25467 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25468 err: Box::into_raw(Box::new(e)),
25473 /// Checks if the given object is currently in the success state
25475 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o: &CResult_UnknownPaymentContextDecodeErrorZ) -> bool {
25479 /// Frees any resources used by the CResult_UnknownPaymentContextDecodeErrorZ.
25480 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_free(_res: CResult_UnknownPaymentContextDecodeErrorZ) { }
25481 impl Drop for CResult_UnknownPaymentContextDecodeErrorZ {
25482 fn drop(&mut self) {
25483 if self.result_ok {
25484 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25485 let _ = unsafe { Box::from_raw(self.contents.result) };
25488 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25489 let _ = unsafe { Box::from_raw(self.contents.err) };
25494 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_UnknownPaymentContextDecodeErrorZ {
25495 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25496 let contents = if o.result_ok {
25497 let result = unsafe { o.contents.result };
25498 unsafe { o.contents.result = core::ptr::null_mut() };
25499 CResult_UnknownPaymentContextDecodeErrorZPtr { result }
25501 let err = unsafe { o.contents.err };
25502 unsafe { o.contents.err = core::ptr::null_mut(); }
25503 CResult_UnknownPaymentContextDecodeErrorZPtr { err }
25507 result_ok: o.result_ok,
25511 impl Clone for CResult_UnknownPaymentContextDecodeErrorZ {
25512 fn clone(&self) -> Self {
25513 if self.result_ok {
25514 Self { result_ok: true, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25515 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::UnknownPaymentContext>::clone(unsafe { &*self.contents.result })))
25518 Self { result_ok: false, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25519 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25525 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ which has the same data as `orig`
25526 /// but with all dynamically-allocated buffers duplicated in new buffers.
25527 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_clone(orig: &CResult_UnknownPaymentContextDecodeErrorZ) -> CResult_UnknownPaymentContextDecodeErrorZ { Clone::clone(&orig) }
25529 /// The contents of CResult_Bolt12OfferContextDecodeErrorZ
25530 pub union CResult_Bolt12OfferContextDecodeErrorZPtr {
25531 /// A pointer to the contents in the success state.
25532 /// Reading from this pointer when `result_ok` is not set is undefined.
25533 pub result: *mut crate::lightning::blinded_path::payment::Bolt12OfferContext,
25534 /// A pointer to the contents in the error state.
25535 /// Reading from this pointer when `result_ok` is set is undefined.
25536 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25539 /// A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation,
25540 /// containing a crate::lightning::blinded_path::payment::Bolt12OfferContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25541 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25542 pub struct CResult_Bolt12OfferContextDecodeErrorZ {
25543 /// The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either
25544 /// `err` or `result` depending on the state of `result_ok`.
25545 pub contents: CResult_Bolt12OfferContextDecodeErrorZPtr,
25546 /// Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state.
25547 pub result_ok: bool,
25550 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state.
25551 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12OfferContext) -> CResult_Bolt12OfferContextDecodeErrorZ {
25552 CResult_Bolt12OfferContextDecodeErrorZ {
25553 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25554 result: Box::into_raw(Box::new(o)),
25560 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state.
25561 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12OfferContextDecodeErrorZ {
25562 CResult_Bolt12OfferContextDecodeErrorZ {
25563 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25564 err: Box::into_raw(Box::new(e)),
25569 /// Checks if the given object is currently in the success state
25571 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o: &CResult_Bolt12OfferContextDecodeErrorZ) -> bool {
25575 /// Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ.
25576 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_free(_res: CResult_Bolt12OfferContextDecodeErrorZ) { }
25577 impl Drop for CResult_Bolt12OfferContextDecodeErrorZ {
25578 fn drop(&mut self) {
25579 if self.result_ok {
25580 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25581 let _ = unsafe { Box::from_raw(self.contents.result) };
25584 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25585 let _ = unsafe { Box::from_raw(self.contents.err) };
25590 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12OfferContextDecodeErrorZ {
25591 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25592 let contents = if o.result_ok {
25593 let result = unsafe { o.contents.result };
25594 unsafe { o.contents.result = core::ptr::null_mut() };
25595 CResult_Bolt12OfferContextDecodeErrorZPtr { result }
25597 let err = unsafe { o.contents.err };
25598 unsafe { o.contents.err = core::ptr::null_mut(); }
25599 CResult_Bolt12OfferContextDecodeErrorZPtr { err }
25603 result_ok: o.result_ok,
25607 impl Clone for CResult_Bolt12OfferContextDecodeErrorZ {
25608 fn clone(&self) -> Self {
25609 if self.result_ok {
25610 Self { result_ok: true, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25611 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12OfferContext>::clone(unsafe { &*self.contents.result })))
25614 Self { result_ok: false, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25615 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25621 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ which has the same data as `orig`
25622 /// but with all dynamically-allocated buffers duplicated in new buffers.
25623 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_clone(orig: &CResult_Bolt12OfferContextDecodeErrorZ) -> CResult_Bolt12OfferContextDecodeErrorZ { Clone::clone(&orig) }
25625 /// The contents of CResult_Bolt12RefundContextDecodeErrorZ
25626 pub union CResult_Bolt12RefundContextDecodeErrorZPtr {
25627 /// A pointer to the contents in the success state.
25628 /// Reading from this pointer when `result_ok` is not set is undefined.
25629 pub result: *mut crate::lightning::blinded_path::payment::Bolt12RefundContext,
25630 /// A pointer to the contents in the error state.
25631 /// Reading from this pointer when `result_ok` is set is undefined.
25632 pub err: *mut crate::lightning::ln::msgs::DecodeError,
25635 /// A CResult_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation,
25636 /// containing a crate::lightning::blinded_path::payment::Bolt12RefundContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25637 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25638 pub struct CResult_Bolt12RefundContextDecodeErrorZ {
25639 /// The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either
25640 /// `err` or `result` depending on the state of `result_ok`.
25641 pub contents: CResult_Bolt12RefundContextDecodeErrorZPtr,
25642 /// Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state.
25643 pub result_ok: bool,
25646 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state.
25647 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12RefundContext) -> CResult_Bolt12RefundContextDecodeErrorZ {
25648 CResult_Bolt12RefundContextDecodeErrorZ {
25649 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25650 result: Box::into_raw(Box::new(o)),
25656 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state.
25657 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12RefundContextDecodeErrorZ {
25658 CResult_Bolt12RefundContextDecodeErrorZ {
25659 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25660 err: Box::into_raw(Box::new(e)),
25665 /// Checks if the given object is currently in the success state
25667 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o: &CResult_Bolt12RefundContextDecodeErrorZ) -> bool {
25671 /// Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ.
25672 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_free(_res: CResult_Bolt12RefundContextDecodeErrorZ) { }
25673 impl Drop for CResult_Bolt12RefundContextDecodeErrorZ {
25674 fn drop(&mut self) {
25675 if self.result_ok {
25676 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25677 let _ = unsafe { Box::from_raw(self.contents.result) };
25680 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25681 let _ = unsafe { Box::from_raw(self.contents.err) };
25686 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12RefundContextDecodeErrorZ {
25687 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25688 let contents = if o.result_ok {
25689 let result = unsafe { o.contents.result };
25690 unsafe { o.contents.result = core::ptr::null_mut() };
25691 CResult_Bolt12RefundContextDecodeErrorZPtr { result }
25693 let err = unsafe { o.contents.err };
25694 unsafe { o.contents.err = core::ptr::null_mut(); }
25695 CResult_Bolt12RefundContextDecodeErrorZPtr { err }
25699 result_ok: o.result_ok,
25703 impl Clone for CResult_Bolt12RefundContextDecodeErrorZ {
25704 fn clone(&self) -> Self {
25705 if self.result_ok {
25706 Self { result_ok: true, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25707 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12RefundContext>::clone(unsafe { &*self.contents.result })))
25710 Self { result_ok: false, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25711 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25717 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig`
25718 /// but with all dynamically-allocated buffers duplicated in new buffers.
25719 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_clone(orig: &CResult_Bolt12RefundContextDecodeErrorZ) -> CResult_Bolt12RefundContextDecodeErrorZ { Clone::clone(&orig) }
25721 /// The contents of CResult_StrSecp256k1ErrorZ
25722 pub union CResult_StrSecp256k1ErrorZPtr {
25723 /// A pointer to the contents in the success state.
25724 /// Reading from this pointer when `result_ok` is not set is undefined.
25725 pub result: *mut crate::c_types::Str,
25726 /// A pointer to the contents in the error state.
25727 /// Reading from this pointer when `result_ok` is set is undefined.
25728 pub err: *mut crate::c_types::Secp256k1Error,
25731 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
25732 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
25733 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25734 pub struct CResult_StrSecp256k1ErrorZ {
25735 /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
25736 /// `err` or `result` depending on the state of `result_ok`.
25737 pub contents: CResult_StrSecp256k1ErrorZPtr,
25738 /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
25739 pub result_ok: bool,
25742 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
25743 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
25744 CResult_StrSecp256k1ErrorZ {
25745 contents: CResult_StrSecp256k1ErrorZPtr {
25746 result: Box::into_raw(Box::new(o)),
25752 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
25753 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
25754 CResult_StrSecp256k1ErrorZ {
25755 contents: CResult_StrSecp256k1ErrorZPtr {
25756 err: Box::into_raw(Box::new(e)),
25761 /// Checks if the given object is currently in the success state
25763 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
25767 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
25768 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
25769 impl Drop for CResult_StrSecp256k1ErrorZ {
25770 fn drop(&mut self) {
25771 if self.result_ok {
25772 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25773 let _ = unsafe { Box::from_raw(self.contents.result) };
25776 if unsafe { !(self.contents.err as *mut ()).is_null() } {
25777 let _ = unsafe { Box::from_raw(self.contents.err) };
25782 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
25783 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
25784 let contents = if o.result_ok {
25785 let result = unsafe { o.contents.result };
25786 unsafe { o.contents.result = core::ptr::null_mut() };
25787 CResult_StrSecp256k1ErrorZPtr { result }
25789 let err = unsafe { o.contents.err };
25790 unsafe { o.contents.err = core::ptr::null_mut(); }
25791 CResult_StrSecp256k1ErrorZPtr { err }
25795 result_ok: o.result_ok,
25799 impl Clone for CResult_StrSecp256k1ErrorZ {
25800 fn clone(&self) -> Self {
25801 if self.result_ok {
25802 Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
25803 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
25806 Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
25807 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
25813 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
25814 /// but with all dynamically-allocated buffers duplicated in new buffers.
25815 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
25817 /// A tuple of 3 elements. See the individual fields for the types contained.
25818 pub struct C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25819 /// The element at position 0
25820 pub a: crate::c_types::ThirtyTwoBytes,
25821 /// The element at position 1
25822 pub b: crate::lightning::ln::outbound_payment::RecipientOnionFields,
25823 /// The element at position 2
25824 pub c: crate::lightning::routing::router::RouteParameters,
25826 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)> for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25827 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)) -> Self {
25835 impl C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25836 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters) {
25837 (self.a, self.b, self.c)
25840 impl Clone for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25841 fn clone(&self) -> Self {
25843 a: Clone::clone(&self.a),
25844 b: Clone::clone(&self.b),
25845 c: Clone::clone(&self.c),
25850 /// Creates a new tuple which has the same data as `orig`
25851 /// but with all dynamically-allocated buffers duplicated in new buffers.
25852 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig: &C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { Clone::clone(&orig) }
25853 /// Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements.
25855 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 {
25856 C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { a, b, c, }
25860 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ.
25861 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res: C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) { }
25863 /// The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ
25864 pub union CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25865 /// A pointer to the contents in the success state.
25866 /// Reading from this pointer when `result_ok` is not set is undefined.
25867 pub result: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ,
25868 /// Note that this value is always NULL, as there are no contents in the Err variant
25869 pub err: *mut core::ffi::c_void,
25872 /// A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation,
25873 /// containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure.
25874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25875 pub struct CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25876 /// The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either
25877 /// `err` or `result` depending on the state of `result_ok`.
25878 pub contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr,
25879 /// Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state.
25880 pub result_ok: bool,
25883 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state.
25884 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o: crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25885 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25886 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25887 result: Box::into_raw(Box::new(o)),
25893 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state.
25894 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25895 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25896 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25897 err: core::ptr::null_mut(),
25902 /// Checks if the given object is currently in the success state
25904 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> bool {
25908 /// Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.
25909 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) { }
25910 impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25911 fn drop(&mut self) {
25912 if self.result_ok {
25913 if unsafe { !(self.contents.result as *mut ()).is_null() } {
25914 let _ = unsafe { Box::from_raw(self.contents.result) };
25920 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>> for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25921 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>) -> Self {
25922 let contents = if o.result_ok {
25923 let result = unsafe { o.contents.result };
25924 unsafe { o.contents.result = core::ptr::null_mut() };
25925 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { result }
25927 let _ = unsafe { Box::from_raw(o.contents.err) };
25928 o.contents.err = core::ptr::null_mut();
25929 CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { err: core::ptr::null_mut() }
25933 result_ok: o.result_ok,
25937 impl Clone for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25938 fn clone(&self) -> Self {
25939 if self.result_ok {
25940 Self { result_ok: true, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25941 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ>::clone(unsafe { &*self.contents.result })))
25944 Self { result_ok: false, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25945 err: core::ptr::null_mut()
25951 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig`
25952 /// but with all dynamically-allocated buffers duplicated in new buffers.
25953 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { Clone::clone(&orig) }
25955 /// The contents of CResult_TxOutUtxoLookupErrorZ
25956 pub union CResult_TxOutUtxoLookupErrorZPtr {
25957 /// A pointer to the contents in the success state.
25958 /// Reading from this pointer when `result_ok` is not set is undefined.
25959 pub result: *mut crate::c_types::TxOut,
25960 /// A pointer to the contents in the error state.
25961 /// Reading from this pointer when `result_ok` is set is undefined.
25962 pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
25965 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
25966 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
25967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25968 pub struct CResult_TxOutUtxoLookupErrorZ {
25969 /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
25970 /// `err` or `result` depending on the state of `result_ok`.
25971 pub contents: CResult_TxOutUtxoLookupErrorZPtr,
25972 /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
25973 pub result_ok: bool,
25976 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
25977 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
25978 CResult_TxOutUtxoLookupErrorZ {
25979 contents: CResult_TxOutUtxoLookupErrorZPtr {
25980 result: Box::into_raw(Box::new(o)),
25986 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
25987 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
25988 CResult_TxOutUtxoLookupErrorZ {
25989 contents: CResult_TxOutUtxoLookupErrorZPtr {
25990 err: Box::into_raw(Box::new(e)),
25995 /// Checks if the given object is currently in the success state
25997 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
26001 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
26002 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
26003 impl Drop for CResult_TxOutUtxoLookupErrorZ {
26004 fn drop(&mut self) {
26005 if self.result_ok {
26006 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26007 let _ = unsafe { Box::from_raw(self.contents.result) };
26010 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26011 let _ = unsafe { Box::from_raw(self.contents.err) };
26016 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
26017 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
26018 let contents = if o.result_ok {
26019 let result = unsafe { o.contents.result };
26020 unsafe { o.contents.result = core::ptr::null_mut() };
26021 CResult_TxOutUtxoLookupErrorZPtr { result }
26023 let err = unsafe { o.contents.err };
26024 unsafe { o.contents.err = core::ptr::null_mut(); }
26025 CResult_TxOutUtxoLookupErrorZPtr { err }
26029 result_ok: o.result_ok,
26033 impl Clone for CResult_TxOutUtxoLookupErrorZ {
26034 fn clone(&self) -> Self {
26035 if self.result_ok {
26036 Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
26037 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
26040 Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
26041 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
26047 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
26048 /// but with all dynamically-allocated buffers duplicated in new buffers.
26049 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
26051 /// A tuple of 3 elements. See the individual fields for the types contained.
26052 pub struct C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26053 /// The element at position 0
26054 pub a: crate::c_types::PublicKey,
26055 /// The element at position 1
26056 pub b: crate::lightning::ln::msgs::OnionMessage,
26057 /// The element at position 2
26058 pub c: crate::c_types::derived::COption_CVec_SocketAddressZZ,
26060 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)> for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26061 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)) -> Self {
26069 impl C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26070 #[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) {
26071 (self.a, self.b, self.c)
26074 impl Clone for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26075 fn clone(&self) -> Self {
26077 a: Clone::clone(&self.a),
26078 b: Clone::clone(&self.b),
26079 c: Clone::clone(&self.c),
26084 /// Creates a new tuple which has the same data as `orig`
26085 /// but with all dynamically-allocated buffers duplicated in new buffers.
26086 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig: &C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { Clone::clone(&orig) }
26087 /// Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements.
26089 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 {
26090 C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { a, b, c, }
26094 /// Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ.
26095 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res: C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) { }
26097 /// The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ
26098 pub union CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26099 /// A pointer to the contents in the success state.
26100 /// Reading from this pointer when `result_ok` is not set is undefined.
26101 pub result: *mut crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ,
26102 /// A pointer to the contents in the error state.
26103 /// Reading from this pointer when `result_ok` is set is undefined.
26104 pub err: *mut crate::lightning::onion_message::messenger::SendError,
26107 /// A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation,
26108 /// containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
26109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26110 pub struct CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26111 /// The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either
26112 /// `err` or `result` depending on the state of `result_ok`.
26113 pub contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr,
26114 /// Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state.
26115 pub result_ok: bool,
26118 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state.
26119 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o: crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26120 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26121 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26122 result: Box::into_raw(Box::new(o)),
26128 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state.
26129 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26130 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26131 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26132 err: Box::into_raw(Box::new(e)),
26137 /// Checks if the given object is currently in the success state
26139 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> bool {
26143 /// Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.
26144 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) { }
26145 impl Drop for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26146 fn drop(&mut self) {
26147 if self.result_ok {
26148 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26149 let _ = unsafe { Box::from_raw(self.contents.result) };
26152 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26153 let _ = unsafe { Box::from_raw(self.contents.err) };
26158 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 {
26159 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
26160 let contents = if o.result_ok {
26161 let result = unsafe { o.contents.result };
26162 unsafe { o.contents.result = core::ptr::null_mut() };
26163 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { result }
26165 let err = unsafe { o.contents.err };
26166 unsafe { o.contents.err = core::ptr::null_mut(); }
26167 CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { err }
26171 result_ok: o.result_ok,
26175 impl Clone for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26176 fn clone(&self) -> Self {
26177 if self.result_ok {
26178 Self { result_ok: true, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26179 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ>::clone(unsafe { &*self.contents.result })))
26182 Self { result_ok: false, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26183 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
26189 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ which has the same data as `orig`
26190 /// but with all dynamically-allocated buffers duplicated in new buffers.
26191 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { Clone::clone(&orig) }
26193 /// The contents of CResult_PeeledOnionNoneZ
26194 pub union CResult_PeeledOnionNoneZPtr {
26195 /// A pointer to the contents in the success state.
26196 /// Reading from this pointer when `result_ok` is not set is undefined.
26197 pub result: *mut crate::lightning::onion_message::messenger::PeeledOnion,
26198 /// Note that this value is always NULL, as there are no contents in the Err variant
26199 pub err: *mut core::ffi::c_void,
26202 /// A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
26203 /// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
26204 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26205 pub struct CResult_PeeledOnionNoneZ {
26206 /// The contents of this CResult_PeeledOnionNoneZ, accessible via either
26207 /// `err` or `result` depending on the state of `result_ok`.
26208 pub contents: CResult_PeeledOnionNoneZPtr,
26209 /// Whether this CResult_PeeledOnionNoneZ represents a success state.
26210 pub result_ok: bool,
26213 /// Creates a new CResult_PeeledOnionNoneZ in the success state.
26214 pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ {
26215 CResult_PeeledOnionNoneZ {
26216 contents: CResult_PeeledOnionNoneZPtr {
26217 result: Box::into_raw(Box::new(o)),
26223 /// Creates a new CResult_PeeledOnionNoneZ in the error state.
26224 pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ {
26225 CResult_PeeledOnionNoneZ {
26226 contents: CResult_PeeledOnionNoneZPtr {
26227 err: core::ptr::null_mut(),
26232 /// Checks if the given object is currently in the success state
26234 pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool {
26238 /// Frees any resources used by the CResult_PeeledOnionNoneZ.
26239 pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { }
26240 impl Drop for CResult_PeeledOnionNoneZ {
26241 fn drop(&mut self) {
26242 if self.result_ok {
26243 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26244 let _ = unsafe { Box::from_raw(self.contents.result) };
26250 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>> for CResult_PeeledOnionNoneZ {
26251 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>) -> Self {
26252 let contents = if o.result_ok {
26253 let result = unsafe { o.contents.result };
26254 unsafe { o.contents.result = core::ptr::null_mut() };
26255 CResult_PeeledOnionNoneZPtr { result }
26257 let _ = unsafe { Box::from_raw(o.contents.err) };
26258 o.contents.err = core::ptr::null_mut();
26259 CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() }
26263 result_ok: o.result_ok,
26267 impl Clone for CResult_PeeledOnionNoneZ {
26268 fn clone(&self) -> Self {
26269 if self.result_ok {
26270 Self { result_ok: true, contents: CResult_PeeledOnionNoneZPtr {
26271 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::PeeledOnion>::clone(unsafe { &*self.contents.result })))
26274 Self { result_ok: false, contents: CResult_PeeledOnionNoneZPtr {
26275 err: core::ptr::null_mut()
26281 /// Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig`
26282 /// but with all dynamically-allocated buffers duplicated in new buffers.
26283 pub extern "C" fn CResult_PeeledOnionNoneZ_clone(orig: &CResult_PeeledOnionNoneZ) -> CResult_PeeledOnionNoneZ { Clone::clone(&orig) }
26285 /// The contents of CResult_SendSuccessSendErrorZ
26286 pub union CResult_SendSuccessSendErrorZPtr {
26287 /// A pointer to the contents in the success state.
26288 /// Reading from this pointer when `result_ok` is not set is undefined.
26289 pub result: *mut crate::lightning::onion_message::messenger::SendSuccess,
26290 /// A pointer to the contents in the error state.
26291 /// Reading from this pointer when `result_ok` is set is undefined.
26292 pub err: *mut crate::lightning::onion_message::messenger::SendError,
26295 /// A CResult_SendSuccessSendErrorZ represents the result of a fallible operation,
26296 /// containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure.
26297 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26298 pub struct CResult_SendSuccessSendErrorZ {
26299 /// The contents of this CResult_SendSuccessSendErrorZ, accessible via either
26300 /// `err` or `result` depending on the state of `result_ok`.
26301 pub contents: CResult_SendSuccessSendErrorZPtr,
26302 /// Whether this CResult_SendSuccessSendErrorZ represents a success state.
26303 pub result_ok: bool,
26306 /// Creates a new CResult_SendSuccessSendErrorZ in the success state.
26307 pub extern "C" fn CResult_SendSuccessSendErrorZ_ok(o: crate::lightning::onion_message::messenger::SendSuccess) -> CResult_SendSuccessSendErrorZ {
26308 CResult_SendSuccessSendErrorZ {
26309 contents: CResult_SendSuccessSendErrorZPtr {
26310 result: Box::into_raw(Box::new(o)),
26316 /// Creates a new CResult_SendSuccessSendErrorZ in the error state.
26317 pub extern "C" fn CResult_SendSuccessSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_SendSuccessSendErrorZ {
26318 CResult_SendSuccessSendErrorZ {
26319 contents: CResult_SendSuccessSendErrorZPtr {
26320 err: Box::into_raw(Box::new(e)),
26325 /// Checks if the given object is currently in the success state
26327 pub extern "C" fn CResult_SendSuccessSendErrorZ_is_ok(o: &CResult_SendSuccessSendErrorZ) -> bool {
26331 /// Frees any resources used by the CResult_SendSuccessSendErrorZ.
26332 pub extern "C" fn CResult_SendSuccessSendErrorZ_free(_res: CResult_SendSuccessSendErrorZ) { }
26333 impl Drop for CResult_SendSuccessSendErrorZ {
26334 fn drop(&mut self) {
26335 if self.result_ok {
26336 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26337 let _ = unsafe { Box::from_raw(self.contents.result) };
26340 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26341 let _ = unsafe { Box::from_raw(self.contents.err) };
26346 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>> for CResult_SendSuccessSendErrorZ {
26347 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>) -> Self {
26348 let contents = if o.result_ok {
26349 let result = unsafe { o.contents.result };
26350 unsafe { o.contents.result = core::ptr::null_mut() };
26351 CResult_SendSuccessSendErrorZPtr { result }
26353 let err = unsafe { o.contents.err };
26354 unsafe { o.contents.err = core::ptr::null_mut(); }
26355 CResult_SendSuccessSendErrorZPtr { err }
26359 result_ok: o.result_ok,
26363 impl Clone for CResult_SendSuccessSendErrorZ {
26364 fn clone(&self) -> Self {
26365 if self.result_ok {
26366 Self { result_ok: true, contents: CResult_SendSuccessSendErrorZPtr {
26367 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendSuccess>::clone(unsafe { &*self.contents.result })))
26370 Self { result_ok: false, contents: CResult_SendSuccessSendErrorZPtr {
26371 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
26377 /// Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig`
26378 /// but with all dynamically-allocated buffers duplicated in new buffers.
26379 pub extern "C" fn CResult_SendSuccessSendErrorZ_clone(orig: &CResult_SendSuccessSendErrorZ) -> CResult_SendSuccessSendErrorZ { Clone::clone(&orig) }
26381 /// The contents of CResult_BlindedPathNoneZ
26382 pub union CResult_BlindedPathNoneZPtr {
26383 /// A pointer to the contents in the success state.
26384 /// Reading from this pointer when `result_ok` is not set is undefined.
26385 pub result: *mut crate::lightning::blinded_path::BlindedPath,
26386 /// Note that this value is always NULL, as there are no contents in the Err variant
26387 pub err: *mut core::ffi::c_void,
26390 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
26391 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
26392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26393 pub struct CResult_BlindedPathNoneZ {
26394 /// The contents of this CResult_BlindedPathNoneZ, accessible via either
26395 /// `err` or `result` depending on the state of `result_ok`.
26396 pub contents: CResult_BlindedPathNoneZPtr,
26397 /// Whether this CResult_BlindedPathNoneZ represents a success state.
26398 pub result_ok: bool,
26401 /// Creates a new CResult_BlindedPathNoneZ in the success state.
26402 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
26403 CResult_BlindedPathNoneZ {
26404 contents: CResult_BlindedPathNoneZPtr {
26405 result: Box::into_raw(Box::new(o)),
26411 /// Creates a new CResult_BlindedPathNoneZ in the error state.
26412 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
26413 CResult_BlindedPathNoneZ {
26414 contents: CResult_BlindedPathNoneZPtr {
26415 err: core::ptr::null_mut(),
26420 /// Checks if the given object is currently in the success state
26422 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
26426 /// Frees any resources used by the CResult_BlindedPathNoneZ.
26427 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
26428 impl Drop for CResult_BlindedPathNoneZ {
26429 fn drop(&mut self) {
26430 if self.result_ok {
26431 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26432 let _ = unsafe { Box::from_raw(self.contents.result) };
26438 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
26439 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
26440 let contents = if o.result_ok {
26441 let result = unsafe { o.contents.result };
26442 unsafe { o.contents.result = core::ptr::null_mut() };
26443 CResult_BlindedPathNoneZPtr { result }
26445 let _ = unsafe { Box::from_raw(o.contents.err) };
26446 o.contents.err = core::ptr::null_mut();
26447 CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
26451 result_ok: o.result_ok,
26455 impl Clone for CResult_BlindedPathNoneZ {
26456 fn clone(&self) -> Self {
26457 if self.result_ok {
26458 Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
26459 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
26462 Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
26463 err: core::ptr::null_mut()
26469 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
26470 /// but with all dynamically-allocated buffers duplicated in new buffers.
26471 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
26473 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
26474 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26475 /// A pointer to the contents in the success state.
26476 /// Reading from this pointer when `result_ok` is not set is undefined.
26477 pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
26478 /// Note that this value is always NULL, as there are no contents in the Err variant
26479 pub err: *mut core::ffi::c_void,
26482 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
26483 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
26484 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26485 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26486 /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
26487 /// `err` or `result` depending on the state of `result_ok`.
26488 pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
26489 /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
26490 pub result_ok: bool,
26493 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
26494 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26495 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26496 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26497 result: Box::into_raw(Box::new(o)),
26503 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
26504 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26505 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26506 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26507 err: core::ptr::null_mut(),
26512 /// Checks if the given object is currently in the success state
26514 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
26518 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
26519 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
26520 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26521 fn drop(&mut self) {
26522 if self.result_ok {
26523 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26524 let _ = unsafe { Box::from_raw(self.contents.result) };
26530 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26531 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
26532 let contents = if o.result_ok {
26533 let result = unsafe { o.contents.result };
26534 unsafe { o.contents.result = core::ptr::null_mut() };
26535 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
26537 let _ = unsafe { Box::from_raw(o.contents.err) };
26538 o.contents.err = core::ptr::null_mut();
26539 CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
26543 result_ok: o.result_ok,
26547 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26548 fn clone(&self) -> Self {
26549 if self.result_ok {
26550 Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26551 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
26554 Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26555 err: core::ptr::null_mut()
26561 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
26562 /// but with all dynamically-allocated buffers duplicated in new buffers.
26563 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
26565 /// A dynamically-allocated array of crate::lightning::blinded_path::payment::ForwardNodes of arbitrary size.
26566 /// This corresponds to std::vector in C++
26567 pub struct CVec_ForwardNodeZ {
26568 /// The elements in the array.
26569 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
26570 pub data: *mut crate::lightning::blinded_path::payment::ForwardNode,
26571 /// The number of elements pointed to by `data`.
26574 impl CVec_ForwardNodeZ {
26575 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::payment::ForwardNode> {
26576 if self.datalen == 0 { return Vec::new(); }
26577 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
26578 self.data = core::ptr::null_mut();
26582 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::payment::ForwardNode] {
26583 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
26586 impl From<Vec<crate::lightning::blinded_path::payment::ForwardNode>> for CVec_ForwardNodeZ {
26587 fn from(v: Vec<crate::lightning::blinded_path::payment::ForwardNode>) -> Self {
26588 let datalen = v.len();
26589 let data = Box::into_raw(v.into_boxed_slice());
26590 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
26594 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
26595 pub extern "C" fn CVec_ForwardNodeZ_free(_res: CVec_ForwardNodeZ) { }
26596 impl Drop for CVec_ForwardNodeZ {
26597 fn drop(&mut self) {
26598 if self.datalen == 0 { return; }
26599 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
26602 impl Clone for CVec_ForwardNodeZ {
26603 fn clone(&self) -> Self {
26604 let mut res = Vec::new();
26605 if self.datalen == 0 { return Self::from(res); }
26606 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
26611 /// The contents of CResult_BlindedPathDecodeErrorZ
26612 pub union CResult_BlindedPathDecodeErrorZPtr {
26613 /// A pointer to the contents in the success state.
26614 /// Reading from this pointer when `result_ok` is not set is undefined.
26615 pub result: *mut crate::lightning::blinded_path::BlindedPath,
26616 /// A pointer to the contents in the error state.
26617 /// Reading from this pointer when `result_ok` is set is undefined.
26618 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26621 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
26622 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
26623 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26624 pub struct CResult_BlindedPathDecodeErrorZ {
26625 /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
26626 /// `err` or `result` depending on the state of `result_ok`.
26627 pub contents: CResult_BlindedPathDecodeErrorZPtr,
26628 /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
26629 pub result_ok: bool,
26632 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
26633 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
26634 CResult_BlindedPathDecodeErrorZ {
26635 contents: CResult_BlindedPathDecodeErrorZPtr {
26636 result: Box::into_raw(Box::new(o)),
26642 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
26643 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
26644 CResult_BlindedPathDecodeErrorZ {
26645 contents: CResult_BlindedPathDecodeErrorZPtr {
26646 err: Box::into_raw(Box::new(e)),
26651 /// Checks if the given object is currently in the success state
26653 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
26657 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
26658 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
26659 impl Drop for CResult_BlindedPathDecodeErrorZ {
26660 fn drop(&mut self) {
26661 if self.result_ok {
26662 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26663 let _ = unsafe { Box::from_raw(self.contents.result) };
26666 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26667 let _ = unsafe { Box::from_raw(self.contents.err) };
26672 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
26673 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
26674 let contents = if o.result_ok {
26675 let result = unsafe { o.contents.result };
26676 unsafe { o.contents.result = core::ptr::null_mut() };
26677 CResult_BlindedPathDecodeErrorZPtr { result }
26679 let err = unsafe { o.contents.err };
26680 unsafe { o.contents.err = core::ptr::null_mut(); }
26681 CResult_BlindedPathDecodeErrorZPtr { err }
26685 result_ok: o.result_ok,
26689 impl Clone for CResult_BlindedPathDecodeErrorZ {
26690 fn clone(&self) -> Self {
26691 if self.result_ok {
26692 Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
26693 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
26696 Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
26697 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26703 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
26704 /// but with all dynamically-allocated buffers duplicated in new buffers.
26705 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
26707 /// The contents of CResult_BlindedHopDecodeErrorZ
26708 pub union CResult_BlindedHopDecodeErrorZPtr {
26709 /// A pointer to the contents in the success state.
26710 /// Reading from this pointer when `result_ok` is not set is undefined.
26711 pub result: *mut crate::lightning::blinded_path::BlindedHop,
26712 /// A pointer to the contents in the error state.
26713 /// Reading from this pointer when `result_ok` is set is undefined.
26714 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26717 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
26718 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
26719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26720 pub struct CResult_BlindedHopDecodeErrorZ {
26721 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
26722 /// `err` or `result` depending on the state of `result_ok`.
26723 pub contents: CResult_BlindedHopDecodeErrorZPtr,
26724 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
26725 pub result_ok: bool,
26728 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
26729 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
26730 CResult_BlindedHopDecodeErrorZ {
26731 contents: CResult_BlindedHopDecodeErrorZPtr {
26732 result: Box::into_raw(Box::new(o)),
26738 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
26739 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
26740 CResult_BlindedHopDecodeErrorZ {
26741 contents: CResult_BlindedHopDecodeErrorZPtr {
26742 err: Box::into_raw(Box::new(e)),
26747 /// Checks if the given object is currently in the success state
26749 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
26753 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
26754 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
26755 impl Drop for CResult_BlindedHopDecodeErrorZ {
26756 fn drop(&mut self) {
26757 if self.result_ok {
26758 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26759 let _ = unsafe { Box::from_raw(self.contents.result) };
26762 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26763 let _ = unsafe { Box::from_raw(self.contents.err) };
26768 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
26769 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
26770 let contents = if o.result_ok {
26771 let result = unsafe { o.contents.result };
26772 unsafe { o.contents.result = core::ptr::null_mut() };
26773 CResult_BlindedHopDecodeErrorZPtr { result }
26775 let err = unsafe { o.contents.err };
26776 unsafe { o.contents.err = core::ptr::null_mut(); }
26777 CResult_BlindedHopDecodeErrorZPtr { err }
26781 result_ok: o.result_ok,
26785 impl Clone for CResult_BlindedHopDecodeErrorZ {
26786 fn clone(&self) -> Self {
26787 if self.result_ok {
26788 Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
26789 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
26792 Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
26793 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26799 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
26800 /// but with all dynamically-allocated buffers duplicated in new buffers.
26801 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
26803 /// The contents of CResult_InvoiceErrorDecodeErrorZ
26804 pub union CResult_InvoiceErrorDecodeErrorZPtr {
26805 /// A pointer to the contents in the success state.
26806 /// Reading from this pointer when `result_ok` is not set is undefined.
26807 pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
26808 /// A pointer to the contents in the error state.
26809 /// Reading from this pointer when `result_ok` is set is undefined.
26810 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26813 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
26814 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
26815 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26816 pub struct CResult_InvoiceErrorDecodeErrorZ {
26817 /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
26818 /// `err` or `result` depending on the state of `result_ok`.
26819 pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
26820 /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
26821 pub result_ok: bool,
26824 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
26825 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
26826 CResult_InvoiceErrorDecodeErrorZ {
26827 contents: CResult_InvoiceErrorDecodeErrorZPtr {
26828 result: Box::into_raw(Box::new(o)),
26834 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
26835 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
26836 CResult_InvoiceErrorDecodeErrorZ {
26837 contents: CResult_InvoiceErrorDecodeErrorZPtr {
26838 err: Box::into_raw(Box::new(e)),
26843 /// Checks if the given object is currently in the success state
26845 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
26849 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
26850 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
26851 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
26852 fn drop(&mut self) {
26853 if self.result_ok {
26854 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26855 let _ = unsafe { Box::from_raw(self.contents.result) };
26858 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26859 let _ = unsafe { Box::from_raw(self.contents.err) };
26864 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
26865 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
26866 let contents = if o.result_ok {
26867 let result = unsafe { o.contents.result };
26868 unsafe { o.contents.result = core::ptr::null_mut() };
26869 CResult_InvoiceErrorDecodeErrorZPtr { result }
26871 let err = unsafe { o.contents.err };
26872 unsafe { o.contents.err = core::ptr::null_mut(); }
26873 CResult_InvoiceErrorDecodeErrorZPtr { err }
26877 result_ok: o.result_ok,
26881 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
26882 fn clone(&self) -> Self {
26883 if self.result_ok {
26884 Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
26885 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
26888 Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
26889 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26895 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
26896 /// but with all dynamically-allocated buffers duplicated in new buffers.
26897 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
26899 /// The contents of CResult_TrackedSpendableOutputDecodeErrorZ
26900 pub union CResult_TrackedSpendableOutputDecodeErrorZPtr {
26901 /// A pointer to the contents in the success state.
26902 /// Reading from this pointer when `result_ok` is not set is undefined.
26903 pub result: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
26904 /// A pointer to the contents in the error state.
26905 /// Reading from this pointer when `result_ok` is set is undefined.
26906 pub err: *mut crate::lightning::ln::msgs::DecodeError,
26909 /// A CResult_TrackedSpendableOutputDecodeErrorZ represents the result of a fallible operation,
26910 /// containing a crate::lightning::util::sweep::TrackedSpendableOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
26911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26912 pub struct CResult_TrackedSpendableOutputDecodeErrorZ {
26913 /// The contents of this CResult_TrackedSpendableOutputDecodeErrorZ, accessible via either
26914 /// `err` or `result` depending on the state of `result_ok`.
26915 pub contents: CResult_TrackedSpendableOutputDecodeErrorZPtr,
26916 /// Whether this CResult_TrackedSpendableOutputDecodeErrorZ represents a success state.
26917 pub result_ok: bool,
26920 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the success state.
26921 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_ok(o: crate::lightning::util::sweep::TrackedSpendableOutput) -> CResult_TrackedSpendableOutputDecodeErrorZ {
26922 CResult_TrackedSpendableOutputDecodeErrorZ {
26923 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26924 result: Box::into_raw(Box::new(o)),
26930 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the error state.
26931 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TrackedSpendableOutputDecodeErrorZ {
26932 CResult_TrackedSpendableOutputDecodeErrorZ {
26933 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26934 err: Box::into_raw(Box::new(e)),
26939 /// Checks if the given object is currently in the success state
26941 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o: &CResult_TrackedSpendableOutputDecodeErrorZ) -> bool {
26945 /// Frees any resources used by the CResult_TrackedSpendableOutputDecodeErrorZ.
26946 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_free(_res: CResult_TrackedSpendableOutputDecodeErrorZ) { }
26947 impl Drop for CResult_TrackedSpendableOutputDecodeErrorZ {
26948 fn drop(&mut self) {
26949 if self.result_ok {
26950 if unsafe { !(self.contents.result as *mut ()).is_null() } {
26951 let _ = unsafe { Box::from_raw(self.contents.result) };
26954 if unsafe { !(self.contents.err as *mut ()).is_null() } {
26955 let _ = unsafe { Box::from_raw(self.contents.err) };
26960 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TrackedSpendableOutputDecodeErrorZ {
26961 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
26962 let contents = if o.result_ok {
26963 let result = unsafe { o.contents.result };
26964 unsafe { o.contents.result = core::ptr::null_mut() };
26965 CResult_TrackedSpendableOutputDecodeErrorZPtr { result }
26967 let err = unsafe { o.contents.err };
26968 unsafe { o.contents.err = core::ptr::null_mut(); }
26969 CResult_TrackedSpendableOutputDecodeErrorZPtr { err }
26973 result_ok: o.result_ok,
26977 impl Clone for CResult_TrackedSpendableOutputDecodeErrorZ {
26978 fn clone(&self) -> Self {
26979 if self.result_ok {
26980 Self { result_ok: true, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26981 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::TrackedSpendableOutput>::clone(unsafe { &*self.contents.result })))
26984 Self { result_ok: false, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26985 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26991 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ which has the same data as `orig`
26992 /// but with all dynamically-allocated buffers duplicated in new buffers.
26993 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig: &CResult_TrackedSpendableOutputDecodeErrorZ) -> CResult_TrackedSpendableOutputDecodeErrorZ { Clone::clone(&orig) }
26995 /// The contents of CResult_OutputSpendStatusDecodeErrorZ
26996 pub union CResult_OutputSpendStatusDecodeErrorZPtr {
26997 /// A pointer to the contents in the success state.
26998 /// Reading from this pointer when `result_ok` is not set is undefined.
26999 pub result: *mut crate::lightning::util::sweep::OutputSpendStatus,
27000 /// A pointer to the contents in the error state.
27001 /// Reading from this pointer when `result_ok` is set is undefined.
27002 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27005 /// A CResult_OutputSpendStatusDecodeErrorZ represents the result of a fallible operation,
27006 /// containing a crate::lightning::util::sweep::OutputSpendStatus on success and a crate::lightning::ln::msgs::DecodeError on failure.
27007 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27008 pub struct CResult_OutputSpendStatusDecodeErrorZ {
27009 /// The contents of this CResult_OutputSpendStatusDecodeErrorZ, accessible via either
27010 /// `err` or `result` depending on the state of `result_ok`.
27011 pub contents: CResult_OutputSpendStatusDecodeErrorZPtr,
27012 /// Whether this CResult_OutputSpendStatusDecodeErrorZ represents a success state.
27013 pub result_ok: bool,
27016 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the success state.
27017 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSpendStatus) -> CResult_OutputSpendStatusDecodeErrorZ {
27018 CResult_OutputSpendStatusDecodeErrorZ {
27019 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27020 result: Box::into_raw(Box::new(o)),
27026 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the error state.
27027 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSpendStatusDecodeErrorZ {
27028 CResult_OutputSpendStatusDecodeErrorZ {
27029 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27030 err: Box::into_raw(Box::new(e)),
27035 /// Checks if the given object is currently in the success state
27037 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_is_ok(o: &CResult_OutputSpendStatusDecodeErrorZ) -> bool {
27041 /// Frees any resources used by the CResult_OutputSpendStatusDecodeErrorZ.
27042 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_free(_res: CResult_OutputSpendStatusDecodeErrorZ) { }
27043 impl Drop for CResult_OutputSpendStatusDecodeErrorZ {
27044 fn drop(&mut self) {
27045 if self.result_ok {
27046 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27047 let _ = unsafe { Box::from_raw(self.contents.result) };
27050 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27051 let _ = unsafe { Box::from_raw(self.contents.err) };
27056 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSpendStatusDecodeErrorZ {
27057 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>) -> Self {
27058 let contents = if o.result_ok {
27059 let result = unsafe { o.contents.result };
27060 unsafe { o.contents.result = core::ptr::null_mut() };
27061 CResult_OutputSpendStatusDecodeErrorZPtr { result }
27063 let err = unsafe { o.contents.err };
27064 unsafe { o.contents.err = core::ptr::null_mut(); }
27065 CResult_OutputSpendStatusDecodeErrorZPtr { err }
27069 result_ok: o.result_ok,
27073 impl Clone for CResult_OutputSpendStatusDecodeErrorZ {
27074 fn clone(&self) -> Self {
27075 if self.result_ok {
27076 Self { result_ok: true, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27077 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::OutputSpendStatus>::clone(unsafe { &*self.contents.result })))
27080 Self { result_ok: false, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27081 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27087 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ which has the same data as `orig`
27088 /// but with all dynamically-allocated buffers duplicated in new buffers.
27089 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_clone(orig: &CResult_OutputSpendStatusDecodeErrorZ) -> CResult_OutputSpendStatusDecodeErrorZ { Clone::clone(&orig) }
27091 /// An enum which can either contain a crate::lightning::chain::Filter or not
27092 pub enum COption_FilterZ {
27093 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
27094 Some(crate::lightning::chain::Filter),
27095 /// When we're in this state, this COption_FilterZ contains nothing
27098 impl COption_FilterZ {
27099 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
27100 if let Self::None = self { false } else { true }
27102 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
27105 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
27106 if let Self::Some(v) = self { v } else { unreachable!() }
27110 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
27111 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
27112 COption_FilterZ::Some(o)
27115 /// Constructs a new COption_FilterZ containing nothing
27116 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
27117 COption_FilterZ::None
27120 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
27121 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
27123 /// A dynamically-allocated array of crate::lightning::util::sweep::TrackedSpendableOutputs of arbitrary size.
27124 /// This corresponds to std::vector in C++
27125 pub struct CVec_TrackedSpendableOutputZ {
27126 /// The elements in the array.
27127 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27128 pub data: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
27129 /// The number of elements pointed to by `data`.
27132 impl CVec_TrackedSpendableOutputZ {
27133 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::sweep::TrackedSpendableOutput> {
27134 if self.datalen == 0 { return Vec::new(); }
27135 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27136 self.data = core::ptr::null_mut();
27140 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::sweep::TrackedSpendableOutput] {
27141 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27144 impl From<Vec<crate::lightning::util::sweep::TrackedSpendableOutput>> for CVec_TrackedSpendableOutputZ {
27145 fn from(v: Vec<crate::lightning::util::sweep::TrackedSpendableOutput>) -> Self {
27146 let datalen = v.len();
27147 let data = Box::into_raw(v.into_boxed_slice());
27148 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27152 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27153 pub extern "C" fn CVec_TrackedSpendableOutputZ_free(_res: CVec_TrackedSpendableOutputZ) { }
27154 impl Drop for CVec_TrackedSpendableOutputZ {
27155 fn drop(&mut self) {
27156 if self.datalen == 0 { return; }
27157 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27160 impl Clone for CVec_TrackedSpendableOutputZ {
27161 fn clone(&self) -> Self {
27162 let mut res = Vec::new();
27163 if self.datalen == 0 { return Self::from(res); }
27164 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
27169 /// The contents of CResult_OutputSweeperDecodeErrorZ
27170 pub union CResult_OutputSweeperDecodeErrorZPtr {
27171 /// A pointer to the contents in the success state.
27172 /// Reading from this pointer when `result_ok` is not set is undefined.
27173 pub result: *mut crate::lightning::util::sweep::OutputSweeper,
27174 /// A pointer to the contents in the error state.
27175 /// Reading from this pointer when `result_ok` is set is undefined.
27176 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27179 /// A CResult_OutputSweeperDecodeErrorZ represents the result of a fallible operation,
27180 /// containing a crate::lightning::util::sweep::OutputSweeper on success and a crate::lightning::ln::msgs::DecodeError on failure.
27181 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27182 pub struct CResult_OutputSweeperDecodeErrorZ {
27183 /// The contents of this CResult_OutputSweeperDecodeErrorZ, accessible via either
27184 /// `err` or `result` depending on the state of `result_ok`.
27185 pub contents: CResult_OutputSweeperDecodeErrorZPtr,
27186 /// Whether this CResult_OutputSweeperDecodeErrorZ represents a success state.
27187 pub result_ok: bool,
27190 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the success state.
27191 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSweeper) -> CResult_OutputSweeperDecodeErrorZ {
27192 CResult_OutputSweeperDecodeErrorZ {
27193 contents: CResult_OutputSweeperDecodeErrorZPtr {
27194 result: Box::into_raw(Box::new(o)),
27200 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the error state.
27201 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSweeperDecodeErrorZ {
27202 CResult_OutputSweeperDecodeErrorZ {
27203 contents: CResult_OutputSweeperDecodeErrorZPtr {
27204 err: Box::into_raw(Box::new(e)),
27209 /// Checks if the given object is currently in the success state
27211 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_is_ok(o: &CResult_OutputSweeperDecodeErrorZ) -> bool {
27215 /// Frees any resources used by the CResult_OutputSweeperDecodeErrorZ.
27216 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_free(_res: CResult_OutputSweeperDecodeErrorZ) { }
27217 impl Drop for CResult_OutputSweeperDecodeErrorZ {
27218 fn drop(&mut self) {
27219 if self.result_ok {
27220 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27221 let _ = unsafe { Box::from_raw(self.contents.result) };
27224 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27225 let _ = unsafe { Box::from_raw(self.contents.err) };
27230 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSweeperDecodeErrorZ {
27231 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>) -> Self {
27232 let contents = if o.result_ok {
27233 let result = unsafe { o.contents.result };
27234 unsafe { o.contents.result = core::ptr::null_mut() };
27235 CResult_OutputSweeperDecodeErrorZPtr { result }
27237 let err = unsafe { o.contents.err };
27238 unsafe { o.contents.err = core::ptr::null_mut(); }
27239 CResult_OutputSweeperDecodeErrorZPtr { err }
27243 result_ok: o.result_ok,
27248 /// A tuple of 2 elements. See the individual fields for the types contained.
27249 pub struct C2Tuple_BestBlockOutputSweeperZ {
27250 /// The element at position 0
27251 pub a: crate::lightning::chain::BestBlock,
27252 /// The element at position 1
27253 pub b: crate::lightning::util::sweep::OutputSweeper,
27255 impl From<(crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)> for C2Tuple_BestBlockOutputSweeperZ {
27256 fn from (tup: (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)) -> Self {
27263 impl C2Tuple_BestBlockOutputSweeperZ {
27264 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper) {
27268 /// Creates a new C2Tuple_BestBlockOutputSweeperZ from the contained elements.
27270 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_new(a: crate::lightning::chain::BestBlock, b: crate::lightning::util::sweep::OutputSweeper) -> C2Tuple_BestBlockOutputSweeperZ {
27271 C2Tuple_BestBlockOutputSweeperZ { a, b, }
27275 /// Frees any resources used by the C2Tuple_BestBlockOutputSweeperZ.
27276 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_free(_res: C2Tuple_BestBlockOutputSweeperZ) { }
27278 /// The contents of CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ
27279 pub union CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27280 /// A pointer to the contents in the success state.
27281 /// Reading from this pointer when `result_ok` is not set is undefined.
27282 pub result: *mut crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ,
27283 /// A pointer to the contents in the error state.
27284 /// Reading from this pointer when `result_ok` is set is undefined.
27285 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27288 /// A CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents the result of a fallible operation,
27289 /// containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
27290 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27291 pub struct CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27292 /// The contents of this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ, accessible via either
27293 /// `err` or `result` depending on the state of `result_ok`.
27294 pub contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr,
27295 /// Whether this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents a success state.
27296 pub result_ok: bool,
27299 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the success state.
27300 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27301 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27302 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27303 result: Box::into_raw(Box::new(o)),
27309 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the error state.
27310 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27311 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27312 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27313 err: Box::into_raw(Box::new(e)),
27318 /// Checks if the given object is currently in the success state
27320 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) -> bool {
27324 /// Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ.
27325 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) { }
27326 impl Drop for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27327 fn drop(&mut self) {
27328 if self.result_ok {
27329 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27330 let _ = unsafe { Box::from_raw(self.contents.result) };
27333 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27334 let _ = unsafe { Box::from_raw(self.contents.err) };
27339 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27340 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
27341 let contents = if o.result_ok {
27342 let result = unsafe { o.contents.result };
27343 unsafe { o.contents.result = core::ptr::null_mut() };
27344 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { result }
27346 let err = unsafe { o.contents.err };
27347 unsafe { o.contents.err = core::ptr::null_mut(); }
27348 CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { err }
27352 result_ok: o.result_ok,
27357 /// The contents of CResult_DelayedPaymentBasepointDecodeErrorZ
27358 pub union CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27359 /// A pointer to the contents in the success state.
27360 /// Reading from this pointer when `result_ok` is not set is undefined.
27361 pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentBasepoint,
27362 /// A pointer to the contents in the error state.
27363 /// Reading from this pointer when `result_ok` is set is undefined.
27364 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27367 /// A CResult_DelayedPaymentBasepointDecodeErrorZ represents the result of a fallible operation,
27368 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27369 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27370 pub struct CResult_DelayedPaymentBasepointDecodeErrorZ {
27371 /// The contents of this CResult_DelayedPaymentBasepointDecodeErrorZ, accessible via either
27372 /// `err` or `result` depending on the state of `result_ok`.
27373 pub contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr,
27374 /// Whether this CResult_DelayedPaymentBasepointDecodeErrorZ represents a success state.
27375 pub result_ok: bool,
27378 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state.
27379 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentBasepoint) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
27380 CResult_DelayedPaymentBasepointDecodeErrorZ {
27381 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27382 result: Box::into_raw(Box::new(o)),
27388 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state.
27389 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
27390 CResult_DelayedPaymentBasepointDecodeErrorZ {
27391 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27392 err: Box::into_raw(Box::new(e)),
27397 /// Checks if the given object is currently in the success state
27399 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> bool {
27403 /// Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ.
27404 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res: CResult_DelayedPaymentBasepointDecodeErrorZ) { }
27405 impl Drop for CResult_DelayedPaymentBasepointDecodeErrorZ {
27406 fn drop(&mut self) {
27407 if self.result_ok {
27408 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27409 let _ = unsafe { Box::from_raw(self.contents.result) };
27412 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27413 let _ = unsafe { Box::from_raw(self.contents.err) };
27418 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentBasepointDecodeErrorZ {
27419 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27420 let contents = if o.result_ok {
27421 let result = unsafe { o.contents.result };
27422 unsafe { o.contents.result = core::ptr::null_mut() };
27423 CResult_DelayedPaymentBasepointDecodeErrorZPtr { result }
27425 let err = unsafe { o.contents.err };
27426 unsafe { o.contents.err = core::ptr::null_mut(); }
27427 CResult_DelayedPaymentBasepointDecodeErrorZPtr { err }
27431 result_ok: o.result_ok,
27435 impl Clone for CResult_DelayedPaymentBasepointDecodeErrorZ {
27436 fn clone(&self) -> Self {
27437 if self.result_ok {
27438 Self { result_ok: true, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27439 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint>::clone(unsafe { &*self.contents.result })))
27442 Self { result_ok: false, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27443 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27449 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig`
27450 /// but with all dynamically-allocated buffers duplicated in new buffers.
27451 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> CResult_DelayedPaymentBasepointDecodeErrorZ { Clone::clone(&orig) }
27453 /// The contents of CResult_DelayedPaymentKeyDecodeErrorZ
27454 pub union CResult_DelayedPaymentKeyDecodeErrorZPtr {
27455 /// A pointer to the contents in the success state.
27456 /// Reading from this pointer when `result_ok` is not set is undefined.
27457 pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentKey,
27458 /// A pointer to the contents in the error state.
27459 /// Reading from this pointer when `result_ok` is set is undefined.
27460 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27463 /// A CResult_DelayedPaymentKeyDecodeErrorZ represents the result of a fallible operation,
27464 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27465 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27466 pub struct CResult_DelayedPaymentKeyDecodeErrorZ {
27467 /// The contents of this CResult_DelayedPaymentKeyDecodeErrorZ, accessible via either
27468 /// `err` or `result` depending on the state of `result_ok`.
27469 pub contents: CResult_DelayedPaymentKeyDecodeErrorZPtr,
27470 /// Whether this CResult_DelayedPaymentKeyDecodeErrorZ represents a success state.
27471 pub result_ok: bool,
27474 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state.
27475 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentKey) -> CResult_DelayedPaymentKeyDecodeErrorZ {
27476 CResult_DelayedPaymentKeyDecodeErrorZ {
27477 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27478 result: Box::into_raw(Box::new(o)),
27484 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state.
27485 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentKeyDecodeErrorZ {
27486 CResult_DelayedPaymentKeyDecodeErrorZ {
27487 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27488 err: Box::into_raw(Box::new(e)),
27493 /// Checks if the given object is currently in the success state
27495 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentKeyDecodeErrorZ) -> bool {
27499 /// Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ.
27500 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_free(_res: CResult_DelayedPaymentKeyDecodeErrorZ) { }
27501 impl Drop for CResult_DelayedPaymentKeyDecodeErrorZ {
27502 fn drop(&mut self) {
27503 if self.result_ok {
27504 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27505 let _ = unsafe { Box::from_raw(self.contents.result) };
27508 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27509 let _ = unsafe { Box::from_raw(self.contents.err) };
27514 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentKeyDecodeErrorZ {
27515 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27516 let contents = if o.result_ok {
27517 let result = unsafe { o.contents.result };
27518 unsafe { o.contents.result = core::ptr::null_mut() };
27519 CResult_DelayedPaymentKeyDecodeErrorZPtr { result }
27521 let err = unsafe { o.contents.err };
27522 unsafe { o.contents.err = core::ptr::null_mut(); }
27523 CResult_DelayedPaymentKeyDecodeErrorZPtr { err }
27527 result_ok: o.result_ok,
27531 impl Clone for CResult_DelayedPaymentKeyDecodeErrorZ {
27532 fn clone(&self) -> Self {
27533 if self.result_ok {
27534 Self { result_ok: true, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27535 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentKey>::clone(unsafe { &*self.contents.result })))
27538 Self { result_ok: false, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27539 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27545 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig`
27546 /// but with all dynamically-allocated buffers duplicated in new buffers.
27547 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig: &CResult_DelayedPaymentKeyDecodeErrorZ) -> CResult_DelayedPaymentKeyDecodeErrorZ { Clone::clone(&orig) }
27549 /// The contents of CResult_HtlcBasepointDecodeErrorZ
27550 pub union CResult_HtlcBasepointDecodeErrorZPtr {
27551 /// A pointer to the contents in the success state.
27552 /// Reading from this pointer when `result_ok` is not set is undefined.
27553 pub result: *mut crate::lightning::ln::channel_keys::HtlcBasepoint,
27554 /// A pointer to the contents in the error state.
27555 /// Reading from this pointer when `result_ok` is set is undefined.
27556 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27559 /// A CResult_HtlcBasepointDecodeErrorZ represents the result of a fallible operation,
27560 /// containing a crate::lightning::ln::channel_keys::HtlcBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27561 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27562 pub struct CResult_HtlcBasepointDecodeErrorZ {
27563 /// The contents of this CResult_HtlcBasepointDecodeErrorZ, accessible via either
27564 /// `err` or `result` depending on the state of `result_ok`.
27565 pub contents: CResult_HtlcBasepointDecodeErrorZPtr,
27566 /// Whether this CResult_HtlcBasepointDecodeErrorZ represents a success state.
27567 pub result_ok: bool,
27570 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state.
27571 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcBasepoint) -> CResult_HtlcBasepointDecodeErrorZ {
27572 CResult_HtlcBasepointDecodeErrorZ {
27573 contents: CResult_HtlcBasepointDecodeErrorZPtr {
27574 result: Box::into_raw(Box::new(o)),
27580 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state.
27581 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcBasepointDecodeErrorZ {
27582 CResult_HtlcBasepointDecodeErrorZ {
27583 contents: CResult_HtlcBasepointDecodeErrorZPtr {
27584 err: Box::into_raw(Box::new(e)),
27589 /// Checks if the given object is currently in the success state
27591 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_is_ok(o: &CResult_HtlcBasepointDecodeErrorZ) -> bool {
27595 /// Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ.
27596 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_free(_res: CResult_HtlcBasepointDecodeErrorZ) { }
27597 impl Drop for CResult_HtlcBasepointDecodeErrorZ {
27598 fn drop(&mut self) {
27599 if self.result_ok {
27600 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27601 let _ = unsafe { Box::from_raw(self.contents.result) };
27604 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27605 let _ = unsafe { Box::from_raw(self.contents.err) };
27610 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcBasepointDecodeErrorZ {
27611 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27612 let contents = if o.result_ok {
27613 let result = unsafe { o.contents.result };
27614 unsafe { o.contents.result = core::ptr::null_mut() };
27615 CResult_HtlcBasepointDecodeErrorZPtr { result }
27617 let err = unsafe { o.contents.err };
27618 unsafe { o.contents.err = core::ptr::null_mut(); }
27619 CResult_HtlcBasepointDecodeErrorZPtr { err }
27623 result_ok: o.result_ok,
27627 impl Clone for CResult_HtlcBasepointDecodeErrorZ {
27628 fn clone(&self) -> Self {
27629 if self.result_ok {
27630 Self { result_ok: true, contents: CResult_HtlcBasepointDecodeErrorZPtr {
27631 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcBasepoint>::clone(unsafe { &*self.contents.result })))
27634 Self { result_ok: false, contents: CResult_HtlcBasepointDecodeErrorZPtr {
27635 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27641 /// Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig`
27642 /// but with all dynamically-allocated buffers duplicated in new buffers.
27643 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_clone(orig: &CResult_HtlcBasepointDecodeErrorZ) -> CResult_HtlcBasepointDecodeErrorZ { Clone::clone(&orig) }
27645 /// The contents of CResult_HtlcKeyDecodeErrorZ
27646 pub union CResult_HtlcKeyDecodeErrorZPtr {
27647 /// A pointer to the contents in the success state.
27648 /// Reading from this pointer when `result_ok` is not set is undefined.
27649 pub result: *mut crate::lightning::ln::channel_keys::HtlcKey,
27650 /// A pointer to the contents in the error state.
27651 /// Reading from this pointer when `result_ok` is set is undefined.
27652 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27655 /// A CResult_HtlcKeyDecodeErrorZ represents the result of a fallible operation,
27656 /// containing a crate::lightning::ln::channel_keys::HtlcKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27657 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27658 pub struct CResult_HtlcKeyDecodeErrorZ {
27659 /// The contents of this CResult_HtlcKeyDecodeErrorZ, accessible via either
27660 /// `err` or `result` depending on the state of `result_ok`.
27661 pub contents: CResult_HtlcKeyDecodeErrorZPtr,
27662 /// Whether this CResult_HtlcKeyDecodeErrorZ represents a success state.
27663 pub result_ok: bool,
27666 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the success state.
27667 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcKey) -> CResult_HtlcKeyDecodeErrorZ {
27668 CResult_HtlcKeyDecodeErrorZ {
27669 contents: CResult_HtlcKeyDecodeErrorZPtr {
27670 result: Box::into_raw(Box::new(o)),
27676 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the error state.
27677 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcKeyDecodeErrorZ {
27678 CResult_HtlcKeyDecodeErrorZ {
27679 contents: CResult_HtlcKeyDecodeErrorZPtr {
27680 err: Box::into_raw(Box::new(e)),
27685 /// Checks if the given object is currently in the success state
27687 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_is_ok(o: &CResult_HtlcKeyDecodeErrorZ) -> bool {
27691 /// Frees any resources used by the CResult_HtlcKeyDecodeErrorZ.
27692 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_free(_res: CResult_HtlcKeyDecodeErrorZ) { }
27693 impl Drop for CResult_HtlcKeyDecodeErrorZ {
27694 fn drop(&mut self) {
27695 if self.result_ok {
27696 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27697 let _ = unsafe { Box::from_raw(self.contents.result) };
27700 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27701 let _ = unsafe { Box::from_raw(self.contents.err) };
27706 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcKeyDecodeErrorZ {
27707 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27708 let contents = if o.result_ok {
27709 let result = unsafe { o.contents.result };
27710 unsafe { o.contents.result = core::ptr::null_mut() };
27711 CResult_HtlcKeyDecodeErrorZPtr { result }
27713 let err = unsafe { o.contents.err };
27714 unsafe { o.contents.err = core::ptr::null_mut(); }
27715 CResult_HtlcKeyDecodeErrorZPtr { err }
27719 result_ok: o.result_ok,
27723 impl Clone for CResult_HtlcKeyDecodeErrorZ {
27724 fn clone(&self) -> Self {
27725 if self.result_ok {
27726 Self { result_ok: true, contents: CResult_HtlcKeyDecodeErrorZPtr {
27727 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcKey>::clone(unsafe { &*self.contents.result })))
27730 Self { result_ok: false, contents: CResult_HtlcKeyDecodeErrorZPtr {
27731 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27737 /// Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig`
27738 /// but with all dynamically-allocated buffers duplicated in new buffers.
27739 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_clone(orig: &CResult_HtlcKeyDecodeErrorZ) -> CResult_HtlcKeyDecodeErrorZ { Clone::clone(&orig) }
27741 /// The contents of CResult_RevocationBasepointDecodeErrorZ
27742 pub union CResult_RevocationBasepointDecodeErrorZPtr {
27743 /// A pointer to the contents in the success state.
27744 /// Reading from this pointer when `result_ok` is not set is undefined.
27745 pub result: *mut crate::lightning::ln::channel_keys::RevocationBasepoint,
27746 /// A pointer to the contents in the error state.
27747 /// Reading from this pointer when `result_ok` is set is undefined.
27748 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27751 /// A CResult_RevocationBasepointDecodeErrorZ represents the result of a fallible operation,
27752 /// containing a crate::lightning::ln::channel_keys::RevocationBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27753 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27754 pub struct CResult_RevocationBasepointDecodeErrorZ {
27755 /// The contents of this CResult_RevocationBasepointDecodeErrorZ, accessible via either
27756 /// `err` or `result` depending on the state of `result_ok`.
27757 pub contents: CResult_RevocationBasepointDecodeErrorZPtr,
27758 /// Whether this CResult_RevocationBasepointDecodeErrorZ represents a success state.
27759 pub result_ok: bool,
27762 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state.
27763 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationBasepoint) -> CResult_RevocationBasepointDecodeErrorZ {
27764 CResult_RevocationBasepointDecodeErrorZ {
27765 contents: CResult_RevocationBasepointDecodeErrorZPtr {
27766 result: Box::into_raw(Box::new(o)),
27772 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state.
27773 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationBasepointDecodeErrorZ {
27774 CResult_RevocationBasepointDecodeErrorZ {
27775 contents: CResult_RevocationBasepointDecodeErrorZPtr {
27776 err: Box::into_raw(Box::new(e)),
27781 /// Checks if the given object is currently in the success state
27783 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_is_ok(o: &CResult_RevocationBasepointDecodeErrorZ) -> bool {
27787 /// Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ.
27788 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_free(_res: CResult_RevocationBasepointDecodeErrorZ) { }
27789 impl Drop for CResult_RevocationBasepointDecodeErrorZ {
27790 fn drop(&mut self) {
27791 if self.result_ok {
27792 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27793 let _ = unsafe { Box::from_raw(self.contents.result) };
27796 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27797 let _ = unsafe { Box::from_raw(self.contents.err) };
27802 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationBasepointDecodeErrorZ {
27803 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27804 let contents = if o.result_ok {
27805 let result = unsafe { o.contents.result };
27806 unsafe { o.contents.result = core::ptr::null_mut() };
27807 CResult_RevocationBasepointDecodeErrorZPtr { result }
27809 let err = unsafe { o.contents.err };
27810 unsafe { o.contents.err = core::ptr::null_mut(); }
27811 CResult_RevocationBasepointDecodeErrorZPtr { err }
27815 result_ok: o.result_ok,
27819 impl Clone for CResult_RevocationBasepointDecodeErrorZ {
27820 fn clone(&self) -> Self {
27821 if self.result_ok {
27822 Self { result_ok: true, contents: CResult_RevocationBasepointDecodeErrorZPtr {
27823 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationBasepoint>::clone(unsafe { &*self.contents.result })))
27826 Self { result_ok: false, contents: CResult_RevocationBasepointDecodeErrorZPtr {
27827 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27833 /// Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig`
27834 /// but with all dynamically-allocated buffers duplicated in new buffers.
27835 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_clone(orig: &CResult_RevocationBasepointDecodeErrorZ) -> CResult_RevocationBasepointDecodeErrorZ { Clone::clone(&orig) }
27837 /// The contents of CResult_RevocationKeyDecodeErrorZ
27838 pub union CResult_RevocationKeyDecodeErrorZPtr {
27839 /// A pointer to the contents in the success state.
27840 /// Reading from this pointer when `result_ok` is not set is undefined.
27841 pub result: *mut crate::lightning::ln::channel_keys::RevocationKey,
27842 /// A pointer to the contents in the error state.
27843 /// Reading from this pointer when `result_ok` is set is undefined.
27844 pub err: *mut crate::lightning::ln::msgs::DecodeError,
27847 /// A CResult_RevocationKeyDecodeErrorZ represents the result of a fallible operation,
27848 /// containing a crate::lightning::ln::channel_keys::RevocationKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27850 pub struct CResult_RevocationKeyDecodeErrorZ {
27851 /// The contents of this CResult_RevocationKeyDecodeErrorZ, accessible via either
27852 /// `err` or `result` depending on the state of `result_ok`.
27853 pub contents: CResult_RevocationKeyDecodeErrorZPtr,
27854 /// Whether this CResult_RevocationKeyDecodeErrorZ represents a success state.
27855 pub result_ok: bool,
27858 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the success state.
27859 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationKey) -> CResult_RevocationKeyDecodeErrorZ {
27860 CResult_RevocationKeyDecodeErrorZ {
27861 contents: CResult_RevocationKeyDecodeErrorZPtr {
27862 result: Box::into_raw(Box::new(o)),
27868 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the error state.
27869 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationKeyDecodeErrorZ {
27870 CResult_RevocationKeyDecodeErrorZ {
27871 contents: CResult_RevocationKeyDecodeErrorZPtr {
27872 err: Box::into_raw(Box::new(e)),
27877 /// Checks if the given object is currently in the success state
27879 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_is_ok(o: &CResult_RevocationKeyDecodeErrorZ) -> bool {
27883 /// Frees any resources used by the CResult_RevocationKeyDecodeErrorZ.
27884 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_free(_res: CResult_RevocationKeyDecodeErrorZ) { }
27885 impl Drop for CResult_RevocationKeyDecodeErrorZ {
27886 fn drop(&mut self) {
27887 if self.result_ok {
27888 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27889 let _ = unsafe { Box::from_raw(self.contents.result) };
27892 if unsafe { !(self.contents.err as *mut ()).is_null() } {
27893 let _ = unsafe { Box::from_raw(self.contents.err) };
27898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationKeyDecodeErrorZ {
27899 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27900 let contents = if o.result_ok {
27901 let result = unsafe { o.contents.result };
27902 unsafe { o.contents.result = core::ptr::null_mut() };
27903 CResult_RevocationKeyDecodeErrorZPtr { result }
27905 let err = unsafe { o.contents.err };
27906 unsafe { o.contents.err = core::ptr::null_mut(); }
27907 CResult_RevocationKeyDecodeErrorZPtr { err }
27911 result_ok: o.result_ok,
27915 impl Clone for CResult_RevocationKeyDecodeErrorZ {
27916 fn clone(&self) -> Self {
27917 if self.result_ok {
27918 Self { result_ok: true, contents: CResult_RevocationKeyDecodeErrorZPtr {
27919 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationKey>::clone(unsafe { &*self.contents.result })))
27922 Self { result_ok: false, contents: CResult_RevocationKeyDecodeErrorZPtr {
27923 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27929 /// Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig`
27930 /// but with all dynamically-allocated buffers duplicated in new buffers.
27931 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_clone(orig: &CResult_RevocationKeyDecodeErrorZ) -> CResult_RevocationKeyDecodeErrorZ { Clone::clone(&orig) }
27933 /// The contents of CResult_LockedChannelMonitorNoneZ
27934 pub union CResult_LockedChannelMonitorNoneZPtr {
27935 /// A pointer to the contents in the success state.
27936 /// Reading from this pointer when `result_ok` is not set is undefined.
27937 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
27938 /// Note that this value is always NULL, as there are no contents in the Err variant
27939 pub err: *mut core::ffi::c_void,
27942 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
27943 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
27944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27945 pub struct CResult_LockedChannelMonitorNoneZ {
27946 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
27947 /// `err` or `result` depending on the state of `result_ok`.
27948 pub contents: CResult_LockedChannelMonitorNoneZPtr,
27949 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
27950 pub result_ok: bool,
27953 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
27954 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
27955 CResult_LockedChannelMonitorNoneZ {
27956 contents: CResult_LockedChannelMonitorNoneZPtr {
27957 result: Box::into_raw(Box::new(o)),
27963 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
27964 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
27965 CResult_LockedChannelMonitorNoneZ {
27966 contents: CResult_LockedChannelMonitorNoneZPtr {
27967 err: core::ptr::null_mut(),
27972 /// Checks if the given object is currently in the success state
27974 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
27978 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
27979 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
27980 impl Drop for CResult_LockedChannelMonitorNoneZ {
27981 fn drop(&mut self) {
27982 if self.result_ok {
27983 if unsafe { !(self.contents.result as *mut ()).is_null() } {
27984 let _ = unsafe { Box::from_raw(self.contents.result) };
27990 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
27991 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
27992 let contents = if o.result_ok {
27993 let result = unsafe { o.contents.result };
27994 unsafe { o.contents.result = core::ptr::null_mut() };
27995 CResult_LockedChannelMonitorNoneZPtr { result }
27997 let _ = unsafe { Box::from_raw(o.contents.err) };
27998 o.contents.err = core::ptr::null_mut();
27999 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
28003 result_ok: o.result_ok,
28008 /// A tuple of 2 elements. See the individual fields for the types contained.
28009 pub struct C2Tuple_OutPointChannelIdZ {
28010 /// The element at position 0
28011 pub a: crate::lightning::chain::transaction::OutPoint,
28012 /// The element at position 1
28013 pub b: crate::lightning::ln::types::ChannelId,
28015 impl From<(crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)> for C2Tuple_OutPointChannelIdZ {
28016 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)) -> Self {
28023 impl C2Tuple_OutPointChannelIdZ {
28024 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId) {
28028 impl Clone for C2Tuple_OutPointChannelIdZ {
28029 fn clone(&self) -> Self {
28031 a: Clone::clone(&self.a),
28032 b: Clone::clone(&self.b),
28037 /// Creates a new tuple which has the same data as `orig`
28038 /// but with all dynamically-allocated buffers duplicated in new buffers.
28039 pub extern "C" fn C2Tuple_OutPointChannelIdZ_clone(orig: &C2Tuple_OutPointChannelIdZ) -> C2Tuple_OutPointChannelIdZ { Clone::clone(&orig) }
28040 /// Creates a new C2Tuple_OutPointChannelIdZ from the contained elements.
28042 pub extern "C" fn C2Tuple_OutPointChannelIdZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId) -> C2Tuple_OutPointChannelIdZ {
28043 C2Tuple_OutPointChannelIdZ { a, b, }
28047 /// Frees any resources used by the C2Tuple_OutPointChannelIdZ.
28048 pub extern "C" fn C2Tuple_OutPointChannelIdZ_free(_res: C2Tuple_OutPointChannelIdZ) { }
28050 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointChannelIdZs of arbitrary size.
28051 /// This corresponds to std::vector in C++
28052 pub struct CVec_C2Tuple_OutPointChannelIdZZ {
28053 /// The elements in the array.
28054 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28055 pub data: *mut crate::c_types::derived::C2Tuple_OutPointChannelIdZ,
28056 /// The number of elements pointed to by `data`.
28059 impl CVec_C2Tuple_OutPointChannelIdZZ {
28060 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ> {
28061 if self.datalen == 0 { return Vec::new(); }
28062 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28063 self.data = core::ptr::null_mut();
28067 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointChannelIdZ] {
28068 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28071 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>> for CVec_C2Tuple_OutPointChannelIdZZ {
28072 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>) -> Self {
28073 let datalen = v.len();
28074 let data = Box::into_raw(v.into_boxed_slice());
28075 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28079 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28080 pub extern "C" fn CVec_C2Tuple_OutPointChannelIdZZ_free(_res: CVec_C2Tuple_OutPointChannelIdZZ) { }
28081 impl Drop for CVec_C2Tuple_OutPointChannelIdZZ {
28082 fn drop(&mut self) {
28083 if self.datalen == 0 { return; }
28084 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28087 impl Clone for CVec_C2Tuple_OutPointChannelIdZZ {
28088 fn clone(&self) -> Self {
28089 let mut res = Vec::new();
28090 if self.datalen == 0 { return Self::from(res); }
28091 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
28096 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
28097 /// This corresponds to std::vector in C++
28098 pub struct CVec_MonitorUpdateIdZ {
28099 /// The elements in the array.
28100 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28101 pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
28102 /// The number of elements pointed to by `data`.
28105 impl CVec_MonitorUpdateIdZ {
28106 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
28107 if self.datalen == 0 { return Vec::new(); }
28108 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28109 self.data = core::ptr::null_mut();
28113 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
28114 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28117 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
28118 fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
28119 let datalen = v.len();
28120 let data = Box::into_raw(v.into_boxed_slice());
28121 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28125 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28126 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
28127 impl Drop for CVec_MonitorUpdateIdZ {
28128 fn drop(&mut self) {
28129 if self.datalen == 0 { return; }
28130 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28133 impl Clone for CVec_MonitorUpdateIdZ {
28134 fn clone(&self) -> Self {
28135 let mut res = Vec::new();
28136 if self.datalen == 0 { return Self::from(res); }
28137 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
28142 /// A tuple of 2 elements. See the individual fields for the types contained.
28143 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28144 /// The element at position 0
28145 pub a: crate::lightning::chain::transaction::OutPoint,
28146 /// The element at position 1
28147 pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
28149 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28150 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
28157 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28158 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
28162 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28163 fn clone(&self) -> Self {
28165 a: Clone::clone(&self.a),
28166 b: Clone::clone(&self.b),
28171 /// Creates a new tuple which has the same data as `orig`
28172 /// but with all dynamically-allocated buffers duplicated in new buffers.
28173 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
28174 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
28176 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28177 C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
28181 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
28182 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
28184 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
28185 /// This corresponds to std::vector in C++
28186 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28187 /// The elements in the array.
28188 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28189 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
28190 /// The number of elements pointed to by `data`.
28193 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28194 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
28195 if self.datalen == 0 { return Vec::new(); }
28196 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28197 self.data = core::ptr::null_mut();
28201 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
28202 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28205 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28206 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
28207 let datalen = v.len();
28208 let data = Box::into_raw(v.into_boxed_slice());
28209 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28213 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28214 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
28215 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28216 fn drop(&mut self) {
28217 if self.datalen == 0 { return; }
28218 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28221 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28222 fn clone(&self) -> Self {
28223 let mut res = Vec::new();
28224 if self.datalen == 0 { return Self::from(res); }
28225 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });